From d537f4e154a40075405b0ab2fed14fbe2eeaac81 Mon Sep 17 00:00:00 2001 From: cirakg Date: Tue, 20 Oct 2026 01:51:05 +0200 Subject: 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 --- source/app/AppState.mc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source/app/AppState.mc') 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; -- cgit v1.2.3