Skip to content

Commit bf55d3a

Browse files
author
Rob
committed
fix(telegram): persist healed in-place editing state to disk
The in-memory migration fixed refreshInPlaceEnabled=true but never persisted to disk. This caused the migration to re-run on every app load, and meant the healed state was lost on app restart. Now: if any destination has settingsVersion==1 (PR #45 marker), we re-save immediately after load. This persists the healing permanently and prevents the migration from re-running indefinitely.
1 parent 013b466 commit bf55d3a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Common/src/main/java/tk/glucodata/OutboundApiSettings.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,16 @@ object OutboundApiSettings {
243243
if (!stored.isNullOrBlank()) {
244244
val enabled = prefs.getBoolean(KEY_ENABLED, true)
245245
val destinations = runCatching { decodeDestinations(stored) }.getOrDefault(emptyList())
246-
return Config(
246+
val config = Config(
247247
enabled = true,
248248
destinations = if (enabled) destinations else destinations.map { it.copy(enabled = false) }
249249
)
250+
// If any destination has settingsVersion==1, it came from PR #45's broken migration.
251+
// Re-save to persist the in-memory healing and prevent the migration from re-running every load.
252+
if (destinations.any { it.settingsVersion == 1 }) {
253+
save(context, config)
254+
}
255+
return config
250256
}
251257

252258
val migrated = migrateLegacy(context)

0 commit comments

Comments
 (0)