fix: avatar image on qrcode view
Closes: #2612 Changelog-Fixed: Fix avator image on qrcode view Signed-off-by: Swift Coder <scoder1747@gmail.com>
This commit is contained in:
committed by
William Casarin
parent
a2b0620175
commit
7c805f7f23
@@ -120,18 +120,9 @@ struct QRCodeView: View {
|
|||||||
VStack(alignment: .center) {
|
VStack(alignment: .center) {
|
||||||
let profile_txn = damus_state.profiles.lookup(id: pubkey, txn_name: "qrview-profile")
|
let profile_txn = damus_state.profiles.lookup(id: pubkey, txn_name: "qrview-profile")
|
||||||
let profile = profile_txn?.unsafeUnownedValue
|
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)
|
.padding(.top, 20)
|
||||||
} else {
|
|
||||||
Image(systemName: "person.fill")
|
|
||||||
.font(.system(size: 60))
|
|
||||||
.padding(.top, 20)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let display_name = profile?.display_name {
|
if let display_name = profile?.display_name {
|
||||||
Text(display_name)
|
Text(display_name)
|
||||||
@@ -159,10 +150,17 @@ struct QRCodeView: View {
|
|||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Text("Follow me on Nostr", comment: "Text on QR code view to prompt viewer looking at screen to follow the user.")
|
// apply the same styling to both text-views without code duplication
|
||||||
.font(.system(size: 24, weight: .heavy))
|
Group {
|
||||||
.padding(.top, 10)
|
if damus_state.pubkey.npub == pubkey.npub {
|
||||||
.foregroundColor(.white)
|
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.")
|
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))
|
.font(.system(size: 18, weight: .ultraLight))
|
||||||
|
|||||||
Reference in New Issue
Block a user