Consider sort direction when downloading next n chapters (fixes #4916)

(cherry picked from commit 41a747c7e799a6cab936e9f4a14979ca7587ef39)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt
This commit is contained in:
arkon 2021-04-21 17:41:43 -04:00 committed by Jobobby04
parent 80a5a54e60
commit 91b49f8a0c

View File

@ -1424,15 +1424,26 @@ class MangaController :
// OVERFLOW MENU DIALOGS
private fun getUnreadChaptersSorted() = /* SY --> */ if (presenter.source.isEhBasedSource()) presenter.chapters
.sortedWith(presenter.getChapterSort())
.filter { !it.read && it.status == Download.State.NOT_DOWNLOADED }
.distinctBy { it.name }
else /* SY <-- */ presenter.chapters
.sortedWith(presenter.getChapterSort())
.filter { !it.read && it.status == Download.State.NOT_DOWNLOADED }
.distinctBy { it.name }
.reversed()
private fun getUnreadChaptersSorted(): List<ChapterItem> {
val chapters = presenter.chapters
.sortedWith(presenter.getChapterSort())
.filter { !it.read && it.status == Download.State.NOT_DOWNLOADED }
.distinctBy { it.name }
// SY -->
.let {
if (presenter.source.isEhBasedSource()) {
it.reversed()
} else {
it
}
}
// SY <--
return if (presenter.sortDescending()) {
chapters.reversed()
} else {
chapters
}
}
private fun downloadChapters(choice: Int) {
val chaptersToDownload = when (choice) {