From 35042ff04ffc50e55ff59a385849442be4429d6b Mon Sep 17 00:00:00 2001 From: cirakg Date: Mon, 19 Oct 2026 22:28:09 +0200 Subject: feat(ui): add the list, OTP detail, PIN entry, menu, info screens and glance List with live codes and countdowns, adaptive rows and lazy headers; OTP detail with ring or bar, next code and HOTP next; PIN keypad or button selector with create, unlock, change, lockout display and pending promotion; native menu; glance with the entry count; self-test after the first frame; option properties with defaults. Codes are computed one per timer event, apart from drawing, for the watchdog. A UI-test build (uitest.jungle) starts with fake entries, PIN 123456 and a frozen clock. Co-Authored-By: Claude Opus 5.5 --- source/ui/GlanceView.mc | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 source/ui/GlanceView.mc (limited to 'source/ui/GlanceView.mc') diff --git a/source/ui/GlanceView.mc b/source/ui/GlanceView.mc new file mode 100644 index 0000000..a7207ce --- /dev/null +++ b/source/ui/GlanceView.mc @@ -0,0 +1,37 @@ +// Author: cirakg & claude ai +// Summary: The glance (widget-list preview): app name and number of entries. +// +// Glances run with very little memory, so this reads only the entry index +// from storage and opens no vault and no keys. The opt-in favourite code +// (README 13.1) comes with M8. + +import Toybox.Application; +import Toybox.Graphics; +import Toybox.Lang; +import Toybox.WatchUi; + +(:glance) +class OtpGlanceView extends WatchUi.GlanceView { + + function initialize() { + GlanceView.initialize(); + } + + function onUpdate(dc as Graphics.Dc) as Void { + var count = 0; + var meta = Application.Storage.getValue("m"); + if (meta instanceof Dictionary) { + var ids = meta["ids"]; + if (ids instanceof Array) { + count = ids.size(); + } + } + var h = dc.getHeight(); + dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT); + dc.drawText(0, h / 2 - dc.getFontHeight(Graphics.FONT_GLANCE), Graphics.FONT_GLANCE, "OTP WALLET", Graphics.TEXT_JUSTIFY_LEFT); + dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT); + dc.drawText(0, h / 2, Graphics.FONT_GLANCE, count == 1 ? "1 entry" : count + " entries", Graphics.TEXT_JUSTIFY_LEFT); + // The simulator starts in the glance; launch scripts open the app from it. + Diag.shown("glance"); + } +} -- cgit v1.2.3