damus

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

commit 08dd2d5414b895dd8713f4b4f928a0cc3a674827
parent 421245a2f8919842bccc86a9355701bab5a14f6b
Author: OlegAba <mail@olegaba.com>
Date:   Sat,  7 Jan 2023 13:03:05 -0500

Fix picker bug and refactored

Diffstat:
Mdamus/ContentView.swift | 18++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/damus/ContentView.swift b/damus/ContentView.swift @@ -45,10 +45,10 @@ enum FilterState : Int { case posts_and_replies = 1 case posts = 0 - func filter(privkey: String?, ev: NostrEvent) -> Bool { + func filter(ev: NostrEvent) -> Bool { switch self { case .posts: - return !ev.is_reply(privkey) + return !ev.is_reply(nil) case .posts_and_replies: return true } @@ -93,10 +93,12 @@ struct ContentView: View { var PostingTimelineView: some View { VStack { TabView(selection: $filter_state) { - contentTimelineView(filter: posts_filter_event) + contentTimelineView(filter: FilterState.posts.filter) .tag(FilterState.posts) - contentTimelineView(filter: posts_and_replies_filter_event) + .id(FilterState.posts) + contentTimelineView(filter: FilterState.posts_and_replies.filter) .tag(FilterState.posts_and_replies) + .id(FilterState.posts_and_replies) } .tabViewStyle(.page(indexDisplayMode: .never)) } @@ -126,14 +128,6 @@ struct ContentView: View { } } - func posts_and_replies_filter_event(_ ev: NostrEvent) -> Bool { - return true - } - - func posts_filter_event(_ ev: NostrEvent) -> Bool { - return !ev.is_reply(nil) - } - var FiltersView: some View { VStack{ Picker("Filter State", selection: $filter_state) {