nozaps: fix zap button in freedom edition

This commit is contained in:
William Casarin
2023-06-28 21:16:56 +02:00
parent 25b3df8b89
commit 62f052daa5

View File

@@ -106,7 +106,7 @@ struct ZapButton: View {
var body: some View { var body: some View {
HStack(spacing: 4) { HStack(spacing: 4) {
if zaps.zap_total > 0 { if !damus_state.settings.nozaps || zaps.zap_total > 0 {
Button(action: { Button(action: {
}, label: { }, label: {
Image(zap_img) Image(zap_img)
@@ -116,7 +116,9 @@ struct ZapButton: View {
.aspectRatio(contentMode: .fit) .aspectRatio(contentMode: .fit)
.frame(width:20, height: 20) .frame(width:20, height: 20)
}) })
}
if zaps.zap_total > 0 {
Text(verbatim: format_msats_abbrev(zaps.zap_total)) Text(verbatim: format_msats_abbrev(zaps.zap_total))
.font(.footnote) .font(.footnote)
.foregroundColor(zap_color) .foregroundColor(zap_color)
@@ -124,21 +126,14 @@ struct ZapButton: View {
} }
.accessibilityLabel(NSLocalizedString("Zap", comment: "Accessibility label for zap button")) .accessibilityLabel(NSLocalizedString("Zap", comment: "Accessibility label for zap button"))
.simultaneousGesture(LongPressGesture().onEnded {_ in .simultaneousGesture(LongPressGesture().onEnded {_ in
// when we don't have nozaps mode enable, long press shows the zap customizer guard !damus_state.settings.nozaps else { return }
if !damus_state.settings.nozaps {
//present_sheet(.zap(target: target, lnurl: lnurl))
}
// long press does nothing in nozaps mode present_sheet(.zap(target: target, lnurl: lnurl))
}) })
.highPriorityGesture(TapGesture().onEnded { .highPriorityGesture(TapGesture().onEnded {
// when we have appstore mode on, only show the zap customizer as "user zaps" guard !damus_state.settings.nozaps else { return }
if damus_state.settings.nozaps {
//present_sheet(.zap(target: target, lnurl: lnurl)) tap()
} else {
// otherwise we restore the original behavior of one-tap zaps
tap()
}
}) })
} }
} }