Improve duplicate chapter set as read

This commit is contained in:
Jobobby04 2024-03-02 13:41:35 -05:00 committed by Cuong M. Tran
parent f7976335f5
commit 18f52a6043
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2

View file

@ -693,13 +693,15 @@ class ReaderViewModel @JvmOverloads constructor(
// SY <--
readerChapter.chapter.read = true
// SY -->
if (readerPreferences.markReadDupe().get()) {
if (readerChapter.chapter.chapter_number > 0 && readerPreferences.markReadDupe().get()) {
getChaptersByMangaId.await(manga!!.id).sortedByDescending { it.sourceOrder }
.filter {
!it.read && it.chapterNumber > 0.0 &&
it.id != readerChapter.chapter.id &&
!it.read &&
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) {
viewModelScope.launchNonCancellable {