Improves draft deletes in the feeds

This commit is contained in:
Vitor Pamplona
2025-08-27 08:00:08 -04:00
parent 568a175735
commit 108d8a2e57
4 changed files with 34 additions and 0 deletions
@@ -105,6 +105,8 @@ class ChannelFeedContentState(
}
}
fun deleteFromFeed(deletedNotes: Set<Note>) {}
fun refreshFromOldState(newItems: Set<Note>) {
val oldNotesState = _feedContent.value
if (oldNotesState is ChannelFeedState.Loaded) {
@@ -104,6 +104,34 @@ class AccountFeedContentStates(
drafts.updateFeedWith(newNotes)
}
fun deleteNotes(newNotes: Set<Note>) {
checkNotInMainThread()
homeLive.deleteFromFeed(newNotes)
homeNewThreads.deleteFromFeed(newNotes)
homeReplies.deleteFromFeed(newNotes)
dmKnown.updateFeedWith(newNotes)
dmNew.updateFeedWith(newNotes)
videoFeed.deleteFromFeed(newNotes)
discoverMarketplace.deleteFromFeed(newNotes)
discoverFollowSets.deleteFromFeed(newNotes)
discoverReads.deleteFromFeed(newNotes)
discoverDVMs.deleteFromFeed(newNotes)
discoverLive.deleteFromFeed(newNotes)
discoverCommunities.deleteFromFeed(newNotes)
discoverPublicChats.deleteFromFeed(newNotes)
notifications.deleteFromFeed(newNotes)
notificationSummary.invalidateInsertData(newNotes)
feedListOptions.deleteFromFeed(newNotes)
drafts.deleteFromFeed(newNotes)
}
fun destroy() {
notifications.destroy()
notificationSummary.destroy()
@@ -1193,6 +1193,7 @@ class AccountViewModel(
}
logTime("AccountViewModel deletedEventBundle Update with ${newNotes.size} new notes") {
newNotesPreProcessor.runDeleted(newNotes)
feedStates.deleteNotes(newNotes)
}
}
}
@@ -340,6 +340,9 @@ class CardFeedContentState(
}
}
fun deleteFromFeed(deletedNotes: Set<Note>) {
}
private fun refreshFromOldState(newItems: Set<Note>) {
val oldNotesState = _feedContent.value