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/ui/PinView.mc | |
| 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/ui/PinView.mc')
| -rw-r--r-- | source/ui/PinView.mc | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/source/ui/PinView.mc b/source/ui/PinView.mc index fa58bfe..47b12fd 100644 --- a/source/ui/PinView.mc +++ b/source/ui/PinView.mc @@ -4,7 +4,8 @@ // README 13.1 and 13.4: // * A PIN has exactly 4 digits (KeyManager.PIN_DIGITS) and is submitted // as soon as the 4th is entered; there is no OK key. -// * Touch screens get a keypad (1-9, delete, 0). The START button does +// * Touch screens get a keypad (1-9, then 0 and delete in the bottom row, +// delete on the right as on phone keypads). The START button does // nothing there: a tap can also arrive as START, which used to submit a // PIN early. Watches without a touch screen get a digit selector: // UP/DOWN change the digit, START adds it, BACK deletes. @@ -32,9 +33,11 @@ class PinView extends WatchUi.View { // Selector positions 0-9 are digits; this one is "OK" (legacy PINs only). static const SELECT_OK = 10; - // Keypad keys besides the digits (OK for legacy PINs only). + // Keypad keys besides the digits (OK for legacy PINs only), and an + // empty slot. static const KEY_DELETE = -1; static const KEY_OK = -2; + static const KEY_NONE = -3; // Calibrate the PIN derivation to about this long on this watch. static const DERIVATION_TARGET_MS = 1000; static const CALIBRATION_SAMPLE = 200; @@ -358,7 +361,7 @@ class PinView extends WatchUi.View { var message = wait > 0 ? "Wrong PINs. Wait " + Ui.minutesSeconds(wait) : _message; if (message != null) { - dc.setColor(_messageIsError || wait > 0 ? Ui.WARN_COLOR : Ui.accent(), Graphics.COLOR_TRANSPARENT); + dc.setColor(_messageIsError || wait > 0 ? Ui.warn() : Ui.accent(), Graphics.COLOR_TRANSPARENT); dc.drawText(cx, y, Graphics.FONT_XTINY, Ui.fit(dc, message, Graphics.FONT_XTINY, 2 * Ui.halfWidthAt(dc, y)), Graphics.TEXT_JUSTIFY_CENTER); } @@ -372,6 +375,9 @@ class PinView extends WatchUi.View { if (!_shownLogged) { _shownLogged = true; + // For UI scripts: the state the dots and the title show (never digits). + Diag.data("pin_state", "mode=" + mode + " digits=" + _digits.size() + " repeat=" + (_first != null ? 1 : 0) + + " busy=" + (busy ? 1 : 0)); Diag.shown(wait > 0 ? "pin_wait" : (_message != null && _messageIsError ? "pin_error" : "pin")); } } @@ -394,19 +400,21 @@ class PinView extends WatchUi.View { keyW = keyH * 2; } var left = w / 2 - 3 * keyW / 2; - var labels = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "", "0", "OK"]; - var values = [1, 2, 3, 4, 5, 6, 7, 8, 9, KEY_DELETE, 0, KEY_OK]; + // A legacy PIN needs OK: delete, 0, OK. Otherwise the 4th digit + // submits, and the bottom row is an empty slot, 0 and delete. + var values = legacy ? [1, 2, 3, 4, 5, 6, 7, 8, 9, KEY_DELETE, 0, KEY_OK] + : [1, 2, 3, 4, 5, 6, 7, 8, 9, KEY_NONE, 0, KEY_DELETE]; var font = Graphics.FONT_MEDIUM; _keys = [] as Array<Array<Number>>; var log = ""; for (var i = 0; i < 12; i++) { - if (values[i] == KEY_OK && !legacy) { - continue; // no OK key: the 4th digit submits; the slot stays empty + if (values[i] == KEY_NONE) { + continue; } var kx = left + (i % 3) * keyW; var ky = top + (i / 3) * keyH; _keys.add([kx, ky, keyW, keyH, values[i] as Number]); - var label = labels[i] as String; + var label = values[i] == KEY_OK ? "OK" : (values[i] as Number).toString(); var isAction = (values[i] as Number) < 0; dc.setColor(disabled ? (Ui.dark() ? 0x444444 : Graphics.COLOR_LT_GRAY) : (isAction ? Ui.accent() : Ui.fg()), Graphics.COLOR_TRANSPARENT); @@ -416,7 +424,7 @@ class PinView extends WatchUi.View { var f = isAction ? Graphics.FONT_SMALL : font; dc.drawText(kx + keyW / 2, ky + (keyH - dc.getFontHeight(f)) / 2, f, label, Graphics.TEXT_JUSTIFY_CENTER); } - log += (i > 0 ? ";" : "") + (values[i] as Number) + "=" + (kx + keyW / 2) + "," + (ky + keyH / 2); + log += (log.length() > 0 ? ";" : "") + (values[i] as Number) + "=" + (kx + keyW / 2) + "," + (ky + keyH / 2); } if (!_shownLogged) { Diag.data("pin_keys", log); @@ -444,7 +452,10 @@ class PinView extends WatchUi.View { private function drawSelector(dc as Graphics.Dc, top as Number, bottom as Number, disabled as Boolean) as Void { var cx = dc.getWidth() / 2; - var mid = (top + bottom) / 2; + // Centred above the hint, so the lower arrow never touches it (it + // did on the Forerunner 255S). + var hintTop = bottom - dc.getFontHeight(Graphics.FONT_XTINY); + var mid = (top + hintTop) / 2; var font = Graphics.FONT_NUMBER_MEDIUM; var label = _selector == SELECT_OK ? "OK" : _selector.toString(); if (_selector == SELECT_OK) { @@ -458,7 +469,7 @@ class PinView extends WatchUi.View { dc.fillPolygon([[cx - 8, mid + a], [cx + 8, mid + a], [cx, mid + a + 8]] as Array<Graphics.Point2D>); dc.setColor(Ui.dim(), Graphics.COLOR_TRANSPARENT); var hint = "START: add"; - dc.drawText(cx, bottom - dc.getFontHeight(Graphics.FONT_XTINY), Graphics.FONT_XTINY, + dc.drawText(cx, hintTop, Graphics.FONT_XTINY, Ui.fit(dc, hint, Graphics.FONT_XTINY, 2 * Ui.halfWidthAt(dc, bottom)), Graphics.TEXT_JUSTIFY_CENTER); } } |
