damus

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

commit 07676a1f95e8b2f7b84d0ea0554695d66736960d
parent 79ca3b2262be411182803b820efa7ebfab14fc2c
Author: William Casarin <jb55@jb55.com>
Date:   Sun,  5 Feb 2023 10:45:02 -0800

refactor: should_hide_event -> should_show_event

Diffstat:
Mdamus/Models/HomeModel.swift | 8++++----
Mdamus/Models/SearchHomeModel.swift | 4++--
Mdamus/Views/Events/MutedEventView.swift | 4++--
3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/damus/Models/HomeModel.swift b/damus/Models/HomeModel.swift @@ -464,7 +464,7 @@ class HomeModel: ObservableObject { } func handle_text_event(sub_id: String, _ ev: NostrEvent) { - if should_hide_event(contacts: damus_state.contacts, ev: ev) { + guard should_show_event(contacts: damus_state.contacts, ev: ev) else { return } @@ -781,10 +781,10 @@ func event_has_our_pubkey(_ ev: NostrEvent, our_pubkey: String) -> Bool { } -func should_hide_event(contacts: Contacts, ev: NostrEvent) -> Bool { +func should_show_event(contacts: Contacts, ev: NostrEvent) -> Bool { if contacts.is_muted(ev.pubkey) { - return true + return false } - return !ev.should_show_event + return ev.should_show_event } diff --git a/damus/Models/SearchHomeModel.swift b/damus/Models/SearchHomeModel.swift @@ -31,7 +31,7 @@ class SearchHomeModel: ObservableObject { } func filter_muted() { - events = events.filter { !should_hide_event(contacts: damus_state.contacts, ev: $0) } + events = events.filter { should_show_event(contacts: damus_state.contacts, ev: $0) } } func subscribe() { @@ -54,7 +54,7 @@ class SearchHomeModel: ObservableObject { guard sub_id == self.base_subid || sub_id == self.profiles_subid else { return } - if ev.is_textlike && !should_hide_event(contacts: damus_state.contacts, ev: ev) && !ev.is_reply(nil) { + if ev.is_textlike && should_show_event(contacts: damus_state.contacts, ev: ev) && !ev.is_reply(nil) { if seen_pubkey.contains(ev.pubkey) { return } diff --git a/damus/Views/Events/MutedEventView.swift b/damus/Views/Events/MutedEventView.swift @@ -25,11 +25,11 @@ struct MutedEventView: View { self.selected = selected self._nav_target = nav_target self._navigating = navigating - self._shown = State(initialValue: !should_hide_event(contacts: damus_state.contacts, ev: event)) + self._shown = State(initialValue: should_show_event(contacts: damus_state.contacts, ev: event)) } var should_mute: Bool { - return should_hide_event(contacts: damus_state.contacts, ev: event) + return !should_show_event(contacts: damus_state.contacts, ev: event) } var FillColor: Color {