Add filters for home screen

Closes: #25
Changelog-Added: Added ability to hide replies on home timeline
This commit is contained in:
James Carucci
2022-08-13 12:20:48 -04:00
committed by William Casarin
parent be3e65f657
commit 12eb50255a
5 changed files with 51 additions and 12 deletions

View File

@@ -16,10 +16,11 @@ struct InnerTimelineView: View {
@Binding var events: [NostrEvent]
let damus: DamusState
let show_friend_icon: Bool
let filter: (NostrEvent) -> Bool
var body: some View {
LazyVStack {
ForEach(events, id: \.id) { (ev: NostrEvent) in
ForEach(events.filter(filter), id: \.id) { (ev: NostrEvent) in
let tm = ThreadModel(event: inner_event_or_self(ev: ev), pool: damus.pool, privkey: damus.keypair.privkey)
let is_chatroom = has_hashtag(ev.tags, hashtag: "chat")
let tv = ThreadView(thread: tm, damus: damus, is_chatroom: is_chatroom)
@@ -41,6 +42,8 @@ struct TimelineView: View {
let damus: DamusState
let show_friend_icon: Bool
let filter: (NostrEvent) -> Bool
var body: some View {
MainContent
}
@@ -52,7 +55,7 @@ struct TimelineView: View {
ProgressView()
.progressViewStyle(.circular)
}
InnerTimelineView(events: $events, damus: damus, show_friend_icon: show_friend_icon)
InnerTimelineView(events: $events, damus: damus, show_friend_icon: show_friend_icon, filter: filter)
}
.onReceive(NotificationCenter.default.publisher(for: .scroll_to_top)) { _ in
guard let event = events.first else {