Fix incorrect locale name casing in extension details (fixes #6391)

Also closing https://github.com/tachiyomiorg/tachiyomi-extensions/issues/10007 since multisource extensions aren't really a thing anymore.
This commit is contained in:
arkon 2021-12-26 11:34:56 -05:00
parent 58c2f22120
commit 733cf99bb4

View file

@ -36,7 +36,6 @@ import eu.kanade.tachiyomi.ui.base.controller.openInBrowser
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.util.preference.DSL import eu.kanade.tachiyomi.util.preference.DSL
import eu.kanade.tachiyomi.util.preference.onChange import eu.kanade.tachiyomi.util.preference.onChange
import eu.kanade.tachiyomi.util.preference.preferenceCategory
import eu.kanade.tachiyomi.util.preference.switchPreference import eu.kanade.tachiyomi.util.preference.switchPreference
import eu.kanade.tachiyomi.util.preference.switchSettingsPreference import eu.kanade.tachiyomi.util.preference.switchSettingsPreference
import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.LocaleHelper
@ -122,11 +121,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
.map { source -> LocaleHelper.getSourceDisplayName(source.lang, context) to source } .map { source -> LocaleHelper.getSourceDisplayName(source.lang, context) to source }
.sortedWith(compareBy({ (_, source) -> !source.isEnabled() }, { (lang, _) -> lang.lowercase() })) .sortedWith(compareBy({ (_, source) -> !source.isEnabled() }, { (lang, _) -> lang.lowercase() }))
.forEach { (lang, source) -> .forEach { (lang, source) ->
val preferenceBlock = { sourceSwitchPreference(source, lang)
sourceSwitchPreference(source, LocaleHelper.getSourceDisplayName(lang, context))
}
preferenceBlock()
} }
} }
@ -135,20 +130,12 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
.groupBy { (it as CatalogueSource).lang } .groupBy { (it as CatalogueSource).lang }
.toSortedMap(compareBy { LocaleHelper.getSourceDisplayName(it, context) }) .toSortedMap(compareBy { LocaleHelper.getSourceDisplayName(it, context) })
.forEach { entry -> .forEach { entry ->
val preferenceBlock = {
entry.value entry.value
.sortedWith(compareBy({ source -> !source.isEnabled() }, { source -> source.name.lowercase() })) .sortedWith(compareBy({ source -> !source.isEnabled() }, { source -> source.name.lowercase() }))
.forEach { source -> .forEach { source ->
sourceSwitchPreference(source, source.toString()) sourceSwitchPreference(source, source.toString())
} }
} }
preferenceCategory {
title = LocaleHelper.getSourceDisplayName(entry.key, context)
preferenceBlock()
}
}
} }
private fun PreferenceScreen.sourceSwitchPreference(source: Source, name: String) { private fun PreferenceScreen.sourceSwitchPreference(source: Source, name: String) {