commit bad6ba36432fc78c9e7642a91af69e04745eab91
parent 5c131e62d7be8d4f3f8358c3042343fe1acef1f1
Author: William Casarin <jb55@jb55.com>
Date: Fri, 14 Apr 2023 09:22:50 -0700
qrcode: don't default pubkey to ""
Diffstat:
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/damus/Views/QRCodeView.swift b/damus/Views/QRCodeView.swift
@@ -10,7 +10,7 @@ import CoreImage.CIFilterBuiltins
struct QRCodeView: View {
let damus_state: DamusState
- @State var pubkey: String = ""
+ @State var pubkey: String
@Environment(\.dismiss) var dismiss
@Environment(\.presentationMode) var presentationMode
@@ -94,11 +94,6 @@ struct QRCodeView: View {
}
}
- .onAppear() {
- if pubkey.isEmpty {
- pubkey = damus_state.pubkey
- }
- }
.modifier(SwipeToDismissModifier(minDistance: nil, onDismiss: {
presentationMode.wrappedValue.dismiss()
}))
@@ -126,6 +121,6 @@ struct QRCodeView: View {
struct QRCodeView_Previews: PreviewProvider {
static var previews: some View {
- QRCodeView(damus_state: test_damus_state())
+ QRCodeView(damus_state: test_damus_state(), pubkey: test_event.pubkey)
}
}
diff --git a/damus/Views/SideMenuView.swift b/damus/Views/SideMenuView.swift
@@ -142,7 +142,7 @@ struct SideMenuView: View {
.font(.title)
.foregroundColor(textColor())
}).fullScreenCover(isPresented: $showQRCode) {
- QRCodeView(damus_state: damus_state)
+ QRCodeView(damus_state: damus_state, pubkey: damus_state.pubkey)
}
}
.padding(.top, verticalSpacing)