From 860a05abf20961309bb15356e41f46255240f06d Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Mon, 22 Feb 2021 01:21:41 +0800 Subject: [PATCH] Simplify UpdateChannel --- .../com/topjohnwu/magisk/ui/settings/SettingsItems.kt | 8 ++++---- app/src/main/res/values/arrays.xml | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt index ce7962cbb..901b5f3e0 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt @@ -144,12 +144,12 @@ object UpdateChannel : BaseSettingsItem.Selector() { } override val title = R.string.settings_update_channel_title.asTransitive() - override val entries: Array = resources.getStringArray(R.array.update_channel).let { - if (BuildConfig.DEBUG) it.toMutableList().apply { add("Canary") }.toTypedArray() else it + override val entries: Array = resources.getStringArray(R.array.update_channel).apply { + if (BuildConfig.VERSION_CODE % 100 == 0) + toMutableList().apply { removeAt(Config.Value.CANARY_CHANNEL) }.toTypedArray() } override val description - get() = entries.getOrNull(value)?.asTransitive() - ?: TransitiveText.String(if (value == -1) entries[0] else "Canary") + get() = entries.getOrNull(value)?.asTransitive() ?: TransitiveText.String(entries[0]) } object UpdateChannelUrl : BaseSettingsItem.Input() { diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index ec16d6e45..73f6c4ac2 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -73,6 +73,7 @@ @string/settings_update_stable @string/settings_update_beta @string/settings_update_custom + Canary