Preserves invalidations of DataSources for Home, Videos and Notifications

This commit is contained in:
Vitor Pamplona
2023-05-25 18:34:40 -04:00
parent 1693455d0d
commit 2ed5eae029
3 changed files with 7 additions and 4 deletions
@@ -59,6 +59,7 @@ fun HomeScreen(
LaunchedEffect(accountViewModel, account.defaultHomeFollowList) {
HomeNewThreadFeedFilter.account = account
HomeConversationsFeedFilter.account = account
NostrHomeDataSource.invalidateFilters()
}
if (wantsToAddNip47 != null) {
@@ -71,6 +72,7 @@ fun HomeScreen(
if (event == Lifecycle.Event.ON_RESUME) {
HomeNewThreadFeedFilter.account = account
HomeConversationsFeedFilter.account = account
NostrHomeDataSource.invalidateFilters()
}
}
@@ -84,7 +86,7 @@ fun HomeScreen(
val scope = rememberCoroutineScope()
LaunchedEffect(key1 = Unit) {
scope.launch(Dispatchers.IO) {
NostrHomeDataSource.resetFilters()
NostrHomeDataSource.invalidateFilters()
homeFeedViewModel.invalidateData(true)
repliesFeedViewModel.invalidateData(true)
}
@@ -70,8 +70,8 @@ fun NotificationScreen(
notifFeedViewModel.clear()
}
LaunchedEffect(account.userProfile().pubkeyHex, account.defaultNotificationFollowList) {
NostrAccountDataSource.resetFilters()
LaunchedEffect(accountViewModel, account.defaultNotificationFollowList) {
NostrAccountDataSource.invalidateFilters()
NotificationFeedFilter.account = account
}
@@ -79,8 +79,8 @@ fun NotificationScreen(
DisposableEffect(accountViewModel) {
val observer = LifecycleEventObserver { _, event ->
if (event == Lifecycle.Event.ON_RESUME) {
NostrAccountDataSource.invalidateFilters()
NotificationFeedFilter.account = account
notifFeedViewModel.invalidateData(true)
}
}
@@ -123,6 +123,7 @@ fun VideoScreen(
LaunchedEffect(accountViewModel, accountState.value?.account?.defaultStoriesFollowList) {
VideoFeedFilter.account = account
NostrVideoDataSource.account = account
NostrVideoDataSource.resetFilters()
}
DisposableEffect(accountViewModel) {