Commit 860a05ab authored by vvb2060's avatar vvb2060 Committed by John Wu

Simplify UpdateChannel

parent 8bb2f356
...@@ -144,12 +144,12 @@ object UpdateChannel : BaseSettingsItem.Selector() { ...@@ -144,12 +144,12 @@ object UpdateChannel : BaseSettingsItem.Selector() {
} }
override val title = R.string.settings_update_channel_title.asTransitive() override val title = R.string.settings_update_channel_title.asTransitive()
override val entries: Array<String> = resources.getStringArray(R.array.update_channel).let { override val entries: Array<String> = resources.getStringArray(R.array.update_channel).apply {
if (BuildConfig.DEBUG) it.toMutableList().apply { add("Canary") }.toTypedArray() else it if (BuildConfig.VERSION_CODE % 100 == 0)
toMutableList().apply { removeAt(Config.Value.CANARY_CHANNEL) }.toTypedArray()
} }
override val description override val description
get() = entries.getOrNull(value)?.asTransitive() get() = entries.getOrNull(value)?.asTransitive() ?: TransitiveText.String(entries[0])
?: TransitiveText.String(if (value == -1) entries[0] else "Canary")
} }
object UpdateChannelUrl : BaseSettingsItem.Input() { object UpdateChannelUrl : BaseSettingsItem.Input() {
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<item>@string/settings_update_stable</item> <item>@string/settings_update_stable</item>
<item>@string/settings_update_beta</item> <item>@string/settings_update_beta</item>
<item>@string/settings_update_custom</item> <item>@string/settings_update_custom</item>
<item>Canary</item>
</string-array> </string-array>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment