Commit Graph
3 Commits
Author SHA1 Message Date
IsilsolmeandClaude Opus 4.8 947dbbfff1 Sort imports in PrefDelegate.kt
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 20:52:05 +08:00
IsilsolmeandClaude Opus 4.8 6ebe36dec9 Refine: make synchronous pref writes opt-in via sync parameter
Only use commit() (sync disk write) for preferences that opt in with
sync=true. The language preference in OtherConfig is currently the only
one that needs this — it triggers an immediate process restart via
context.restart().

Other string preferences continue using apply() (async) to avoid
unnecessary main-thread blocking.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 19:51:35 +08:00
IsilsolmeandClaude Opus 4.8 59468d1bc2 Fix language preference not persisting after app restart
Use commit() instead of apply() for String preference writes to ensure
the value is written to disk synchronously before the process is killed
during restart().

Root cause: SharedPreferences.apply() writes to memory immediately but
commits to disk asynchronously. When context.restart() calls
Process.killProcess()+exitProcess(0) immediately after writing the
language preference, the async disk write may not complete, causing the
new process to read the old value.

Closes #862

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 19:45:11 +08:00