damus

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

commit c10fcc52e3bd87577dc39d75c1ced98d63055551
parent 08dd2d5414b895dd8713f4b4f928a0cc3a674827
Author: William Casarin <jb55@jb55.com>
Date:   Sat,  7 Jan 2023 11:29:24 -0800

dms: always use the other persons pubkey in context menu

The DM view can sometimes show our last message, which means the pubkey
in the context menu would be ours. This is super confusing, so always
use the other persons pubkey when copying the user id in the DMs view.

Changlog-Fixed: Always copy other persons pubkey in DMs context menus

Diffstat:
Mdamus/Views/ChatroomView.swift | 2+-
Mdamus/Views/DMChatView.swift | 2+-
Mdamus/Views/EventView.swift | 6+++---
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/damus/Views/ChatroomView.swift b/damus/Views/ChatroomView.swift @@ -24,7 +24,7 @@ struct ChatroomView: View { next_ev: ind == count-1 ? nil : thread.events[ind+1], damus_state: damus ) - .event_context_menu(ev, privkey: damus.keypair.privkey) + .event_context_menu(ev, pubkey: ev.pubkey, privkey: damus.keypair.privkey) .onTapGesture { if thread.initial_event.id == ev.id { //dismiss() diff --git a/damus/Views/DMChatView.swift b/damus/Views/DMChatView.swift @@ -19,7 +19,7 @@ struct DMChatView: View { VStack(alignment: .leading) { ForEach(Array(zip(dms.events, dms.events.indices)), id: \.0.id) { (ev, ind) in DMView(event: dms.events[ind], damus_state: damus_state) - .event_context_menu(ev, privkey: damus_state.keypair.privkey) + .event_context_menu(ev, pubkey: ev.pubkey, privkey: damus_state.keypair.privkey) } EndBlock(height: 80) } diff --git a/damus/Views/EventView.swift b/damus/Views/EventView.swift @@ -274,7 +274,7 @@ struct EventView: View { .id(event.id) .frame(maxWidth: .infinity, minHeight: PFP_SIZE) .padding([.bottom], 2) - .event_context_menu(event, privkey: damus.keypair.privkey) + .event_context_menu(event, pubkey: pubkey, privkey: damus.keypair.privkey) } } @@ -313,7 +313,7 @@ extension View { } } - func event_context_menu(_ event: NostrEvent, privkey: String?) -> some View { + func event_context_menu(_ event: NostrEvent, pubkey: String, privkey: String?) -> some View { return self.contextMenu { Button { UIPasteboard.general.string = event.get_content(privkey) @@ -322,7 +322,7 @@ extension View { } Button { - UIPasteboard.general.string = bech32_pubkey(event.pubkey) ?? event.pubkey + UIPasteboard.general.string = bech32_pubkey(pubkey) ?? pubkey } label: { Label("Copy User ID", systemImage: "tag") }