From a8eebd824a50d4676cc31aec51ede94009b82851 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 11 Nov 2022 15:35:10 -0500 Subject: [PATCH] Remove duplicate pinned sources setting I guess it's simpler to just have 1 entry in the list (other than the last used duplicate). This helps ensure that the list is as short as it can be. --- .../domain/source/interactor/GetEnabledSources.kt | 5 ----- .../main/java/eu/kanade/domain/source/model/Source.kt | 2 -- .../more/settings/screen/SettingsBrowseScreen.kt | 10 ---------- i18n/src/main/res/values/strings.xml | 2 -- 4 files changed, 19 deletions(-) diff --git a/app/src/main/java/eu/kanade/domain/source/interactor/GetEnabledSources.kt b/app/src/main/java/eu/kanade/domain/source/interactor/GetEnabledSources.kt index 2c6322f48..ab09bd88e 100644 --- a/app/src/main/java/eu/kanade/domain/source/interactor/GetEnabledSources.kt +++ b/app/src/main/java/eu/kanade/domain/source/interactor/GetEnabledSources.kt @@ -23,7 +23,6 @@ class GetEnabledSources( preferences.lastUsedSource().changes(), repository.getSources(), ) { pinnedSourceIds, enabledLanguages, disabledSources, lastUsedSource, sources -> - val duplicatePins = preferences.duplicatePinnedSources().get() sources .filter { it.lang in enabledLanguages || it.id == LocalSource.ID } .filterNot { it.id.toString() in disabledSources } @@ -35,10 +34,6 @@ class GetEnabledSources( if (source.id == lastUsedSource) { toFlatten.add(source.copy(isUsedLast = true, pin = source.pin - Pin.Actual)) } - if (duplicatePins && Pin.Pinned in source.pin) { - toFlatten[0] = toFlatten[0].copy(pin = source.pin + Pin.Forced) - toFlatten.add(source.copy(pin = source.pin - Pin.Actual)) - } toFlatten } } diff --git a/app/src/main/java/eu/kanade/domain/source/model/Source.kt b/app/src/main/java/eu/kanade/domain/source/model/Source.kt index 0de7ed426..a840065d9 100644 --- a/app/src/main/java/eu/kanade/domain/source/model/Source.kt +++ b/app/src/main/java/eu/kanade/domain/source/model/Source.kt @@ -33,7 +33,6 @@ data class Source( val key: () -> String = { when { isUsedLast -> "$id-lastused" - Pin.Forced in pin -> "$id-forced" else -> "$id" } } @@ -43,7 +42,6 @@ sealed class Pin(val code: Int) { object Unpinned : Pin(0b00) object Pinned : Pin(0b01) object Actual : Pin(0b10) - object Forced : Pin(0b100) } inline fun Pins(builder: Pins.PinsBuilder.() -> Unit = {}): Pins { diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBrowseScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBrowseScreen.kt index f775903c6..975667548 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBrowseScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBrowseScreen.kt @@ -29,16 +29,6 @@ class SettingsBrowseScreen : SearchableSettings { val sourcePreferences = remember { Injekt.get() } val preferences = remember { Injekt.get() } return listOf( - Preference.PreferenceGroup( - title = stringResource(R.string.label_sources), - preferenceItems = listOf( - Preference.PreferenceItem.SwitchPreference( - pref = sourcePreferences.duplicatePinnedSources(), - title = stringResource(R.string.pref_duplicate_pinned_sources), - subtitle = stringResource(R.string.pref_duplicate_pinned_sources_summary), - ), - ), - ), Preference.PreferenceGroup( title = stringResource(R.string.label_extensions), preferenceItems = listOf( diff --git a/i18n/src/main/res/values/strings.xml b/i18n/src/main/res/values/strings.xml index 9d3c107d5..a625ccfb2 100644 --- a/i18n/src/main/res/values/strings.xml +++ b/i18n/src/main/res/values/strings.xml @@ -451,8 +451,6 @@ Track - Show duplicated pinned sources - Repeat pinned sources in their respective language groups Check for extension updates Only include pinned sources