damus

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

commit 7c805f7f2395c7f6d31b5cddc60f78d1b0b36e90
parent a2b062017576a3f35c339700b9edf981e33e7d6d
Author: Swift Coder <scoder1747@gmail.com>
Date:   Wed, 23 Oct 2024 13:14:25 -0400

fix: avatar image on qrcode view

Closes: #2612
Changelog-Fixed: Fix avator image on qrcode view
Signed-off-by: Swift Coder <scoder1747@gmail.com>

Diffstat:
Mdamus/Views/QRCodeView.swift | 26++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/damus/Views/QRCodeView.swift b/damus/Views/QRCodeView.swift @@ -120,18 +120,9 @@ struct QRCodeView: View { VStack(alignment: .center) { let profile_txn = damus_state.profiles.lookup(id: pubkey, txn_name: "qrview-profile") let profile = profile_txn?.unsafeUnownedValue - let our_profile = profile_txn.flatMap({ ptxn in - damus_state.ndb.lookup_profile_with_txn(damus_state.pubkey, txn: ptxn)?.profile - }) - if our_profile?.picture != nil { - ProfilePicView(pubkey: pubkey, size: 90.0, highlight: .custom(DamusColors.white, 3.0), profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation) + ProfilePicView(pubkey: pubkey, size: 90.0, highlight: .custom(DamusColors.white, 3.0), profiles: damus_state.profiles, disable_animation: damus_state.settings.disable_animation) .padding(.top, 20) - } else { - Image(systemName: "person.fill") - .font(.system(size: 60)) - .padding(.top, 20) - } if let display_name = profile?.display_name { Text(display_name) @@ -159,10 +150,17 @@ struct QRCodeView: View { Spacer() - Text("Follow me on Nostr", comment: "Text on QR code view to prompt viewer looking at screen to follow the user.") - .font(.system(size: 24, weight: .heavy)) - .padding(.top, 10) - .foregroundColor(.white) + // apply the same styling to both text-views without code duplication + Group { + if damus_state.pubkey.npub == pubkey.npub { + Text("Follow me on Nostr", comment: "Text on QR code view to prompt viewer looking at screen to follow the user.") + } else { + Text("Follow \(profile?.display_name ?? profile?.name ?? "") on Nostr", comment: "Text on QR code view to prompt viewer looking at screen to follow the user.") + } + } + .font(.system(size: 24, weight: .heavy)) + .padding(.top, 10) + .foregroundColor(.white) Text("Scan the code", comment: "Text on QR code view to prompt viewer to scan the QR code on screen with their device camera.") .font(.system(size: 18, weight: .ultraLight))