summaryrefslogtreecommitdiff
path: root/source/ui/Nav.mc
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-25 12:46:42 +0100
committercirakg <cirakg@cirakg.xyz>2026-10-25 12:46:42 +0100
commit096b5a4d17c85fa5f87db3e72364e9c3506d1e64 (patch)
tree9846544fe7d76d849df4a1ee2058f4847f674e7e /source/ui/Nav.mc
parente0384274bbeab999279bdc35bdddbd8a3a451aeb (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'source/ui/Nav.mc')
-rw-r--r--source/ui/Nav.mc20
1 files changed, 19 insertions, 1 deletions
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) {