From f072b98fd76dba9bae5f97f9c793280a4161bb1d Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Mon, 23 Oct 2023 14:32:22 -0400 Subject: [PATCH] Recreates the viewModel when the Account object changes. --- .../com/vitorpamplona/amethyst/ui/screen/AccountScreen.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountScreen.kt index be28fd7aa..af77d49ad 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/AccountScreen.kt @@ -41,7 +41,7 @@ fun AccountScreen( } is AccountState.LoggedIn -> { val accountViewModel: AccountViewModel = viewModel( - key = state.account.userProfile().pubkeyHex, + key = state.account.hashCode().toString(), factory = AccountViewModel.Factory(state.account, sharedPreferencesViewModel.sharedPrefs) ) @@ -49,7 +49,7 @@ fun AccountScreen( } is AccountState.LoggedInViewOnly -> { val accountViewModel: AccountViewModel = viewModel( - key = state.account.userProfile().pubkeyHex, + key = state.account.hashCode().toString(), factory = AccountViewModel.Factory(state.account, sharedPreferencesViewModel.sharedPrefs) )