damus

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

commit d2374aa6ec017096e387129fc37a88431451682f
parent 495859e07f605846a2e2fef79c0476984489e904
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 11 Jul 2023 12:28:06 -0700

I broked dms. i fixed.

Diffstat:
Mdamus/Views/Events/Components/EventTop.swift | 10++++++----
Mdamus/Views/Events/EventShell.swift | 16+++++++++++++---
Mdamus/Views/Events/TextEvent.swift | 2+-
3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/damus/Views/Events/Components/EventTop.swift b/damus/Views/Events/Components/EventTop.swift @@ -10,17 +10,19 @@ import SwiftUI struct EventTop: View { let state: DamusState let event: NostrEvent + let pubkey: String let is_anon: Bool - init(state: DamusState, event: NostrEvent, is_anon: Bool) { + init(state: DamusState, event: NostrEvent, pubkey: String, is_anon: Bool) { self.state = state self.event = event + self.pubkey = pubkey self.is_anon = is_anon } func ProfileName(is_anon: Bool) -> some View { - let profile = state.profiles.lookup(id: event.pubkey) - let pk = is_anon ? "anon" : event.pubkey + let profile = state.profiles.lookup(id: self.pubkey) + let pk = is_anon ? "anon" : self.pubkey return EventProfileName(pubkey: pk, profile: profile, damus: state, size: .normal) } @@ -39,6 +41,6 @@ struct EventTop: View { struct EventTop_Previews: PreviewProvider { static var previews: some View { - EventTop(state: test_damus_state(), event: test_event, is_anon: false) + EventTop(state: test_damus_state(), event: test_event, pubkey: test_event.pubkey, is_anon: false) } } diff --git a/damus/Views/Events/EventShell.swift b/damus/Views/Events/EventShell.swift @@ -10,13 +10,23 @@ import SwiftUI struct EventShell<Content: View>: View { let state: DamusState let event: NostrEvent + let pubkey: String let options: EventViewOptions let content: Content + init(state: DamusState, event: NostrEvent, pubkey: String, options: EventViewOptions, @ViewBuilder content: () -> Content) { + self.state = state + self.event = event + self.options = options + self.pubkey = pubkey + self.content = content() + } + init(state: DamusState, event: NostrEvent, options: EventViewOptions, @ViewBuilder content: () -> Content) { self.state = state self.event = event self.options = options + self.pubkey = event.pubkey self.content = content() } @@ -42,7 +52,7 @@ struct EventShell<Content: View>: View { } func Pfp(is_anon: Bool) -> some View { - return MaybeAnonPfpView(state: state, is_anon: is_anon, pubkey: event.pubkey, size: options.contains(.small_pfp) ? eventview_pfp_size(.small) : PFP_SIZE ) + return MaybeAnonPfpView(state: state, is_anon: is_anon, pubkey: pubkey, size: options.contains(.small_pfp) ? eventview_pfp_size(.small) : PFP_SIZE ) } var Threaded: some View { @@ -56,7 +66,7 @@ struct EventShell<Content: View>: View { } VStack(alignment: .leading) { - EventTop(state: state, event: event, is_anon: is_anon) + EventTop(state: state, event: event, pubkey: pubkey, is_anon: is_anon) if !options.contains(.no_replying_to) { ReplyPart(event: event, privkey: state.keypair.privkey, profiles: state.profiles) @@ -84,7 +94,7 @@ struct EventShell<Content: View>: View { Pfp(is_anon: is_anon) VStack { - EventTop(state: state, event: event, is_anon: is_anon) + EventTop(state: state, event: event, pubkey: pubkey, is_anon: is_anon) ReplyPart(event: event, privkey: state.keypair.privkey, profiles: state.profiles) } } diff --git a/damus/Views/Events/TextEvent.swift b/damus/Views/Events/TextEvent.swift @@ -39,7 +39,7 @@ struct TextEvent: View { } var body: some View { - EventShell(state: damus, event: event, options: options) { + EventShell(state: damus, event: event, pubkey: pubkey, options: options) { EvBody(options: options) } }