mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 14:59:18 +01:00
Update reader chapter list filtering to handle not downloaded/bookmarked (closes #5107)
This commit is contained in:
parent
974275a429
commit
ce9fb2f1fe
@ -96,27 +96,21 @@ class ReaderPresenter(
|
|||||||
val selectedChapter = dbChapters.find { it.id == chapterId }
|
val selectedChapter = dbChapters.find { it.id == chapterId }
|
||||||
?: error("Requested chapter of id $chapterId not found in chapter list")
|
?: error("Requested chapter of id $chapterId not found in chapter list")
|
||||||
|
|
||||||
val chaptersForReader =
|
val chaptersForReader = when {
|
||||||
if (preferences.skipRead() || preferences.skipFiltered()) {
|
(preferences.skipRead() || preferences.skipFiltered()) -> {
|
||||||
val list = dbChapters
|
val list = dbChapters.filterNot {
|
||||||
.filter {
|
when {
|
||||||
if (preferences.skipRead() && it.read) {
|
preferences.skipRead() && it.read -> true
|
||||||
return@filter false
|
preferences.skipFiltered() -> {
|
||||||
} else if (preferences.skipFiltered()) {
|
|
||||||
if (
|
|
||||||
(manga.readFilter == Manga.CHAPTER_SHOW_READ && !it.read) ||
|
(manga.readFilter == Manga.CHAPTER_SHOW_READ && !it.read) ||
|
||||||
(manga.readFilter == Manga.CHAPTER_SHOW_UNREAD && it.read) ||
|
(manga.readFilter == Manga.CHAPTER_SHOW_UNREAD && it.read) ||
|
||||||
(
|
(manga.downloadedFilter == Manga.CHAPTER_SHOW_DOWNLOADED && !downloadManager.isChapterDownloaded(it, manga)) ||
|
||||||
manga.downloadedFilter == Manga.CHAPTER_SHOW_DOWNLOADED &&
|
(manga.downloadedFilter == Manga.CHAPTER_SHOW_NOT_DOWNLOADED && downloadManager.isChapterDownloaded(it, manga)) ||
|
||||||
!downloadManager.isChapterDownloaded(it, manga)
|
(manga.bookmarkedFilter == Manga.CHAPTER_SHOW_BOOKMARKED && !it.bookmark) ||
|
||||||
) ||
|
(manga.bookmarkedFilter == Manga.CHAPTER_SHOW_NOT_BOOKMARKED && it.bookmark)
|
||||||
(manga.bookmarkedFilter == Manga.CHAPTER_SHOW_BOOKMARKED && !it.bookmark)
|
|
||||||
) {
|
|
||||||
return@filter false
|
|
||||||
}
|
}
|
||||||
|
else -> false
|
||||||
}
|
}
|
||||||
|
|
||||||
true
|
|
||||||
}
|
}
|
||||||
.toMutableList()
|
.toMutableList()
|
||||||
|
|
||||||
@ -125,8 +119,8 @@ class ReaderPresenter(
|
|||||||
list.add(selectedChapter)
|
list.add(selectedChapter)
|
||||||
}
|
}
|
||||||
list
|
list
|
||||||
} else {
|
}
|
||||||
dbChapters
|
else -> dbChapters
|
||||||
}
|
}
|
||||||
|
|
||||||
when (manga.sorting) {
|
when (manga.sorting) {
|
||||||
|
Loading…
Reference in New Issue
Block a user