diff --git a/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt b/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt index 7f3d21544..ae8212349 100644 --- a/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt +++ b/app/src/main/java/eu/kanade/domain/library/service/LibraryPreferences.kt @@ -60,6 +60,7 @@ class LibraryPreferences( fun languageBadge() = preferenceStore.getBoolean("display_language_badge", false) + fun newShowUpdatesCount() = preferenceStore.getBoolean("library_show_updates_count", true) fun newUpdatesCount() = preferenceStore.getInt("library_unseen_updates_count", 0) // endregion diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsGeneralScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsGeneralScreen.kt index 9df7d12a0..ea761d958 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsGeneralScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsGeneralScreen.kt @@ -37,6 +37,13 @@ object SettingsGeneralScreen : SearchableSettings { val prefs = remember { Injekt.get() } val libraryPrefs = remember { Injekt.get() } return mutableListOf().apply { + add( + Preference.PreferenceItem.SwitchPreference( + pref = libraryPrefs.newShowUpdatesCount(), + title = stringResource(R.string.pref_library_update_show_tab_badge), + ), + ) + add( Preference.PreferenceItem.SwitchPreference( pref = prefs.confirmExit(), diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt index 172442213..5f781b2ac 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/home/HomeScreen.kt @@ -53,6 +53,7 @@ import eu.kanade.tachiyomi.ui.more.MoreTab import eu.kanade.tachiyomi.ui.updates.UpdatesTab import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.launch import soup.compose.material.motion.animation.materialFadeThroughIn @@ -233,8 +234,11 @@ object HomeScreen : Screen { when { tab is UpdatesTab -> { val count by produceState(initialValue = 0) { - Injekt.get() - .newUpdatesCount().changes() + val pref = Injekt.get() + combine( + pref.newShowUpdatesCount().changes(), + pref.newUpdatesCount().changes(), + ) { show, count -> if (show) count else 0 } .collectLatest { value = it } } if (count > 0) { diff --git a/i18n/src/main/res/values/strings.xml b/i18n/src/main/res/values/strings.xml index 19dd016c1..2085e32a8 100644 --- a/i18n/src/main/res/values/strings.xml +++ b/i18n/src/main/res/values/strings.xml @@ -254,6 +254,7 @@ With unread chapter(s) With \"Completed\" status That haven\'t been started + Show unread count on Updates icon Automatically refresh metadata Check for new cover and details when updating library Automatically refresh trackers