Add option to hide missing chapter count (mihonapp/mihon#2108)

Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
(cherry picked from commit d2c1ff6adf5543e5a593949704d41f2358252593)
This commit is contained in:
Danny Wu 2025-06-20 05:00:10 -04:00 committed by Cuong-Tran
parent 46bb3da70a
commit 190f4a68ac
4 changed files with 13 additions and 0 deletions

View file

@ -287,6 +287,10 @@ object SettingsLibraryScreen : SearchableSettings {
), ),
title = stringResource(MR.strings.pref_mark_duplicate_read_chapter_read), title = stringResource(MR.strings.pref_mark_duplicate_read_chapter_read),
), ),
Preference.PreferenceItem.SwitchPreference(
preference = libraryPreferences.hideMissingChapters(),
title = stringResource(MR.strings.pref_hide_missing_chapter_indicators),
),
), ),
) )
} }

View file

@ -481,6 +481,7 @@ class MangaScreenModel(
excludedScanlators = getExcludedScanlators.await(mangaId).toImmutableSet(), excludedScanlators = getExcludedScanlators.await(mangaId).toImmutableSet(),
isRefreshingData = needRefreshInfo || needRefreshChapter, isRefreshingData = needRefreshInfo || needRefreshChapter,
dialog = null, dialog = null,
hideMissingChapters = libraryPreferences.hideMissingChapters().get(),
// SY --> // SY -->
showRecommendationsInOverflow = uiPreferences.recommendsInOverflow().get(), showRecommendationsInOverflow = uiPreferences.recommendsInOverflow().get(),
showMergeInOverflow = uiPreferences.mergeInOverflow().get(), showMergeInOverflow = uiPreferences.mergeInOverflow().get(),
@ -1899,6 +1900,7 @@ class MangaScreenModel(
val isRefreshingData: Boolean = false, val isRefreshingData: Boolean = false,
val dialog: Dialog? = null, val dialog: Dialog? = null,
val hasPromptedToAddBefore: Boolean = false, val hasPromptedToAddBefore: Boolean = false,
val hideMissingChapters: Boolean = false,
// SY --> // SY -->
val meta: RaisedSearchMetadata?, val meta: RaisedSearchMetadata?,
@ -1951,6 +1953,10 @@ class MangaScreenModel(
} }
val chapterListItems by lazy { val chapterListItems by lazy {
if (hideMissingChapters) {
return@lazy processedChapters
}
processedChapters.insertSeparators { before, after -> processedChapters.insertSeparators { before, after ->
val (lowerChapter, higherChapter) = if (manga.sortDescending()) { val (lowerChapter, higherChapter) = if (manga.sortDescending()) {
after to before after to before

View file

@ -223,6 +223,7 @@ class LibraryPreferences(
fun autoClearChapterCache() = preferenceStore.getBoolean("auto_clear_chapter_cache", false) fun autoClearChapterCache() = preferenceStore.getBoolean("auto_clear_chapter_cache", false)
fun hideMissingChapters() = preferenceStore.getBoolean("pref_hide_missing_chapter_indicators", false)
// endregion // endregion
// region Swipe Actions // region Swipe Actions

View file

@ -319,6 +319,8 @@
<string name="pref_mark_duplicate_read_chapter_read_existing">After reading a chapter</string> <string name="pref_mark_duplicate_read_chapter_read_existing">After reading a chapter</string>
<string name="pref_mark_duplicate_read_chapter_read_new">After fetching new chapter</string> <string name="pref_mark_duplicate_read_chapter_read_new">After fetching new chapter</string>
<string name="pref_hide_missing_chapter_indicators">Hide missing chapter indicators</string>
<!-- Extension section --> <!-- Extension section -->
<string name="multi_lang">Multi</string> <string name="multi_lang">Multi</string>
<string name="ext_updates_pending">Updates pending</string> <string name="ext_updates_pending">Updates pending</string>