Fix update sorting + swiping away items not updating in some cases

said case being swiping as read after another page of content loads
This commit is contained in:
Jays2Kings 2021-04-08 20:47:58 -04:00
parent e0315dda41
commit ca07d3dbb3

View File

@ -169,7 +169,7 @@ class RecentsPresenter(
else -> emptyList() else -> emptyList()
} }
rUpdates.forEach { rUpdates.forEach {
it.history.last_read = it.chapter.date_fetch it.history.last_read = it.chapter.date_upload
} }
val nAdditions = if (viewType < VIEW_TYPE_ONLY_HISTORY) { val nAdditions = if (viewType < VIEW_TYPE_ONLY_HISTORY) {
db.getRecentlyAdded(startCal.time, calDay.time, query, isUngrouped && !limit).executeOnIO() db.getRecentlyAdded(startCal.time, calDay.time, query, isUngrouped && !limit).executeOnIO()
@ -183,7 +183,7 @@ class RecentsPresenter(
}.distinctBy { }.distinctBy {
if (query.isEmpty() && viewType != VIEW_TYPE_ONLY_HISTORY) it.manga.id else it.chapter.id if (query.isEmpty() && viewType != VIEW_TYPE_ONLY_HISTORY) it.manga.id else it.chapter.id
}.filter { mch -> }.filter { mch ->
if (page > 0 && query.isEmpty()) { if (updatePageCount && page > 0 && query.isEmpty()) {
if (viewType != VIEW_TYPE_ONLY_HISTORY) { if (viewType != VIEW_TYPE_ONLY_HISTORY) {
recentItems.none { mch.manga.id == it.mch.manga.id } recentItems.none { mch.manga.id == it.mch.manga.id }
} else { } else {
@ -261,7 +261,7 @@ class RecentsPresenter(
} }
} else pairs.map { RecentMangaItem(it.first, it.second, null) } } else pairs.map { RecentMangaItem(it.first, it.second, null) }
} }
recentItems = if (page == 0) { recentItems = if (page == 0 || !updatePageCount) {
newItems newItems
} else { } else {
recentItems + newItems recentItems + newItems