Removes new threads, boosts from the Conversations view

This commit is contained in:
Vitor Pamplona 2023-01-30 13:51:30 -03:00
parent 6225b4f843
commit 76087e5f25

View File

@ -54,16 +54,23 @@ class NostrChatroomListNewFeedViewModel: FeedViewModel(NostrChatroomListDataSour
}
}
fun isNewThread(note: Note): Boolean {
return note.event is RepostEvent || note.replyTo == null || note.replyTo?.size == 0
}
class NostrHomeFeedViewModel: FeedViewModel(NostrHomeDataSource) {
override fun newListFromDataSource(): List<Note> {
// Filter: no replies
return dataSource.feed().filter {
it.event is RepostEvent || it.replyTo == null || it.replyTo?.size == 0
}.take(100)
return dataSource.feed().filter { isNewThread(it) }.take(100)
}
}
class NostrHomeRepliesFeedViewModel: FeedViewModel(NostrHomeDataSource) {}
class NostrHomeRepliesFeedViewModel: FeedViewModel(NostrHomeDataSource) {
override fun newListFromDataSource(): List<Note> {
// Filter: only replies
return dataSource.feed().filter {!isNewThread(it) }.take(100)
}
}
abstract class FeedViewModel(val dataSource: NostrDataSource<Note>): ViewModel() {