diff options
| author | cirakg <cirakg@cirakg.xyz> | 2026-10-20 18:36:54 +0200 |
|---|---|---|
| committer | cirakg <cirakg@cirakg.xyz> | 2026-10-20 18:36:54 +0200 |
| commit | 151bfda5d4c567ff909a61dc9c90bf8eece1db37 (patch) | |
| tree | f8487b91cf6a9ce59dba02e95e67250fc84d8e80 /source/app/AppState.mc | |
| parent | 25910f3a7a7fb28c4a58367b6e56dd2468b60933 (diff) | |
feat(settings): add the Add OTP, Add code and Manage entry forms with a PIN queue for locked entries
The full phone settings form (README 10.2) and its processing (10.3) as one
resumable job: Import, Add OTP, Add code, Manage, then the About fields.
Forms are applied only when their switch is on, cleared afterwards (secret
first; only the secret after a problem), deduplicated by keyed hash, and
report into their Result field and the results screen.
- Add OTP validates per README 10.4; Add code runs the real encoder
(CodeCheck, a job for 2D codes) and caches 2D codes on the way in.
- Manage entry: edit, move, require/drop PIN, replace, counter, delete.
Changes to locked entries are sealed under "q" and applied only after
the PIN is entered under "Phone changes" in the menu.
- About: catalog (800 characters max), version, storage use.
- "Encrypt names" now applies to new and existing entries.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'source/app/AppState.mc')
| -rw-r--r-- | source/app/AppState.mc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source/app/AppState.mc b/source/app/AppState.mc index b900943..fb56689 100644 --- a/source/app/AppState.mc +++ b/source/app/AppState.mc @@ -7,6 +7,7 @@ import Toybox.Application; import Toybox.Lang; import Toybox.Time; +import Toybox.WatchUi; module AppState { @@ -33,8 +34,7 @@ module AppState { } try { var v = new Vault(new Persist.AppStorageBackend(), new TimeSource()); - v.eraseAfterFailures = options.eraseAfterFailures; - v.session.autoLockMs = TestMode.ON ? TestMode.AUTO_LOCK_MS : options.autoLockMs; + applyOptions(v); vault = v; codes = new CodeCache(v); processor = new SettingsProcessor(); @@ -88,10 +88,18 @@ module AppState { options.load(); var v = vault; if (v != null) { - v.eraseAfterFailures = options.eraseAfterFailures; - v.session.autoLockMs = TestMode.ON ? TestMode.AUTO_LOCK_MS : options.autoLockMs; + applyOptions(v); processSettings(); } + // Theme, code size and groups are read at every draw. + WatchUi.requestUpdate(); + } + + // The options the vault itself uses. + function applyOptions(v as Vault) as Void { + v.eraseAfterFailures = options.eraseAfterFailures; + v.encryptNames = options.encryptNames; + v.session.autoLockMs = TestMode.ON ? TestMode.AUTO_LOCK_MS : options.autoLockMs; } // Apply any settings form that asks for it (after start-up and on change). |
