damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit f5d140103207e8ac5bccf4933a394be513417a2b
parent 719cec449cab9df8cb9110025a2559f4800a2d43
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 25 Jan 2024 12:09:56 -0800

Revert "mute: adding ability to mute hashtag from SearchView"

This reverts commit ace8a7081b7da0de4d032a9272e9c876cac33877.

Diffstat:
Mdamus/Views/SearchView.swift | 64+---------------------------------------------------------------
1 file changed, 1 insertion(+), 63 deletions(-)

diff --git a/damus/Views/SearchView.swift b/damus/Views/SearchView.swift @@ -11,8 +11,7 @@ struct SearchView: View { let appstate: DamusState @ObservedObject var search: SearchModel @Environment(\.dismiss) var dismiss - @State var is_hashtag_muted: Bool = false - + var content_filter: (NostrEvent) -> Bool { let filters = ContentFilters.defaults(damus_state: self.appstate) return ContentFilters(filters: filters).filter @@ -42,70 +41,9 @@ struct SearchView: View { } .onReceive(handle_notify(.new_mutes)) { notif in search.filter_muted() - - if let hashtag_string = search.search.hashtag?.first, - notif.contains(MuteItem.hashtag(Hashtag(hashtag: hashtag_string), nil)) { - is_hashtag_muted = true - } - } - .onReceive(handle_notify(.new_unmutes)) { unmutes in - if let hashtag_string = search.search.hashtag?.first, - unmutes.contains(MuteItem.hashtag(Hashtag(hashtag: hashtag_string), nil)) { - is_hashtag_muted = false - } - } - .toolbar { - if let hashtag = search.search.hashtag?.first { - ToolbarItem(placement: .topBarTrailing) { - Menu { - if is_hashtag_muted { - Button { - guard - let full_keypair = appstate.keypair.to_full(), - let existing_mutelist = appstate.contacts.mutelist, - let mutelist = remove_from_mutelist(keypair: full_keypair, prev: existing_mutelist, to_remove: .hashtag(Hashtag(hashtag: hashtag), nil)) - else { - return - } - - appstate.contacts.set_mutelist(mutelist) - appstate.postbox.send(mutelist) - } label: { - Text("Unmute Hashtag", comment: "Label represnting a button that the user can tap to unmute a given hashtag so they start seeing it in their feed again.") - } - } else { - MuteDurationMenu { duration in - mute_hashtag(hashtag_string: hashtag, expiration_time: duration?.date_from_now) - } label: { - Text("Mute Hashtag", comment: "Label represnting a button that the user can tap to mute a given hashtag so they don't see it in their feed anymore.") - } - } - } label: { - Image(systemName: "ellipsis") - } - } - } - } - .onAppear { - if let hashtag_string = search.search.hashtag?.first { - is_hashtag_muted = (appstate.contacts.mutelist?.mute_list ?? []).contains(MuteItem.hashtag(Hashtag(hashtag: hashtag_string), nil)) - } } } - func mute_hashtag(hashtag_string: String, expiration_time: Date?) { - guard - let full_keypair = appstate.keypair.to_full(), - let existing_mutelist = appstate.contacts.mutelist, - let mutelist = create_or_update_mutelist(keypair: full_keypair, mprev: existing_mutelist, to_add: .hashtag(Hashtag(hashtag: hashtag_string), expiration_time)) - else { - return - } - - appstate.contacts.set_mutelist(mutelist) - appstate.postbox.send(mutelist) - } - var described_search: DescribedSearch { return describe_search(search.search) }