Added a much needed return to getting recents for endless

Also reduced retry count to 15
This commit is contained in:
Jays2Kings 2021-04-09 01:17:31 -04:00
parent 6bbf553798
commit 248f729768

View File

@ -96,10 +96,11 @@ class RecentsPresenter(
} }
private suspend fun runRecents(oldQuery: String = "", updatePageCount: Boolean = false, retryCount: Int = 0, itemCount: Int = 0, limit: Boolean = false) { private suspend fun runRecents(oldQuery: String = "", updatePageCount: Boolean = false, retryCount: Int = 0, itemCount: Int = 0, limit: Boolean = false) {
if (retryCount > 20) { if (retryCount > 15) {
finished = true finished = true
setDownloadedChapters(recentItems) setDownloadedChapters(recentItems)
withContext(Dispatchers.Main) { controller?.showLists(recentItems, false) } withContext(Dispatchers.Main) { controller?.showLists(recentItems, false) }
return
} }
val showRead = preferences.showReadInAllRecents().get() && !limit val showRead = preferences.showReadInAllRecents().get() && !limit
@ -208,7 +209,7 @@ class RecentsPresenter(
} }
val newItems = if (query.isEmpty() && !isUngrouped) { val newItems = if (query.isEmpty() && !isUngrouped) {
val nChaptersItems = val nChaptersItems =
pairs.filter { it.first.history.id == null && it.first.chapter.id != null } pairs.asSequence().filter { it.first.history.id == null && it.first.chapter.id != null }
.sortedWith { f1, f2 -> .sortedWith { f1, f2 ->
if (abs(f1.second.date_fetch - f2.second.date_fetch) <= if (abs(f1.second.date_fetch - f2.second.date_fetch) <=
TimeUnit.HOURS.toMillis(12) TimeUnit.HOURS.toMillis(12)