diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt index cc327de21..d96a0cfdf 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt @@ -135,6 +135,10 @@ object SettingsReaderScreen : SearchableSettings { pref = readerPreferences.skipFiltered(), title = stringResource(R.string.pref_skip_filtered_chapters), ), + Preference.PreferenceItem.SwitchPreference( + pref = readerPreferences.skipDupe(), + title = stringResource(R.string.pref_skip_dupe_chapters), + ), Preference.PreferenceItem.SwitchPreference( pref = readerPreferences.alwaysShowChapterTransition(), title = stringResource(R.string.pref_always_show_chapter_transition), diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt index 8bbd042c0..d8c9c7896 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt @@ -183,6 +183,16 @@ class ReaderViewModel( } } else -> chapters + }.run { + if (readerPreferences.skipDupe().get()) { + groupBy { it.chapterNumber } + .mapValues { (_, chapters) -> + chapters.find { it.id == chapterId || it.scanlator == selectedChapter.scanlator } ?: chapters.first() + } + .values + } else { + this + } } chaptersForReader diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderPreferences.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderPreferences.kt index c9b577c17..a80295ddc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderPreferences.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/ReaderPreferences.kt @@ -60,6 +60,8 @@ class ReaderPreferences( fun skipFiltered() = preferenceStore.getBoolean("skip_filtered", true) + fun skipDupe() = preferenceStore.getBoolean("skip_dupe", false) + // endregion // region Split two page spread diff --git a/i18n/src/main/res/values/strings.xml b/i18n/src/main/res/values/strings.xml index f9489a1eb..ef0f1dd5a 100644 --- a/i18n/src/main/res/values/strings.xml +++ b/i18n/src/main/res/values/strings.xml @@ -337,6 +337,7 @@ Keep screen on Skip chapters marked read Skip filtered chapters + Skip duplicate chapters Navigation Volume keys Invert volume keys