From 096b5a4d17c85fa5f87db3e72364e9c3506d1e64 Mon Sep 17 00:00:00 2001 From: cirakg Date: Sun, 25 Oct 2026 12:46:42 +0100 Subject: feat(pin): exactly 4 digits, entered on the 4th digit The keypad has no OK key; the 4th digit submits, so a tap that also arrives as START can no longer submit a partial PIN (the likely cause of "Wrong PIN" before the code opened). PINs set by earlier versions still unlock and are then replaced by a 4-digit one. Opening an entry ignores a second request from the same tap. A Require PIN sent from the phone while the watch is locked now applies at the next PIN instead of waiting for Confirm all. The linter skips .claude. Co-Authored-By: Claude Opus 5.5 --- source/ui/Nav.mc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source/ui/Nav.mc') diff --git a/source/ui/Nav.mc b/source/ui/Nav.mc index 222386a..af08d4a 100644 --- a/source/ui/Nav.mc +++ b/source/ui/Nav.mc @@ -2,13 +2,31 @@ // Summary: Navigation between screens (README 13.2): opening entries, asking for the PIN first when needed, the menu. import Toybox.Lang; +import Toybox.System; import Toybox.WatchUi; module Nav { + // A second open request within this time is the same tap delivered + // twice (as START in onKey and as onTap) and is ignored. + const OPEN_DEBOUNCE_MS = 500; + var _lastOpenMs as Number? = null; + // Open an entry from the list: its detail screen, or the PIN screen first - // when it is locked and the session is locked. + // when it is locked and the session is locked. Ignored while a PIN or + // detail screen is already on top, or right after another open, so one + // tap can't push two screens. function openEntry(id as String) as Void { + var top = WatchUi.getCurrentView()[0]; + if (top instanceof PinView || top instanceof OtpView || top instanceof CodeView) { + return; + } + var now = System.getTimer(); + var last = _lastOpenMs; + if (last != null && now - last >= 0 && now - last < OPEN_DEBOUNCE_MS) { + return; + } + _lastOpenMs = now; var vault = AppState.theVault(); var header = vault.header(id); if (header == null) { -- cgit v1.2.3