damus

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

commit 02d99f734065a17a3271e1a4481cf3cbeb3039d3
parent 8fb5b4f49cee2fa5e7773644d1d4781eade22d5c
Author: William Casarin <jb55@jb55.com>
Date:   Sun, 14 May 2023 00:12:51 -0700

postbox: try flushing events every second

relying on network activity for flushing is not reliable and is causing
delays in zapping

Diffstat:
Mdamus/ContentView.swift | 6++++++
Mdamus/Util/PostBox.swift | 2--
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/damus/ContentView.swift b/damus/ContentView.swift @@ -80,6 +80,9 @@ struct ContentView: View { @Environment(\.colorScheme) var colorScheme + // connect retry timer + let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect() + var mystery: some View { Text("Are you lost?", comment: "Text asking the user if they are lost in the app.") .id("what") @@ -347,6 +350,9 @@ struct ContentView: View { let action = notif.object as! PostAction self.active_sheet = .post(action) } + .onReceive(timer) { n in + self.damus_state?.postbox.try_flushing_events() + } .onReceive(handle_notify(.deleted_account)) { notif in self.is_deleted_account = true } diff --git a/damus/Util/PostBox.swift b/damus/Util/PostBox.swift @@ -93,8 +93,6 @@ class PostBox { } func handle_event(relay_id: String, _ ev: NostrConnectionEvent) { - try_flushing_events() - guard case .nostr_event(let resp) = ev else { return }