mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 02:34:39 +00:00
fix: Fix mark existing duplicate read chapters as read option not working in some cases
This commit is contained in:
parent
7964ac87c6
commit
18528fbd92
1 changed files with 8 additions and 3 deletions
|
@ -67,6 +67,7 @@ import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.flow.receiveAsFlow
|
import kotlinx.coroutines.flow.receiveAsFlow
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
@ -156,6 +157,11 @@ class ReaderViewModel(
|
||||||
private var finished = false
|
private var finished = false
|
||||||
private var chapterToDownload: Download? = null
|
private var chapterToDownload: Download? = null
|
||||||
|
|
||||||
|
private val unfilteredChapterList by lazy {
|
||||||
|
val manga = manga!!
|
||||||
|
runBlocking { getChapter.awaitAll(manga, filterScanlators = false) }
|
||||||
|
}
|
||||||
|
|
||||||
private lateinit var chapterList: List<ReaderChapter>
|
private lateinit var chapterList: List<ReaderChapter>
|
||||||
|
|
||||||
private var chapterItems = emptyList<ReaderChapterItem>()
|
private var chapterItems = emptyList<ReaderChapterItem>()
|
||||||
|
@ -639,9 +645,8 @@ class ReaderViewModel(
|
||||||
.contains(LibraryPreferences.MARK_DUPLICATE_READ_CHAPTER_READ_EXISTING)
|
.contains(LibraryPreferences.MARK_DUPLICATE_READ_CHAPTER_READ_EXISTING)
|
||||||
if (!markDuplicateAsRead) return
|
if (!markDuplicateAsRead) return
|
||||||
|
|
||||||
val duplicateUnreadChapters = chapterList
|
val duplicateUnreadChapters = unfilteredChapterList
|
||||||
.mapNotNull {
|
.mapNotNull { chapter ->
|
||||||
val chapter = it.chapter
|
|
||||||
if (
|
if (
|
||||||
!chapter.read &&
|
!chapter.read &&
|
||||||
chapter.isRecognizedNumber &&
|
chapter.isRecognizedNumber &&
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue