|
|
@ -37,19 +37,29 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
final as = accounts.value; |
|
|
|
final as = accounts.value; |
|
|
|
|
|
|
|
|
|
|
|
if (_globalOptions.rememberLastUsedAccount.value && _storage.containsKey(_keyLastUsedAccount)) { |
|
|
|
if (_globalOptions.rememberLastUsedAccount.value && _storage.containsKey(_keyLastUsedAccount)) { |
|
|
|
final lastUsedAccountID = _storage.getString(_keyLastUsedAccount); |
|
|
|
final lastUsedAccountID = _storage.getString(_keyLastUsedAccount); |
|
|
|
activeAccount.add(lastUsedAccountID != null ? as.find(lastUsedAccountID) : null); |
|
|
|
if (lastUsedAccountID != null) { |
|
|
|
} else { |
|
|
|
final aa = as.find(lastUsedAccountID); |
|
|
|
unawaited( |
|
|
|
if (aa != null) { |
|
|
|
_globalOptions.initialAccount.stream.first.then((final lastAccount) { |
|
|
|
setActiveAccount(aa); |
|
|
|
final account = lastAccount != null ? as.find(lastAccount) : null; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unawaited( |
|
|
|
|
|
|
|
_globalOptions.initialAccount.stream.first.then((final lastAccount) { |
|
|
|
|
|
|
|
final account = lastAccount != null ? as.find(lastAccount) : null; |
|
|
|
|
|
|
|
if (activeAccount.valueOrNull == null) { |
|
|
|
if (account != null) { |
|
|
|
if (account != null) { |
|
|
|
activeAccount.add(account); |
|
|
|
setActiveAccount(account); |
|
|
|
|
|
|
|
} else if (as.isNotEmpty) { |
|
|
|
|
|
|
|
setActiveAccount(as.first); |
|
|
|
} |
|
|
|
} |
|
|
|
}), |
|
|
|
} |
|
|
|
); |
|
|
|
}), |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final RequestManager _requestManager; |
|
|
|
final RequestManager _requestManager; |
|
|
|