Skip to content

Commit 18528fb

Browse files
AntsyLichnull2264
authored andcommitted
fix: Fix mark existing duplicate read chapters as read option not working in some cases
1 parent 7964ac8 commit 18528fb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ import kotlinx.coroutines.flow.onEach
6767
import kotlinx.coroutines.flow.receiveAsFlow
6868
import kotlinx.coroutines.flow.update
6969
import kotlinx.coroutines.launch
70+
import kotlinx.coroutines.runBlocking
7071
import kotlinx.coroutines.withContext
7172
import uy.kohesive.injekt.Injekt
7273
import uy.kohesive.injekt.api.get
@@ -156,6 +157,11 @@ class ReaderViewModel(
156157
private var finished = false
157158
private var chapterToDownload: Download? = null
158159

160+
private val unfilteredChapterList by lazy {
161+
val manga = manga!!
162+
runBlocking { getChapter.awaitAll(manga, filterScanlators = false) }
163+
}
164+
159165
private lateinit var chapterList: List<ReaderChapter>
160166

161167
private var chapterItems = emptyList<ReaderChapterItem>()
@@ -639,9 +645,8 @@ class ReaderViewModel(
639645
.contains(LibraryPreferences.MARK_DUPLICATE_READ_CHAPTER_READ_EXISTING)
640646
if (!markDuplicateAsRead) return
641647

642-
val duplicateUnreadChapters = chapterList
643-
.mapNotNull {
644-
val chapter = it.chapter
648+
val duplicateUnreadChapters = unfilteredChapterList
649+
.mapNotNull { chapter ->
645650
if (
646651
!chapter.read &&
647652
chapter.isRecognizedNumber &&

0 commit comments

Comments
 (0)