Updates observers when deleting notes

pull/167/head
Vitor Pamplona 2023-02-24 17:39:14 -05:00
rodzic 3ebcfa111c
commit 5e066e2485
1 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -106,19 +106,24 @@ class Note(val idHex: String) {
fun removeReply(note: Note) { fun removeReply(note: Note) {
replies = replies - note replies = replies - note
liveSet?.replies?.invalidateData()
} }
fun removeBoost(note: Note) { fun removeBoost(note: Note) {
boosts = boosts - note boosts = boosts - note
liveSet?.boosts?.invalidateData()
} }
fun removeReaction(note: Note) { fun removeReaction(note: Note) {
reactions = reactions - note reactions = reactions - note
liveSet?.reactions?.invalidateData()
} }
fun removeZap(note: Note) { fun removeZap(note: Note) {
if (zaps[note] != null) { if (zaps[note] != null) {
zaps = zaps.minus(note) zaps = zaps.minus(note)
liveSet?.zaps?.invalidateData()
} else if (zaps.containsValue(note)) { } else if (zaps.containsValue(note)) {
val toRemove = zaps.filterValues { it == note } val toRemove = zaps.filterValues { it == note }
zaps = zaps.minus(toRemove.keys) zaps = zaps.minus(toRemove.keys)
liveSet?.zaps?.invalidateData()
} }
} }