damus

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

commit 35ae69740aa96a7d6dba3f21f66c4ab44f65ff35
parent 43cc3b6b6bb9ac5eb13359af1a5532cef86ef862
Author: Fredrik Olofsson <const_cast@tutanota.com>
Date:   Tue, 10 Jan 2023 01:15:04 +0100

Get event after Add button is pressed to make sure it is up to date.

Closes: #296
Changelog-Fixed: Fixed issue with relays not keeping in sync when adding

Diffstat:
Mdamus/Views/RecommendedRelayView.swift | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/damus/Views/RecommendedRelayView.swift b/damus/Views/RecommendedRelayView.swift @@ -28,14 +28,17 @@ struct RecommendedRelayView: View { HStack { Text(relay) Spacer() - if let ev = damus.contacts.event, add_button { + if add_button { if let privkey = damus.keypair.privkey { Button(NSLocalizedString("Add", comment: "Button to add recommended relay server.")) { - guard let ev = add_relay(ev: ev, privkey: privkey, current_relays: damus.pool.descriptors, relay: relay, info: .rw) else { + guard let ev_before_add = damus.contacts.event else { return } - process_contact_event(pool: damus.pool, contacts: damus.contacts, pubkey: damus.pubkey, ev: ev) - damus.pool.send(.event(ev)) + guard let ev_after_add = add_relay(ev: ev_before_add, privkey: privkey, current_relays: damus.pool.descriptors, relay: relay, info: .rw) else { + return + } + process_contact_event(pool: damus.pool, contacts: damus.contacts, pubkey: damus.pubkey, ev: ev_after_add) + damus.pool.send(.event(ev_after_add)) } } }