commit 24c4d99f7878bcfbbaf567fc377371829535c9ca
parent f2338dd646022e9f9addc0a0ac0f1de80b125241
Author: William Casarin <jb55@jb55.com>
Date: Thu, 21 Jul 2022 15:51:44 -0700
DMs: copy decrypted text instead of raw content
Changelog-Fixed: Copying text in DMs will now copy the decrypted text
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/damus/Views/ChatroomView.swift b/damus/Views/ChatroomView.swift
@@ -23,7 +23,7 @@ struct ChatroomView: View {
next_ev: ind == count-1 ? nil : thread.events[ind+1],
damus_state: damus
)
- .event_context_menu(ev)
+ .event_context_menu(ev, 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)
+ .event_context_menu(ev, privkey: damus_state.keypair.privkey)
}
Color.white.opacity(0)
.id("endblock")
diff --git a/damus/Views/EventView.swift b/damus/Views/EventView.swift
@@ -143,15 +143,15 @@ struct EventView: View {
.id(event.id)
.frame(minHeight: PFP_SIZE)
.padding([.bottom], 4)
- .event_context_menu(event)
+ .event_context_menu(event, privkey: damus.keypair.privkey)
}
}
extension View {
- func event_context_menu(_ event: NostrEvent) -> some View {
+ func event_context_menu(_ event: NostrEvent, privkey: String?) -> some View {
return self.contextMenu {
Button {
- UIPasteboard.general.string = event.content
+ UIPasteboard.general.string = event.get_content(privkey)
} label: {
Label("Copy Text", systemImage: "doc.on.doc")
}