damus

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

commit 98f0b2f2d2123a96b1c027311847fcd5bebfe726
parent 9a4d93824a9dfb3c59c436d3df2ba2fda07e45c3
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 24 Mar 2023 08:14:32 -0600

Don't make previews full bleed

Diffstat:
Mdamus/Views/NoteContentView.swift | 48++++++++++++++++++++++++++++++++++--------------
1 file changed, 34 insertions(+), 14 deletions(-)

diff --git a/damus/Views/NoteContentView.swift b/damus/Views/NoteContentView.swift @@ -58,8 +58,28 @@ struct NoteContentView: View { .font(eventviewsize_to_font(size)) } - func MainContent() -> some View { - return VStack(alignment: .leading) { + var invoicesView: some View { + InvoicesView(our_pubkey: damus_state.keypair.pubkey, invoices: artifacts.invoices) + } + + var previewView: some View { + Group { + if let preview = self.preview, show_images { + if let preview_height { + preview + .frame(height: preview_height) + } else { + preview + } + } else if let link = artifacts.links.first { + LinkViewRepresentable(meta: .url(link)) + .frame(height: 50) + } + } + } + + var MainContent: some View { + VStack(alignment: .leading) { if size == .selected { SelectableText(attributedString: artifacts.content) TranslateView(damus_state: damus_state, event: event) @@ -84,25 +104,25 @@ struct NoteContentView: View { } if artifacts.invoices.count > 0 { - InvoicesView(our_pubkey: damus_state.keypair.pubkey, invoices: artifacts.invoices) - } - - if let preview = self.preview, show_images { - if let preview_height { - preview - .frame(height: preview_height) + if with_padding { + invoicesView + .padding(.horizontal) } else { - preview + invoicesView } - } else if let link = artifacts.links.first { - LinkViewRepresentable(meta: .url(link)) - .frame(height: 50) } + + if with_padding { + previewView.padding(.horizontal) + } else { + previewView + } + } } var body: some View { - MainContent() + MainContent .onReceive(handle_notify(.profile_updated)) { notif in let profile = notif.object as! ProfileUpdate let blocks = event.blocks(damus_state.keypair.privkey)