mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-02 20:44:57 +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) {
|
||||||
withContext(Dispatchers.IO) {
|
val accountSettings =
|
||||||
LocalPreferences.loadCurrentAccountFromEncryptedStorage()
|
withContext(Dispatchers.IO) {
|
||||||
}?.let { startUI(it, route) } ?: run { requestLoginUI() }
|
LocalPreferences.loadCurrentAccountFromEncryptedStorage()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountSettings != null) {
|
||||||
|
startUI(accountSettings, route)
|
||||||
|
} else {
|
||||||
|
requestLoginUI()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private suspend fun requestLoginUI() {
|
private suspend fun requestLoginUI() {
|
||||||
_accountContent.update { AccountState.LoggedOff }
|
_accountContent.update { AccountState.LoggedOff }
|
||||||
|
Reference in New Issue
Block a user