Fix default channel shown in UI

This commit is contained in:
topjohnwu
2026-08-20 21:36:49 +00:00
committed by John Wu
parent 0675a18a3a
commit 5262ecdf82
3 changed files with 7 additions and 2 deletions
@@ -173,7 +173,7 @@ private fun AppSettingsSection() {
resources.getStringArray(CoreR.array.update_channel).toList()
}
var updateChannel by remember {
mutableIntStateOf(Config.updateChannel.coerceIn(0, updateChannelEntries.size - 1))
mutableIntStateOf(Config.updateChannelIndex)
}
var showUrlDialog by remember { mutableStateOf(false) }
@@ -143,7 +143,7 @@ object DownloadPath : BaseSettingsItem.Input() {
object UpdateChannel : BaseSettingsItem.Selector() {
override var value
get() = Config.updateChannel
get() = Config.updateChannelIndex
set(value) {
Config.updateChannel = value
Info.resetUpdate()
@@ -116,6 +116,11 @@ object Config : PreferenceConfig, DBConfig {
private var localePrefs by preference(Key.LOCALE, "")
var doh by preference(Key.DOH, false)
var updateChannel by preference(Key.RELEASE_CHANNEL, Value.DEFAULT_CHANNEL)
val updateChannelIndex get() = when (updateChannel) {
Value.DEFAULT_CHANNEL ->
if (BuildConfig.DEBUG) Value.DEBUG_CHANNEL else Value.STABLE_CHANNEL
else -> updateChannel
}
var customChannelUrl by preference(Key.CUSTOM_CHANNEL, "")
var downloadDir by preference(Key.DOWNLOAD_DIR, "")
var randName by preference(Key.RAND_NAME, true)