summaryrefslogtreecommitdiff
path: root/source/util
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-21 03:55:10 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-21 03:55:10 +0200
commit5e8ac1e2f5a660e55ea132996e1d5730cfa4fa64 (patch)
tree9bb99bdca1ef8f33c93c5100816448681329d810 /source/util
parent88f1cac4fa530fc30fd6ef01970af11c7a959b8e (diff)
feat(glance): show the favourite code in the glance (opt-in)
With "Show the favourite code in the glance" on, the glance shows the code of the first favourite TOTP or Steam entry without the PIN, with a countdown bar. The glance can't open the vault, so the About scan seals that entry under "g" (device key, aad OTPW-GL-1) after every change, and removes it when the option is off or no entry qualifies; the glance also reads the option itself. HKDF moves to its own module so the glance loads only the crypto it needs (37 % of its 64 KB). Manage entry gains "Mark as favourite (glance)" and "Remove favourite", queued for locked entries like the other changes. Lines are inset on round screens so the Instinct 3's curved glance corner doesn't cut them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'source/util')
-rw-r--r--source/util/Bytes.mc2
-rw-r--r--source/util/Clock.mc2
-rw-r--r--source/util/Diag.mc12
-rw-r--r--source/util/TestMode.mc4
4 files changed, 18 insertions, 2 deletions
diff --git a/source/util/Bytes.mc b/source/util/Bytes.mc
index a32475a..aa5a28b 100644
--- a/source/util/Bytes.mc
+++ b/source/util/Bytes.mc
@@ -11,6 +11,8 @@
import Toybox.Lang;
import Toybox.StringUtil;
+// (:glance): also loaded by the glance, which shows the favourite code (GlanceCode).
+(:glance)
module Bytes {
// Hex text (any case, even length) to bytes. Empty text gives an empty array.
diff --git a/source/util/Clock.mc b/source/util/Clock.mc
index 44a0e37..6657224 100644
--- a/source/util/Clock.mc
+++ b/source/util/Clock.mc
@@ -10,6 +10,8 @@
import Toybox.Lang;
import Toybox.Time;
+// (:glance): also loaded by the glance, which shows the favourite code (GlanceCode).
+(:glance)
module Clock {
const TWO_POW_32 = 4294967296l;
diff --git a/source/util/Diag.mc b/source/util/Diag.mc
index 0ab121f..8fba19d 100644
--- a/source/util/Diag.mc
+++ b/source/util/Diag.mc
@@ -56,6 +56,18 @@ module Diag {
function firstFrame() as Void {
}
+ // The glance's memory after its first draw (README 18: at most 70 % of
+ // the glance's 64 KB; `make memtest` checks it).
+ (:debug)
+ function glanceMemory() as Void {
+ var stats = System.getSystemStats();
+ System.println("DIAG glance mem_used=" + stats.usedMemory + " mem_total=" + stats.totalMemory);
+ }
+
+ (:release)
+ function glanceMemory() as Void {
+ }
+
// A screen finished its first draw since it was shown.
(:debug)
function shown(screen as String) as Void {
diff --git a/source/util/TestMode.mc b/source/util/TestMode.mc
index 9b5c36f..e583ecf 100644
--- a/source/util/TestMode.mc
+++ b/source/util/TestMode.mc
@@ -13,7 +13,7 @@
import Toybox.Lang;
-(:uitest)
+(:uitest, :glance)
module TestMode {
const ON = true;
// 2027-01-15 08:00:26 UTC: 4 s left in a 30 s period, so the detail
@@ -22,7 +22,7 @@ module TestMode {
const AUTO_LOCK_MS = 10000;
}
-(:no_uitest)
+(:no_uitest, :glance)
module TestMode {
const ON = false;
const NOW = 0l;