-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Hello,
My goal is to be able to press the physical button to end an alarm.
My use-case is that I often wake up before my alarm, so I have a buzzing watch on my wrist while driving to work and I don't want to navigate with the touchscreen while driving to silence it.
Plan is to add a function called E.showPromptBtnCancel
in apps/sched/sched.js
. From looking at the code, this is the function that runs when an alarm is called. I am modifying it according to this doc.
I am running into multiple issues:
How do I modifyE.showPrompt
to treatBTN1
the same way as cancel?
a. I see this logic:Bangle.setUI({mode: "leftright", remove: options.remove, redraw:draw, back:options.back}, dir=>{
, but I cannot find the definition ofleftright
or whatdir
returns in the References. My hope is thatBTN1
is also a callback coming fromleftright
, but I want to make sure.I am unit-testingE.showPromptBtnCancel
in a simple app here and whenever I run this code on my watch, it hangs on a loading screen forever and a reset of the watch is needed. I tested this code on the Web IDE emulator and got no issues. Is there something I'm doing wrong when moving from Simulating to testing on hardware?When copying the defaultshowPrompt
logic, it always returns that I pressed the first option. The snippet below is how I callshowPrompt
in my testing. I first use the default function andStop pressed
prints when I pressStop
. But when I copy the default logic, the screen appears the same, butSnooze Pressed
diplays when I pressStop
. Is the default function I'm referencing in the repo up-to-date?
E.showPrompt("the", Also, { if there is a forum or Discord that I can join, please let me know!
title: "ALARM!",
buttons: { /*LANG*/"Snooze": true, /*LANG*/"Stop": false }
}).then(ok => {
if (ok) print("snooze pressed");
else print("stop pressed");
});
Edit: I found my mistake on items 2 and 3; in the modifications doc, it notes that _Q3
is used for Bangle.js 2, so I was supposed to be using this as my default.
Edit2: I got item 1 working how I want. Here's how.
Please let me know if there's anything I'm misunderstanding or if there are resources I missed.
Also, if there is a forum or Discord that I can join, please let me know!