mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-10 01:02:33 +02:00
Adjusting Post Lists to 1000 and simplifying comparisons to know when the list has changed.
This commit is contained in:
@@ -53,14 +53,14 @@ class NostrChatroomListNewFeedViewModel: FeedViewModel(NostrChatroomListDataSour
|
|||||||
class NostrHomeFeedViewModel: FeedViewModel(NostrHomeDataSource) {
|
class NostrHomeFeedViewModel: FeedViewModel(NostrHomeDataSource) {
|
||||||
override fun newListFromDataSource(): List<Note> {
|
override fun newListFromDataSource(): List<Note> {
|
||||||
// Filter: no replies
|
// Filter: no replies
|
||||||
return dataSource.feed().filter { it.isNewThread() }.take(100)
|
return dataSource.feed().filter { it.isNewThread() }.take(1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NostrHomeRepliesFeedViewModel: FeedViewModel(NostrHomeDataSource) {
|
class NostrHomeRepliesFeedViewModel: FeedViewModel(NostrHomeDataSource) {
|
||||||
override fun newListFromDataSource(): List<Note> {
|
override fun newListFromDataSource(): List<Note> {
|
||||||
// Filter: only replies
|
// Filter: only replies
|
||||||
return dataSource.feed().filter {! it.isNewThread() }.take(100)
|
return dataSource.feed().filter {! it.isNewThread() }.take(1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +89,8 @@ abstract class FeedViewModel(val dataSource: NostrDataSource<Note>): ViewModel()
|
|||||||
|
|
||||||
val oldNotesState = feedContent.value
|
val oldNotesState = feedContent.value
|
||||||
if (oldNotesState is FeedState.Loaded) {
|
if (oldNotesState is FeedState.Loaded) {
|
||||||
if (notes != oldNotesState.feed) {
|
// Using size as a proxy for has changed.
|
||||||
|
if (notes.size != oldNotesState.feed.value.size && notes.firstOrNull() != oldNotesState.feed.value.firstOrNull()) {
|
||||||
updateFeed(notes)
|
updateFeed(notes)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -39,7 +39,8 @@ open class LnZapFeedViewModel(val dataSource: NostrDataSource<Pair<Note, Note>>)
|
|||||||
|
|
||||||
val oldNotesState = feedContent.value
|
val oldNotesState = feedContent.value
|
||||||
if (oldNotesState is LnZapFeedState.Loaded) {
|
if (oldNotesState is LnZapFeedState.Loaded) {
|
||||||
if (notes != oldNotesState.feed) {
|
// Using size as a proxy for has changed.
|
||||||
|
if (notes.size != oldNotesState.feed.value.size && notes.firstOrNull() != oldNotesState.feed.value.firstOrNull()) {
|
||||||
updateFeed(notes)
|
updateFeed(notes)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -54,7 +54,8 @@ open class UserFeedViewModel(val dataSource: NostrDataSource<User>): ViewModel()
|
|||||||
|
|
||||||
val oldNotesState = feedContent.value
|
val oldNotesState = feedContent.value
|
||||||
if (oldNotesState is UserFeedState.Loaded) {
|
if (oldNotesState is UserFeedState.Loaded) {
|
||||||
if (notes != oldNotesState.feed) {
|
// Using size as a proxy for has changed.
|
||||||
|
if (notes.size != oldNotesState.feed.value.size && notes.firstOrNull() != oldNotesState.feed.value.firstOrNull()) {
|
||||||
updateFeed(notes)
|
updateFeed(notes)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user