commit 13516dbc0a7188f725fbd9259b00ed04af83daa0
parent 1a28f8ca94b2c7069d0f2bc555ef98bc8aa50cc9
Author: William Casarin <jb55@jb55.com>
Date: Wed, 28 Dec 2022 14:40:32 -0800
Show images from yourself
Changelog-Fixed: Show images from yourself
Diffstat:
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/damus/Views/ChatView.swift b/damus/Views/ChatView.swift
@@ -106,7 +106,7 @@ struct ChatView: View {
}
}
- NoteContentView(privkey: damus_state.keypair.privkey, event: event, profiles: damus_state.profiles, show_images: should_show_images(contacts: damus_state.contacts, ev: event), artifacts: .just_content(event.content), size: .normal)
+ NoteContentView(privkey: damus_state.keypair.privkey, event: event, profiles: damus_state.profiles, show_images: should_show_images(contacts: damus_state.contacts, ev: event, our_pubkey: damus_state.pubkey), artifacts: .just_content(event.content), size: .normal)
if is_active || next_ev == nil || next_ev!.pubkey != event.pubkey {
let bar = make_actionbar_model(ev: event, damus: damus_state)
diff --git a/damus/Views/DMView.swift b/damus/Views/DMView.swift
@@ -21,7 +21,9 @@ struct DMView: View {
Spacer()
}
- NoteContentView(privkey: damus_state.keypair.privkey, event: event, profiles: damus_state.profiles, show_images: should_show_images(contacts: damus_state.contacts, ev: event), artifacts: .just_content(event.get_content(damus_state.keypair.privkey)), size: .normal)
+ let should_show_img = should_show_images(contacts: damus_state.contacts, ev: event, our_pubkey: damus_state.pubkey)
+
+ NoteContentView(privkey: damus_state.keypair.privkey, event: event, profiles: damus_state.profiles, show_images: should_show_img, artifacts: .just_content(event.get_content(damus_state.keypair.privkey)), size: .normal)
.foregroundColor(is_ours ? Color.white : Color.primary)
.padding(10)
.background(is_ours ? Color.accentColor : Color.secondary.opacity(0.15))
diff --git a/damus/Views/EventView.swift b/damus/Views/EventView.swift
@@ -247,7 +247,9 @@ struct EventView: View {
.frame(maxWidth: .infinity, alignment: .leading)
}
- NoteContentView(privkey: damus.keypair.privkey, event: event, profiles: damus.profiles, show_images: should_show_images(contacts: damus.contacts, ev: event), artifacts: .just_content(content), size: self.size)
+ let should_show_img = should_show_images(contacts: damus.contacts, ev: event, our_pubkey: damus.pubkey)
+
+ NoteContentView(privkey: damus.keypair.privkey, event: event, profiles: damus.profiles, show_images: should_show_img, artifacts: .just_content(content), size: self.size)
.frame(maxWidth: .infinity, alignment: .leading)
.allowsHitTesting(!embedded)
@@ -309,7 +311,10 @@ struct EventView: View {
}
// blame the porn bots for this code
-func should_show_images(contacts: Contacts, ev: NostrEvent) -> Bool {
+func should_show_images(contacts: Contacts, ev: NostrEvent, our_pubkey: String) -> Bool {
+ if ev.pubkey == our_pubkey {
+ return true
+ }
if contacts.is_in_friendosphere(ev.pubkey) {
return true
}
diff --git a/damus/Views/SelectWalletView.swift b/damus/Views/SelectWalletView.swift
@@ -57,6 +57,7 @@ struct SelectWalletView: View {
ForEach(walletItems, id: \.self) { wallet in
Button() {
if let url = URL(string: "\(wallet.link)\(invoice)"), UIApplication.shared.canOpenURL(url) {
+ print("opening wallet url \(url)")
openURL(url)
} else {
if let url = URL(string: wallet.appStoreLink), UIApplication.shared.canOpenURL(url) {