mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-10 01:12:32 +02:00
Avoids a redirection of account State
This commit is contained in:
@@ -163,13 +163,11 @@ fun WatchPossibleNotificationChanges(
|
|||||||
onChange: (Boolean) -> Unit
|
onChange: (Boolean) -> Unit
|
||||||
) {
|
) {
|
||||||
val accountState by accountViewModel.accountLiveData.observeAsState()
|
val accountState by accountViewModel.accountLiveData.observeAsState()
|
||||||
val account = remember(accountState) { accountState?.account } ?: return
|
|
||||||
|
|
||||||
val notifState by accountViewModel.accountLastReadLiveData.observeAsState()
|
val notifState by accountViewModel.accountLastReadLiveData.observeAsState()
|
||||||
|
|
||||||
LaunchedEffect(key1 = notifState, key2 = accountState) {
|
LaunchedEffect(key1 = notifState, key2 = accountState) {
|
||||||
launch(Dispatchers.IO) {
|
launch(Dispatchers.IO) {
|
||||||
onChange(route.hasNewItems(account, emptySet()))
|
onChange(route.hasNewItems(accountViewModel.account, emptySet()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +175,7 @@ fun WatchPossibleNotificationChanges(
|
|||||||
launch(Dispatchers.IO) {
|
launch(Dispatchers.IO) {
|
||||||
LocalCache.live.newEventBundles.collect {
|
LocalCache.live.newEventBundles.collect {
|
||||||
launch(Dispatchers.IO) {
|
launch(Dispatchers.IO) {
|
||||||
onChange(route.hasNewItems(account, it))
|
onChange(route.hasNewItems(accountViewModel.account, it))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user