mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 14:09:17 +01:00
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(),
|
preferences.lastUsedSource().changes(),
|
||||||
repository.getSources(),
|
repository.getSources(),
|
||||||
) { pinnedSourceIds, enabledLanguages, disabledSources, lastUsedSource, sources ->
|
) { pinnedSourceIds, enabledLanguages, disabledSources, lastUsedSource, sources ->
|
||||||
val duplicatePins = preferences.duplicatePinnedSources().get()
|
|
||||||
sources
|
sources
|
||||||
.filter { it.lang in enabledLanguages || it.id == LocalSource.ID }
|
.filter { it.lang in enabledLanguages || it.id == LocalSource.ID }
|
||||||
.filterNot { it.id.toString() in disabledSources }
|
.filterNot { it.id.toString() in disabledSources }
|
||||||
@ -35,10 +34,6 @@ class GetEnabledSources(
|
|||||||
if (source.id == lastUsedSource) {
|
if (source.id == lastUsedSource) {
|
||||||
toFlatten.add(source.copy(isUsedLast = true, pin = source.pin - Pin.Actual))
|
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
|
toFlatten
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ data class Source(
|
|||||||
val key: () -> String = {
|
val key: () -> String = {
|
||||||
when {
|
when {
|
||||||
isUsedLast -> "$id-lastused"
|
isUsedLast -> "$id-lastused"
|
||||||
Pin.Forced in pin -> "$id-forced"
|
|
||||||
else -> "$id"
|
else -> "$id"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,7 +42,6 @@ sealed class Pin(val code: Int) {
|
|||||||
object Unpinned : Pin(0b00)
|
object Unpinned : Pin(0b00)
|
||||||
object Pinned : Pin(0b01)
|
object Pinned : Pin(0b01)
|
||||||
object Actual : Pin(0b10)
|
object Actual : Pin(0b10)
|
||||||
object Forced : Pin(0b100)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun Pins(builder: Pins.PinsBuilder.() -> Unit = {}): Pins {
|
inline fun Pins(builder: Pins.PinsBuilder.() -> Unit = {}): Pins {
|
||||||
|
@ -29,16 +29,6 @@ class SettingsBrowseScreen : SearchableSettings {
|
|||||||
val sourcePreferences = remember { Injekt.get<SourcePreferences>() }
|
val sourcePreferences = remember { Injekt.get<SourcePreferences>() }
|
||||||
val preferences = remember { Injekt.get<BasePreferences>() }
|
val preferences = remember { Injekt.get<BasePreferences>() }
|
||||||
return listOf(
|
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(
|
Preference.PreferenceGroup(
|
||||||
title = stringResource(R.string.label_extensions),
|
title = stringResource(R.string.label_extensions),
|
||||||
preferenceItems = listOf(
|
preferenceItems = listOf(
|
||||||
|
@ -451,8 +451,6 @@
|
|||||||
<string name="action_track">Track</string>
|
<string name="action_track">Track</string>
|
||||||
|
|
||||||
<!-- Browse section -->
|
<!-- 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_enable_automatic_extension_updates">Check for extension updates</string>
|
||||||
<string name="pref_search_pinned_sources_only">Only include pinned sources</string>
|
<string name="pref_search_pinned_sources_only">Only include pinned sources</string>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user