Makes sure the tryLogin function only runs if it is not already logged in (compostables might call it more times)
This commit is contained in:
+5
-1
@@ -85,7 +85,11 @@ class AccountStateViewModel : ViewModel() {
|
|||||||
|
|
||||||
fun tryLoginExistingAccountAsync() {
|
fun tryLoginExistingAccountAsync() {
|
||||||
// pulls account from storage.
|
// pulls account from storage.
|
||||||
viewModelScope.launch { tryLoginExistingAccount() }
|
if (_accountContent.value !is AccountState.LoggedIn) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
tryLoginExistingAccount()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun tryLoginExistingAccount(route: String? = null) =
|
private suspend fun tryLoginExistingAccount(route: String? = null) =
|
||||||
|
|||||||
Reference in New Issue
Block a user