fix: explore results (#97)

This commit is contained in:
Diego Beraldin 2023-11-02 22:24:40 +01:00 committed by GitHub
parent 1be69ea288
commit 618335e8f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,18 +220,21 @@ class ExploreViewModel(
listingType = listingType,
sortType = sortType,
)
currentPage++
if (!itemList.isNullOrEmpty()) {
currentPage++
}
val itemsToAdd = itemList.orEmpty().filter { item ->
if (settings.includeNsfw) {
true
} else {
isSafeForWork(item)
}
}
mvi.updateState {
val newItems = if (refreshing) {
itemList.orEmpty()
itemsToAdd
} else {
it.results + itemList.orEmpty()
}.filter { item ->
if (settings.includeNsfw) {
true
} else {
isSafeForWork(item)
}
it.results + itemsToAdd
}
it.copy(
results = newItems,