diff options
Diffstat (limited to 'source/app/AppState.mc')
| -rw-r--r-- | source/app/AppState.mc | 21 |
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; |
