aboutsummaryrefslogtreecommitdiff
path: root/source/app/AppState.mc
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-20 01:51:05 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-20 01:51:05 +0200
commitd537f4e154a40075405b0ab2fed14fbe2eeaac81 (patch)
treef1fb9b148871901dda96fca11401d6f4d0ee1d59 /source/app/AppState.mc
parent40d9a1d5c3e85486aea964c1446402a3be6ec05a (diff)
feat(settings): apply the Import form from the phone and show results
Import group in the app settings; the processor runs after the first frame and on settings changes, clears the fields, writes the status, remembers form hashes and opens the results screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'source/app/AppState.mc')
-rw-r--r--source/app/AppState.mc21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/app/AppState.mc b/source/app/AppState.mc
index 05656e2..b900943 100644
--- a/source/app/AppState.mc
+++ b/source/app/AppState.mc
@@ -16,6 +16,7 @@ module AppState {
var options as Options = new Options();
var vault as Vault? = null;
var codes as CodeCache? = null;
+ var processor as SettingsProcessor? = null;
// A message that replaces the whole app (newer data, damaged metadata,
// failed self-test), or null.
var startError as String? = null;
@@ -36,6 +37,7 @@ module AppState {
v.session.autoLockMs = TestMode.ON ? TestMode.AUTO_LOCK_MS : options.autoLockMs;
vault = v;
codes = new CodeCache(v);
+ processor = new SettingsProcessor();
if (TestMode.ON) {
Fixtures.load(v);
}
@@ -81,6 +83,25 @@ module AppState {
return true;
}
+ // The phone changed the settings: reload the options and apply forms.
+ function settingsChanged() as Void {
+ options.load();
+ var v = vault;
+ if (v != null) {
+ v.eraseAfterFailures = options.eraseAfterFailures;
+ v.session.autoLockMs = TestMode.ON ? TestMode.AUTO_LOCK_MS : options.autoLockMs;
+ processSettings();
+ }
+ }
+
+ // Apply any settings form that asks for it (after start-up and on change).
+ function processSettings() as Void {
+ var p = processor;
+ if (p != null && cryptoReady) {
+ p.start();
+ }
+ }
+
// Note user activity (restarts the auto-lock timeout).
function activity() as Void {
var v = vault;