Fixing missing some notifications.

This commit is contained in:
Vitor Pamplona 2023-05-23 16:04:29 -04:00
parent 5a375b94d6
commit f0ba68e467
2 changed files with 8 additions and 3 deletions

View File

@ -48,7 +48,7 @@ open class CardFeedViewModel(val localFilter: FeedFilter<Note>) : 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<Note>) : 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)

View File

@ -75,7 +75,7 @@ fun NotificationScreen(
NostrAccountDataSource.resetFilters()
NotificationFeedFilter.account = account
notifFeedViewModel.clear()
notifFeedViewModel.refresh()
notifFeedViewModel.invalidateData()
}
val lifeCycleOwner = LocalLifecycleOwner.current