nozaps: switch to global sheet when zapping

This fixes many popping bugs

Changelog-Fixed: Fix zap sheet popping
This commit is contained in:
William Casarin
2023-06-23 11:50:55 +02:00
parent 61b3ad2990
commit f090596067
11 changed files with 80 additions and 87 deletions

View File

@@ -96,7 +96,6 @@ struct ProfileView: View {
static let markdown = Markdown()
@State var showing_select_wallet: Bool = false
@State var is_zoomed: Bool = false
@State var show_share_sheet: Bool = false
@State var show_qr_code: Bool = false
@@ -245,7 +244,7 @@ struct ProfileView: View {
func lnButton(lnurl: String, profile: Profile) -> some View {
let button_img = profile.reactions == false ? "zap.fill" : "zap"
return Button(action: {
zap_button_model.showing_zap_customizer = true
present_sheet(.zap(target: .profile(self.profile.pubkey), lnurl: lnurl))
}) {
Image(button_img)
.foregroundColor(button_img == "zap.fill" ? .orange : Color.primary)
@@ -272,38 +271,6 @@ struct ProfileView: View {
}
.cornerRadius(24)
.sheet(isPresented: $zap_button_model.showing_zap_customizer) {
CustomizeZapView(state: damus_state, target: ZapTarget.profile(self.profile.pubkey), lnurl: lnurl)
}
.sheet(isPresented: $zap_button_model.showing_select_wallet, onDismiss: {zap_button_model.showing_select_wallet = false}) {
SelectWalletView(default_wallet: damus_state.settings.default_wallet, showingSelectWallet: $zap_button_model.showing_select_wallet, our_pubkey: damus_state.pubkey, invoice: zap_button_model.invoice ?? "")
}
.onReceive(handle_notify(.zapping)) { notif in
let zap_ev = notif.object as! ZappingEvent
guard zap_ev.target.id == self.profile.pubkey else {
return
}
guard !zap_ev.is_custom else {
return
}
switch zap_ev.type {
case .failed:
break
case .got_zap_invoice(let inv):
if damus_state.settings.show_wallet_selector {
zap_button_model.invoice = inv
zap_button_model.showing_select_wallet = true
} else {
let wallet = damus_state.settings.default_wallet.model
open_with_wallet(wallet: wallet, invoice: inv)
}
case .sent_from_nwc:
break
}
}
}
var dmButton: some View {