Add setting to hide reactions

Changelog-Added: Add setting to hide reactions
This commit is contained in:
2023-04-17 03:04:18 +02:00
committed by William Casarin
parent 681e0f0be9
commit 66641fc9ae
14 changed files with 84 additions and 42 deletions

View File

@@ -30,6 +30,7 @@ struct EventActionBar: View {
@State var show_share_action: Bool = false
@ObservedObject var bar: ActionBarModel
@ObservedObject var settings: UserSettingsStore
@Environment(\.colorScheme) var colorScheme
@@ -38,6 +39,7 @@ struct EventActionBar: View {
self.event = event
self.test_lnurl = test_lnurl
_bar = ObservedObject(wrappedValue: bar ?? make_actionbar_model(ev: event.id, damus: damus_state))
_settings = ObservedObject(wrappedValue: damus_state.settings)
}
var lnurl: String? {
@@ -72,22 +74,25 @@ struct EventActionBar: View {
.font(.footnote.weight(.medium))
.foregroundColor(bar.boosted ? Color.green : Color.gray)
}
Spacer()
HStack(spacing: 4) {
LikeButton(liked: bar.liked) {
if bar.liked {
notify(.delete, bar.our_like)
} else {
send_like()
if !settings.hide_reactions {
Spacer()
HStack(spacing: 4) {
LikeButton(liked: bar.liked) {
if bar.liked {
notify(.delete, bar.our_like)
} else {
send_like()
}
}
Text(verbatim: "\(bar.likes > 0 ? "\(bar.likes)" : "")")
.font(.footnote.weight(.medium))
.nip05_colorized(gradient: bar.liked)
}
Text(verbatim: "\(bar.likes > 0 ? "\(bar.likes)" : "")")
.font(.footnote.weight(.medium))
.nip05_colorized(gradient: bar.liked)
}
if let lnurl = self.lnurl {
Spacer()
ZapButton(damus_state: damus_state, event: event, lnurl: lnurl, bar: bar)

View File

@@ -32,7 +32,7 @@ struct EventDetailBar: View {
.buttonStyle(PlainButtonStyle())
}
if bar.likes > 0 {
if bar.likes > 0 && !state.settings.hide_reactions {
NavigationLink(destination: ReactionsView(damus_state: state, model: ReactionsModel(state: state, target: target))) {
let noun = Text(verbatim: "\(reactionsCountString(bar.likes))").foregroundColor(.gray)
Text("\(Text("\(bar.likes)").font(.body.bold())) \(noun)", comment: "Sentence composed of 2 variables to describe how many reactions there are on a post. In source English, the first variable is the number of reactions, and the second variable is 'Reaction' or 'Reactions'.")