diff options
| author | cirakg <cirakg@cirakg.xyz> | 2026-10-25 23:51:52 +0100 |
|---|---|---|
| committer | cirakg <cirakg@cirakg.xyz> | 2026-10-25 23:51:52 +0100 |
| commit | b8addc87f804789368612bf8e1be31a2bf28efe1 (patch) | |
| tree | bece4051eb6f009eba05ffdd585420232741a7d7 /source/settings | |
| parent | 140a6660f63f88d05ba9aae0bf1c4b401bb6574d (diff) | |
test(ui): second UI scenario, and the fixes it found
A second UI-test build (uitest-extra.jungle) covers the legacy PIN and
the forced new PIN, Change and Reset PIN, a queued Require PIN, UPC-A,
Code 39, the code error screen, the encoding progress, auto-lock on a
barcode, the light theme and the glance without a code; the main flow
adds the Steam and Library details and the menu's text screens.
Fixed from what it found: Entry IDs tripped the watchdog with 110
entries; auto-lock didn't close a locked barcode; a queued Require PIN
showed "Confirm in menu"; locked barcodes lacked the padlock; the PIN
keypad's bottom row, the Reset PIN question, text-screen bottoms, the
glance title and the light-theme warning colour.
Goldens approved on all seven watches; only the Forerunner 70 was
re-verified after the version bump.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'source/settings')
| -rw-r--r-- | source/settings/ChangeQueue.mc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/settings/ChangeQueue.mc b/source/settings/ChangeQueue.mc index c5919f6..5de74e0 100644 --- a/source/settings/ChangeQueue.mc +++ b/source/settings/ChangeQueue.mc @@ -27,6 +27,10 @@ module ChangeQueue { // all" that follows it (ChangeQueueJob). Replaced at every PIN. var _lockLines as Array<String> = [] as Array<String>; + // countToConfirm()'s cached result and the vault it is for. + var _toConfirm as Number? = null; + var _toConfirmFor as Vault? = null; + function count(vault as Vault) as Number { var stored = vault.storage().getValue(KEY); return stored instanceof Array ? stored.size() : 0; @@ -42,6 +46,7 @@ module ChangeQueue { var plain = action.toBytes(); items.add(SealedBox.seal(vault.keyManager.deviceKeys(), Bytes.fromUtf8(AAD), plain)); Bytes.wipe(plain); + changed(); try { vault.storage().setValue(KEY, items); } catch (e instanceof Lang.Exception) { @@ -84,6 +89,26 @@ module ChangeQueue { return out; } + // The number of waiting changes that need "Confirm all": all but + // "Require PIN", which applies at the next PIN by itself. For the list's + // title and the menu; cached until the queue changes, because the list + // asks at every draw and counting opens every item. + function countToConfirm(vault as Vault) as Number { + var n = _toConfirm; + if (n == null || _toConfirmFor != vault) { + var total = count(vault); + n = total > 0 ? total - countLocks(vault) : 0; + _toConfirm = n; + _toConfirmFor = vault; + } + return n; + } + + // The queue changed: count again next time. + function changed() as Void { + _toConfirm = null; + } + // The number of waiting "Require PIN" actions (applied at the next PIN). function countLocks(vault as Vault) as Number { var actions = load(vault); @@ -104,6 +129,7 @@ module ChangeQueue { // already locked) is dropped too. function applyLocks(vault as Vault) as Void { _lockLines = [] as Array<String>; + changed(); var stored = vault.storage().getValue(KEY); if (!(stored instanceof Array) || !vault.session.isUnlocked()) { return; @@ -127,6 +153,7 @@ module ChangeQueue { kept.add(box as Application.Storage.ValueType); // damaged items are dropped by the next clear() } } + Diag.data("locks_applied", "count=" + _lockLines.size()); // for UI scripts: no names if (kept.size() == stored.size()) { return; } @@ -150,12 +177,14 @@ module ChangeQueue { } function clear(vault as Vault) as Void { + changed(); vault.storage().deleteValue(KEY); } // Remove the first n items (the ones just applied), keeping any that // arrived from the phone meanwhile. function drop(vault as Vault, n as Number) as Void { + changed(); var stored = vault.storage().getValue(KEY); if (!(stored instanceof Array) || stored.size() <= n) { clear(vault); |
