Fix mark existing duplicate read chapters as read option not working in some cases (mihonapp/mihon#1944)
(cherry picked from commit 8a21148578af3c1538e9ab2b1fe5bdf05b4e35c9)
This commit is contained in:
parent
3b13f4411a
commit
09a0b4f862
2 changed files with 10 additions and 6 deletions
|
|
@ -21,6 +21,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
|||
- Fix next chapter button occasionally jumping to the last page of the current chapter ([@perokhe](https://github.com/perokhe)) ([#1920](https://github.com/mihonapp/mihon/pull/1920))
|
||||
- Fix page number not appearing when opening chapter ([@perokhe](https://github.com/perokhe)) ([#1936](https://github.com/mihonapp/mihon/pull/1936))
|
||||
- Fix backup sharing from notifications not working when app is in background ([@JaymanR](https://github.com/JaymanR))([#1929](https://github.com/mihonapp/mihon/pull/1929))
|
||||
- Fix mark existing duplicate read chapters as read option not working in some cases ([@AntsyLich](https://github.com/AntsyLich)) ([#1944](https://github.com/mihonapp/mihon/pull/1944))
|
||||
|
||||
## [v0.18.0] - 2025-03-20
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import eu.kanade.domain.sync.SyncPreferences
|
|||
import eu.kanade.domain.track.interactor.TrackChapter
|
||||
import eu.kanade.domain.track.service.TrackPreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.data.database.models.isRecognizedNumber
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainChapter
|
||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.download.DownloadProvider
|
||||
|
|
@ -182,6 +181,11 @@ class ReaderViewModel @JvmOverloads constructor(
|
|||
|
||||
private var chapterToDownload: Download? = null
|
||||
|
||||
private val unfilteredChapterList by lazy {
|
||||
val manga = manga!!
|
||||
runBlocking { getChaptersByMangaId.await(manga.id, applyScanlatorFilter = false) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Chapter list for the active manga. It's retrieved lazily and should be accessed for the first
|
||||
* time in a background thread to avoid blocking the UI.
|
||||
|
|
@ -759,15 +763,14 @@ class ReaderViewModel @JvmOverloads constructor(
|
|||
.contains(LibraryPreferences.MARK_DUPLICATE_CHAPTER_READ_EXISTING)
|
||||
if (!markDuplicateAsRead) return
|
||||
|
||||
val duplicateUnreadChapters = chapterList
|
||||
.mapNotNull {
|
||||
val chapter = it.chapter
|
||||
val duplicateUnreadChapters = unfilteredChapterList
|
||||
.mapNotNull { chapter ->
|
||||
if (
|
||||
!chapter.read &&
|
||||
chapter.isRecognizedNumber &&
|
||||
chapter.chapter_number == readerChapter.chapter.chapter_number
|
||||
chapter.chapterNumber.toFloat() == readerChapter.chapter.chapter_number
|
||||
) {
|
||||
ChapterUpdate(id = chapter.id!!, read = true)
|
||||
ChapterUpdate(id = chapter.id, read = true)
|
||||
// SY -->
|
||||
.also { deleteChapterIfNeeded(ReaderChapter(chapter)) }
|
||||
// SY <--
|
||||
|
|
|
|||
Loading…
Reference in a new issue