mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-10 14:32:46 +02:00
Small refactoring
This commit is contained in:
@@ -94,10 +94,18 @@ class AccountStateViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun tryLoginExistingAccount(route: Route? = null) =
|
||||
private suspend fun tryLoginExistingAccount(route: Route? = null) {
|
||||
val accountSettings =
|
||||
withContext(Dispatchers.IO) {
|
||||
LocalPreferences.loadCurrentAccountFromEncryptedStorage()
|
||||
}?.let { startUI(it, route) } ?: run { requestLoginUI() }
|
||||
}
|
||||
|
||||
if (accountSettings != null) {
|
||||
startUI(accountSettings, route)
|
||||
} else {
|
||||
requestLoginUI()
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun requestLoginUI() {
|
||||
_accountContent.update { AccountState.LoggedOff }
|
||||
|
Reference in New Issue
Block a user