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:
parent
afa0a0a0e2
commit
a8eebd824a
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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(
|
||||
|
@ -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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user