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.
This commit is contained in:
arkon 2022-11-11 15:35:10 -05:00
parent afa0a0a0e2
commit a8eebd824a
4 changed files with 0 additions and 19 deletions

View file

@ -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
}
}

View file

@ -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 {

View file

@ -29,16 +29,6 @@ class SettingsBrowseScreen : SearchableSettings {
val sourcePreferences = remember { Injekt.get<SourcePreferences>() }
val preferences = remember { Injekt.get<BasePreferences>() }
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(

View file

@ -451,8 +451,6 @@
<string name="action_track">Track</string>
<!-- Browse section -->
<string name="pref_duplicate_pinned_sources">Show duplicated pinned sources</string>
<string name="pref_duplicate_pinned_sources_summary">Repeat pinned sources in their respective language groups</string>
<string name="pref_enable_automatic_extension_updates">Check for extension updates</string>
<string name="pref_search_pinned_sources_only">Only include pinned sources</string>