From 62f052daa5c9441b8933d95e38568e0094fb46b3 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Wed, 28 Jun 2023 21:16:56 +0200 Subject: [PATCH] nozaps: fix zap button in freedom edition --- damus/Components/ZapButton.swift | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/damus/Components/ZapButton.swift b/damus/Components/ZapButton.swift index 43284455..dfe232d2 100644 --- a/damus/Components/ZapButton.swift +++ b/damus/Components/ZapButton.swift @@ -106,7 +106,7 @@ struct ZapButton: View { var body: some View { HStack(spacing: 4) { - if zaps.zap_total > 0 { + if !damus_state.settings.nozaps || zaps.zap_total > 0 { Button(action: { }, label: { Image(zap_img) @@ -116,7 +116,9 @@ struct ZapButton: View { .aspectRatio(contentMode: .fit) .frame(width:20, height: 20) }) + } + if zaps.zap_total > 0 { Text(verbatim: format_msats_abbrev(zaps.zap_total)) .font(.footnote) .foregroundColor(zap_color) @@ -124,21 +126,14 @@ struct ZapButton: View { } .accessibilityLabel(NSLocalizedString("Zap", comment: "Accessibility label for zap button")) .simultaneousGesture(LongPressGesture().onEnded {_ in - // when we don't have nozaps mode enable, long press shows the zap customizer - if !damus_state.settings.nozaps { - //present_sheet(.zap(target: target, lnurl: lnurl)) - } + guard !damus_state.settings.nozaps else { return } - // long press does nothing in nozaps mode + present_sheet(.zap(target: target, lnurl: lnurl)) }) .highPriorityGesture(TapGesture().onEnded { - // when we have appstore mode on, only show the zap customizer as "user zaps" - if damus_state.settings.nozaps { - //present_sheet(.zap(target: target, lnurl: lnurl)) - } else { - // otherwise we restore the original behavior of one-tap zaps - tap() - } + guard !damus_state.settings.nozaps else { return } + + tap() }) } }