damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | LICENSE

commit 045aaaf59b52736a54e535b99ee4244e46dc343a
parent cfcd4128ec0359ee16453f33ad9ba73c37104442
Author: William Casarin <jb55@jb55.com>
Date:   Sun,  8 May 2022 11:09:04 -0700

trigger resub on clicked events

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
M.gitignore | 1+
Mdamus/Models/ThreadModel.swift | 17++++++++++++++++-
Mdamus/Views/EventDetailView.swift | 2+-
3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,3 +1,4 @@ xcuserdata Preview\ Content damus/TestingPrivate.swift +.DS_Store diff --git a/damus/Models/ThreadModel.swift b/damus/Models/ThreadModel.swift @@ -11,6 +11,13 @@ enum InitialEvent { case event(NostrEvent) case event_id(String) + var is_event_id: String? { + if case .event_id(let evid) = self { + return evid + } + return nil + } + var id: String { switch self { case .event(let ev): @@ -136,13 +143,21 @@ class ThreadModel: ObservableObject { self.events.append(ev) self.events = self.events.sorted { $0.created_at < $1.created_at } - objectWillChange.send() + //objectWillChange.send() var i: Int = 0 for ev in events { self.event_map[ev.id] = i i += 1 } + + if let evid = self.initial_event.is_event_id { + if ev.id == evid { + // this should trigger a resubscribe... + set_active_event(ev) + } + } + } func handle_event(relay_id: String, ev: NostrConnectionEvent) { diff --git a/damus/Views/EventDetailView.swift b/damus/Views/EventDetailView.swift @@ -61,7 +61,7 @@ struct EventDetailView: View { Group { switch cev { case .collapsed(let c): - Text("··· \(c.count) other replies ···") + Text("··· \(c.count) other notes ···") .font(.footnote) .foregroundColor(.gray) .onTapGesture {