Improve duplicate chapter set as read

This commit is contained in:
Jobobby04 2024-03-02 13:41:35 -05:00
parent 6c6f09ac5a
commit cc7b8a9b69

View File

@ -693,13 +693,15 @@ class ReaderViewModel @JvmOverloads constructor(
// SY <-- // SY <--
readerChapter.chapter.read = true readerChapter.chapter.read = true
// SY --> // SY -->
if (readerPreferences.markReadDupe().get()) { if (readerChapter.chapter.chapter_number > 0 && readerPreferences.markReadDupe().get()) {
getChaptersByMangaId.await(manga!!.id).sortedByDescending { it.sourceOrder } getChaptersByMangaId.await(manga!!.id).sortedByDescending { it.sourceOrder }
.filter { .filter {
!it.read && it.chapterNumber > 0.0 && it.id != readerChapter.chapter.id &&
!it.read &&
it.chapterNumber.toFloat() == readerChapter.chapter.chapter_number it.chapterNumber.toFloat() == readerChapter.chapter.chapter_number
} }
.also { setReadStatus.await(true, *it.toTypedArray()) } .ifEmpty { null }
?.also { setReadStatus.await(true, *it.toTypedArray()) }
} }
if (manga?.isEhBasedManga() == true) { if (manga?.isEhBasedManga() == true) {
viewModelScope.launchNonCancellable { viewModelScope.launchNonCancellable {