From 0737c6ddc3e260ea7c5c1b09ec6d8b13092eb575 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Sat, 12 Aug 2023 21:35:50 -0400 Subject: [PATCH] Avoids a redirection of account State --- .../vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt index 75d47cead..b54d274d0 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt @@ -163,13 +163,11 @@ fun WatchPossibleNotificationChanges( onChange: (Boolean) -> Unit ) { val accountState by accountViewModel.accountLiveData.observeAsState() - val account = remember(accountState) { accountState?.account } ?: return - val notifState by accountViewModel.accountLastReadLiveData.observeAsState() LaunchedEffect(key1 = notifState, key2 = accountState) { launch(Dispatchers.IO) { - onChange(route.hasNewItems(account, emptySet())) + onChange(route.hasNewItems(accountViewModel.account, emptySet())) } } @@ -177,7 +175,7 @@ fun WatchPossibleNotificationChanges( launch(Dispatchers.IO) { LocalCache.live.newEventBundles.collect { launch(Dispatchers.IO) { - onChange(route.hasNewItems(account, it)) + onChange(route.hasNewItems(accountViewModel.account, it)) } } }