[Settings] Improve "Turn Off" user experience

- User must confirm
- Show a goodbye message
- Clear the screen
pull/1901/head
Alessandro Cocco 2022-05-02 23:15:06 +02:00
parent ac5c80ff38
commit f01dd23bab
3 changed files with 21 additions and 2 deletions

View File

@ -50,3 +50,4 @@
UI improvements to Locale and Date & Time menu
0.45: Add calibrate battery option
0.46: Fix regression after making 'calibrate battery' only for Bangle.js 2
0.47: Improve "Turn Off" user experience

View File

@ -1,7 +1,7 @@
{
"id": "setting",
"name": "Settings",
"version": "0.46",
"version": "0.47",
"description": "A menu for setting up Bangle.js",
"icon": "settings.png",
"tags": "tool,system",

View File

@ -569,7 +569,25 @@ function showUtilMenu() {
} else showUtilMenu();
});
};
menu[/*LANG*/'Turn Off'] = ()=>{ if (Bangle.softOff) Bangle.softOff(); else Bangle.off() };
menu[/*LANG*/"Turn Off"] = () => {
E.showPrompt(/*LANG*/"Are you sure? Alarms and timers won't fire", {
title:/*LANG*/"Turn Off"
}).then((confirmed) => {
if (confirmed) {
E.showMessage(/*LANG*/"See you\nlater!", /*LANG*/"Goodbye");
setTimeout(() => {
// clear the screen so when the user will turn on the watch they'll see
// an empty screen instead of the latest displayed screen
E.showMessage();
g.clear(true);
Bangle.softOff ? Bangle.softOff() : Bangle.off();
}, 2500);
} else {
showUtilMenu();
}
});
};
if (Bangle.factoryReset) {
menu[/*LANG*/'Factory Reset'] = ()=>{