Browse Source

Fix picker bug and refactored

translations_damus-localizations-en-us-xcloc-localized-contents-en-us-xliff--master_es_419
OlegAba 2 years ago
committed by William Casarin
parent
commit
08dd2d5414
  1. 18
      damus/ContentView.swift

18
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) {

Loading…
Cancel
Save