nozaps: restore zap button with zap info, just make it not clickable

This commit is contained in:
William Casarin
2023-06-27 06:04:36 +02:00
parent 1a0282fe21
commit 3e274a820a
2 changed files with 13 additions and 21 deletions

View File

@@ -38,10 +38,6 @@ struct ZapButton: View {
}
var zap_img: String {
if damus_state.settings.nozaps {
return "zap"
}
switch our_zap {
case .none:
return "zap"
@@ -53,10 +49,6 @@ struct ZapButton: View {
}
var zap_color: Color {
if damus_state.settings.nozaps {
return Color.gray
}
if our_zap == nil {
return Color.gray
}
@@ -114,17 +106,17 @@ struct ZapButton: View {
var body: some View {
HStack(spacing: 4) {
Button(action: {
}, label: {
Image(zap_img)
.resizable()
.foregroundColor(zap_color)
.font(.footnote.weight(.medium))
.aspectRatio(contentMode: .fit)
.frame(width:20, height: 20)
})
if zaps.zap_total > 0 {
Button(action: {
}, label: {
Image(zap_img)
.resizable()
.foregroundColor(zap_color)
.font(.footnote.weight(.medium))
.aspectRatio(contentMode: .fit)
.frame(width:20, height: 20)
})
Text(verbatim: format_msats_abbrev(zaps.zap_total))
.font(.footnote)
.foregroundColor(zap_color)
@@ -134,7 +126,7 @@ struct ZapButton: View {
.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))
//present_sheet(.zap(target: target, lnurl: lnurl))
}
// long press does nothing in nozaps mode
@@ -142,7 +134,7 @@ struct ZapButton: View {
.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))
//present_sheet(.zap(target: target, lnurl: lnurl))
} else {
// otherwise we restore the original behavior of one-tap zaps
tap()

View File

@@ -86,7 +86,7 @@ struct EventActionBar: View {
}
}
if !damus_state.settings.nozaps, let lnurl = self.lnurl {
if let lnurl = self.lnurl {
Spacer()
ZapButton(damus_state: damus_state, target: ZapTarget.note(id: event.id, author: event.pubkey), lnurl: lnurl, zaps: self.damus_state.events.get_cache_data(self.event.id).zaps_model)
}