mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-22 11:08:54 +02:00
Fix mark existing duplicate read chapters as read option not working in some cases (#1944)
This commit is contained in:
@@ -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 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 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 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
|
## [v0.18.0] - 2025-03-20
|
||||||
### Added
|
### Added
|
||||||
|
@@ -15,7 +15,6 @@ import eu.kanade.domain.manga.model.readingMode
|
|||||||
import eu.kanade.domain.source.interactor.GetIncognitoState
|
import eu.kanade.domain.source.interactor.GetIncognitoState
|
||||||
import eu.kanade.domain.track.interactor.TrackChapter
|
import eu.kanade.domain.track.interactor.TrackChapter
|
||||||
import eu.kanade.domain.track.service.TrackPreferences
|
import eu.kanade.domain.track.service.TrackPreferences
|
||||||
import eu.kanade.tachiyomi.data.database.models.isRecognizedNumber
|
|
||||||
import eu.kanade.tachiyomi.data.database.models.toDomainChapter
|
import eu.kanade.tachiyomi.data.database.models.toDomainChapter
|
||||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||||
import eu.kanade.tachiyomi.data.download.DownloadProvider
|
import eu.kanade.tachiyomi.data.download.DownloadProvider
|
||||||
@@ -147,6 +146,11 @@ class ReaderViewModel @JvmOverloads constructor(
|
|||||||
|
|
||||||
private var chapterToDownload: Download? = null
|
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
|
* 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.
|
* time in a background thread to avoid blocking the UI.
|
||||||
@@ -559,15 +563,14 @@ class ReaderViewModel @JvmOverloads constructor(
|
|||||||
.contains(LibraryPreferences.MARK_DUPLICATE_CHAPTER_READ_EXISTING)
|
.contains(LibraryPreferences.MARK_DUPLICATE_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 &&
|
||||||
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)
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user