Show other people's zaps
Changelog-Fixed: Fix a bug where zaps on other people's posts weren't showing
This commit is contained in:
@@ -28,13 +28,14 @@ struct EventActionBar: View {
|
||||
@State var sheet: ActionBarSheet? = nil
|
||||
@State var confirm_boost: Bool = false
|
||||
@State var show_share_sheet: Bool = false
|
||||
@StateObject var bar: ActionBarModel
|
||||
|
||||
init(damus_state: DamusState, event: NostrEvent, bar: ActionBarModel, test_lnurl: String? = nil) {
|
||||
@ObservedObject var bar: ActionBarModel
|
||||
|
||||
init(damus_state: DamusState, event: NostrEvent, bar: ActionBarModel? = nil, test_lnurl: String? = nil) {
|
||||
self.damus_state = damus_state
|
||||
self.event = event
|
||||
self.test_lnurl = test_lnurl
|
||||
_bar = StateObject.init(wrappedValue: bar)
|
||||
_bar = ObservedObject(wrappedValue: bar ?? make_actionbar_model(ev: event.id, damus: damus_state))
|
||||
}
|
||||
|
||||
var lnurl: String? {
|
||||
@@ -110,6 +111,16 @@ 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(.liked)) { n in
|
||||
let liked = n.object as! Counted
|
||||
if liked.id != event.id {
|
||||
|
||||
Reference in New Issue
Block a user