fix(settings): force custom-source toggles off when legacy example.com URL present
Old installs that once enabled the custom TLE/transceiver toggles kept the legacy "https://example.com/tle.txt" placeholder in preferences. Under the new "toggle replaces the online-update default source" semantics this pointed the All/SatNOGS fetch at a dead URL and broke satellite updates after upgrading to 4.4.8. Migration in getDataSourcesSettings(): example.com placeholders are replaced by the real default URLs (Celestrak All / SatNOGS) and the toggles are forced OFF unless a non-default, real user URL is set. Also disable the reset (loop) icon buttons while their toggle is off. Verified: core:data tests pass, settings + app compile. Version stays 4.4.8 (覆盖 per user).
This commit is contained in:
1 parent
50233cadc1
commit
9a4ceddcb0
2 files changed
+22
-8
No files matched your search
@@ -391,12 +391,20 @@ class SettingsRepo(
|
||||
_dataSourcesSettings.value = settings
|
||||
}
|
||||
|
||||
private fun getDataSourcesSettings(): DataSourcesSettings = DataSourcesSettings(
|
||||
useCustomTLE = preferences.getBoolean(keyUseCustomTle, false),
|
||||
useCustomTransceivers = preferences.getBoolean(keyUseCustomTransceivers, false),
|
||||
tleUrl = preferences.getString(keyTleUrl, Sources.defaultTleUrl) ?: "",
|
||||
transceiversUrl = preferences.getString(keyTransceiversUrl, Sources.defaultTransceiversUrl) ?: ""
|
||||
)
|
||||
private fun getDataSourcesSettings(): DataSourcesSettings {
|
||||
// 4.4.8 修复: 旧版 example.com 占位 URL 视为未配置 -> 替换为真实默认 URL 且开关强制关闭,
|
||||
// 否则在线更新的 All/SatNOGS 源会指向错误地址导致更新失败
|
||||
val storedTleUrl = preferences.getString(keyTleUrl, Sources.defaultTleUrl) ?: Sources.defaultTleUrl
|
||||
val storedTxUrl = preferences.getString(keyTransceiversUrl, Sources.defaultTransceiversUrl) ?: Sources.defaultTransceiversUrl
|
||||
val tleUrl = if (storedTleUrl == "https://example.com/tle.txt") Sources.defaultTleUrl else storedTleUrl
|
||||
val txUrl = if (storedTxUrl == "https://example.com/radio.json") Sources.defaultTransceiversUrl else storedTxUrl
|
||||
return DataSourcesSettings(
|
||||
useCustomTLE = preferences.getBoolean(keyUseCustomTle, false) && tleUrl != Sources.defaultTleUrl,
|
||||
useCustomTransceivers = preferences.getBoolean(keyUseCustomTransceivers, false) && txUrl != Sources.defaultTransceiversUrl,
|
||||
tleUrl = tleUrl,
|
||||
transceiversUrl = txUrl
|
||||
)
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region # Radio control settings
|
||||
|
||||
+8
-2
@@ -208,7 +208,10 @@ fun DataSourcesDialog(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
enabled = isEnabledCustomTle.value,
|
||||
trailingIcon = {
|
||||
IconButton(onClick = { urlTle.value = Sources.defaultTleUrl }) {
|
||||
IconButton(
|
||||
onClick = { urlTle.value = Sources.defaultTleUrl },
|
||||
enabled = isEnabledCustomTle.value
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_reset),
|
||||
contentDescription = stringResource(id = R.string.prefs_data_reset_url)
|
||||
@@ -245,7 +248,10 @@ fun DataSourcesDialog(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
enabled = isEnabledCustomTransceivers.value,
|
||||
trailingIcon = {
|
||||
IconButton(onClick = { urlTransceivers.value = Sources.defaultTransceiversUrl }) {
|
||||
IconButton(
|
||||
onClick = { urlTransceivers.value = Sources.defaultTransceiversUrl },
|
||||
enabled = isEnabledCustomTransceivers.value
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_reset),
|
||||
contentDescription = stringResource(id = R.string.prefs_data_reset_url)
|
||||
|
||||
Reference in new issue
Block a user