Ensure stats get updated in realtime on action bars

Changelog-Fixed: Ensure stats get updated in realtime on action bars
This commit is contained in:
William Casarin
2023-02-14 10:05:59 -08:00
parent 6d634763c5
commit 59211bb4fd
5 changed files with 13 additions and 21 deletions

View File

@@ -111,15 +111,10 @@ struct EventActionBar: View {
} message: {
Text("Are you sure you want to repost this?", comment: "Alert message to ask if user wants to repost a post.")
}
.onReceive(handle_notify(.new_zap)) { n in
let zap = n.object as! Zap
guard case .note(let note_target) = zap.target else {
return
}
guard note_target.note_id == self.event.id else {
return
}
self.bar.update(damus: self.damus_state, evid: self.event.id)
.onReceive(handle_notify(.update_stats)) { n in
let target = n.object as! String
guard target == self.event.id else { return }
self.bar.update(damus: self.damus_state, evid: target)
}
.onReceive(handle_notify(.liked)) { n in
let liked = n.object as! Counted