commit c5b0e539d8e1fc20c09508cbf4e4a23fd833883a
parent 601fa49a6e44d439ef16bb89b9daa5dd0f9d6738
Author: William Casarin <jb55@jb55.com>
Date: Thu, 22 Jun 2023 09:50:58 +0200
nozaps: don't show note zaps in notifications
apple sucks
Diffstat:
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/damus/Views/Notifications/EventGroupView.swift b/damus/Views/Notifications/EventGroupView.swift
@@ -56,11 +56,16 @@ enum ReactingTo {
case your_profile
}
-func determine_reacting_to(our_pubkey: String, ev: NostrEvent?) -> ReactingTo {
+func determine_reacting_to(our_pubkey: String, ev: NostrEvent?, group: EventGroupType, nozaps: Bool) -> ReactingTo {
guard let ev else {
return .your_profile
}
+ if nozaps && group.is_note_zap {
+ // ZAPPING NOTES IS NOT ALLOWED!!!! EVIL!!!
+ return .your_profile
+ }
+
if ev.pubkey == our_pubkey {
return .your_note
}
@@ -125,13 +130,13 @@ func event_group_author_name(profiles: Profiles, ind: Int, group: EventGroupType
"zapped_your_profile_2" - returned when 2 zaps occurred to the current user's profile
"zapped_your_profile_3" - returned when 3 or more zaps occurred to the current user's profile
*/
-func reacting_to_text(profiles: Profiles, our_pubkey: String, group: EventGroupType, ev: NostrEvent?, locale: Locale? = nil) -> String {
+func reacting_to_text(profiles: Profiles, our_pubkey: String, group: EventGroupType, ev: NostrEvent?, nozaps: Bool, locale: Locale? = nil) -> String {
if group.events.count == 0 {
return "??"
}
let verb = reacting_to_verb(group: group)
- let reacting_to = determine_reacting_to(our_pubkey: our_pubkey, ev: ev)
+ let reacting_to = determine_reacting_to(our_pubkey: our_pubkey, ev: ev, group: group, nozaps: nozaps)
let localization_key = "\(verb)_\(reacting_to)_\(min(group.events.count, 3))"
let format = localizedStringFormat(key: localization_key, locale: locale)
@@ -171,7 +176,7 @@ struct EventGroupView: View {
let group: EventGroupType
var GroupDescription: some View {
- Text(verbatim: "\(reacting_to_text(profiles: state.profiles, our_pubkey: state.pubkey, group: group, ev: event))")
+ Text(verbatim: "\(reacting_to_text(profiles: state.profiles, our_pubkey: state.pubkey, group: group, ev: event, nozaps: state.settings.nozaps))")
}
func ZapIcon(_ zapgrp: ZapGroup) -> some View {
@@ -216,16 +221,18 @@ struct EventGroupView: View {
if let event {
let thread = ThreadModel(event: event, damus_state: state)
let dest = ThreadView(state: state, thread: thread)
- NavigationLink(destination: dest) {
- VStack(alignment: .leading) {
- GroupDescription
- EventBody(damus_state: state, event: event, size: .normal, options: [.truncate_content])
- .padding([.top], 1)
- .padding([.trailing])
- .foregroundColor(.gray)
+ GroupDescription
+ if !state.settings.nozaps || !group.is_note_zap {
+ NavigationLink(destination: dest) {
+ VStack(alignment: .leading) {
+ EventBody(damus_state: state, event: event, size: .normal, options: [.truncate_content])
+ .padding([.top], 1)
+ .padding([.trailing])
+ .foregroundColor(.gray)
+ }
}
+ .buttonStyle(.plain)
}
- .buttonStyle(.plain)
} else {
GroupDescription
}