Small refactoring

This commit is contained in:
Vitor Pamplona
2025-07-25 14:33:14 -04:00
parent 3a37d5e42d
commit f8f59abdf1

View File

@@ -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 }