diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/CardFeedViewModel.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/CardFeedViewModel.kt index cdcac191e..40ed18d80 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/CardFeedViewModel.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/CardFeedViewModel.kt @@ -48,7 +48,7 @@ open class CardFeedViewModel(val localFilter: FeedFilter) : ViewModel() { @Synchronized private fun refreshSuspended() { - val notes = localFilter.loadTop() + val notes = localFilter.feed() val thisAccount = (localFilter as? NotificationFeedFilter)?.account val lastNotesCopy = if (thisAccount == lastAccount) lastNotes else null @@ -59,7 +59,12 @@ open class CardFeedViewModel(val localFilter: FeedFilter) : ViewModel() { if (newCards.isNotEmpty()) { lastNotes = notes.toSet() lastAccount = (localFilter as? NotificationFeedFilter)?.account - updateFeed((oldNotesState.feed.value + newCards).distinctBy { it.id() }.sortedWith(compareBy({ it.createdAt() }, { it.id() })).reversed()) + val singleList = (oldNotesState.feed.value + newCards) + .distinctBy { it.id() } + .sortedWith(compareBy({ it.createdAt() }, { it.id() })) + .reversed() + .take(1000) + updateFeed(singleList) } } else { val cards = convertToCard(notes) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/NotificationScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/NotificationScreen.kt index 298955136..79843b121 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/NotificationScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/NotificationScreen.kt @@ -75,7 +75,7 @@ fun NotificationScreen( NostrAccountDataSource.resetFilters() NotificationFeedFilter.account = account notifFeedViewModel.clear() - notifFeedViewModel.refresh() + notifFeedViewModel.invalidateData() } val lifeCycleOwner = LocalLifecycleOwner.current