Add proper login/out storage/processing on load

codemagic-setup
Hank Grabowski 2023-02-27 14:55:39 -05:00
rodzic 7c68ee62a4
commit d1203c53a2
2 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -37,6 +37,7 @@ class AccountsService extends ChangeNotifier {
for (final p in secretsService.profiles) {
if (!p.loggedIn) {
_loggedOutProfiles.add(p);
continue;
}
final pr = await signIn(p.credentials, withNotification: false);
@ -74,7 +75,6 @@ class AccountsService extends ChangeNotifier {
serverName: credentialsCache!.serverName,
avatar: profileData.avatarUrl,
userId: profileData.id,
id: credentials.id,
loggedIn: true,
);
@ -102,7 +102,8 @@ class AccountsService extends ChangeNotifier {
clearActiveProfile(withNotification: withNotification);
}
_loggedInProfiles.remove(profile);
secretsService.addOrUpdateProfile(profile);
_loggedOutProfiles.add(profile.copyWithLoginUpdate(false));
secretsService.addOrUpdateProfile(profile.copyWithLoginUpdate(false));
if (_loggedInProfiles.isNotEmpty) {
setActiveProfile(

Wyświetl plik

@ -43,6 +43,7 @@ class SecretsService {
FutureResult<List<Profile>, ExecError> addOrUpdateProfile(
Profile profile) async {
try {
_cachedProfiles.remove(profile);
_cachedProfiles.add(profile);
return await saveCredentials();
} on PlatformException catch (e) {