mirror of
https://github.com/mihonapp/mihon.git
synced 2026-10-25 10:02:04 -07:00
Open a requested chapter in the reader even if its scanlator is excluded by filter
The reader builds its chapter list with excluded scanlators filtered out, so a chapter opened directly (from a deep link or a notification) whose scanlator is excluded wasn't in the list and failed to open. The requested chapter is now added back when the filter removed it.
This commit is contained in:
@@ -202,6 +202,13 @@ class ReaderViewModel(
|
||||
private val chapterList by lazy {
|
||||
val manga = manga!!
|
||||
val chapters = runBlocking { getChaptersByMangaId.await(manga.id, applyScanlatorFilter = true) }
|
||||
.let { filtered ->
|
||||
if (filtered.any { it.id == chapterId }) {
|
||||
filtered
|
||||
} else {
|
||||
filtered + unfilteredChapterList.filter { it.id == chapterId }
|
||||
}
|
||||
}
|
||||
|
||||
val selectedChapter = chapters.find { it.id == chapterId }
|
||||
?: error("Requested chapter of id $chapterId not found in chapter list")
|
||||
|
||||
Reference in New Issue
Block a user