Skip to content

Commit

Permalink
Updated backward compatibility for versions prior to rokmetro auth sc…
Browse files Browse the repository at this point in the history
…heme (#396).
  • Loading branch information
Mihail Varbanov committed Dec 23, 2020
1 parent 24512f5 commit 12c46e3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/service/Auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,8 @@ class Auth with Service implements NotificationsListener {
_userPiiCacheFile = await _getUserPiiCacheFile();
_userPiiData = await _loadUserPiiDataFromCache();

// Backward compatability
if ((_authToken != null) && (_rokmetroToken == null)) {
_rokmetroToken = await _loadRokmetroToken(optAuthToken: _authToken);
_rokmetroUser = await _loadRokmetroUser(optRokmetroToken: _rokmetroToken);
}
// Backward compatability - no rokmetro data stored from previous versions
await _ensureRokmetroData();

_syncProfilePiiDataIfNeed(); // No need for await
}
Expand Down Expand Up @@ -665,6 +662,15 @@ class Auth with Service implements NotificationsListener {
return null;
}

Future<void> _ensureRokmetroData() async {
if ((_authToken != null) && (_rokmetroToken == null)) {
Storage().rokmetroToken = _rokmetroToken = await _loadRokmetroToken(optAuthToken: _authToken);
}
if ((_rokmetroToken != null) && (_rokmetroUser == null)) {
Storage().rokmetroUser = _rokmetroUser = await _loadRokmetroUser(optRokmetroToken: _rokmetroToken);
}
}

/// UserPIIData
Future<String> _loadPidWithPhoneAuth({String phone, AuthToken optAuthToken}) async {
Expand Down

0 comments on commit 12c46e3

Please sign in to comment.