Add prompt before shutdown

pull/2969/head
Matija Tosic 2023-08-13 00:49:32 +02:00 committed by Matija Tošić
parent 53aaffab0b
commit 6414859eda
2 changed files with 15 additions and 5 deletions

View File

@ -1,5 +1,14 @@
g.clear();
E.showPrompt('Are you sure?', {
title: 'Power off',
buttons: { Yes: true, No: false },
}).then((confirm) => {
if (!confirm) {
setTimeout(load, 100);
return;
}
g.setFont("6x8",2).setFontAlign(0,0);
var x = g.getWidth()/2;
var y = g.getHeight()/2 + 10;
@ -8,6 +17,7 @@ g.setFont("6x8",2).setFontAlign(0,0);
setTimeout(function() {
if (Bangle.softOff) Bangle.softOff(); else Bangle.off();
}, 1000);
});
Bangle.loadWidgets();
Bangle.drawWidgets();

View File

@ -1,7 +1,7 @@
{ "id": "poweroff",
"name": "Poweroff",
"shortName":"Poweroff",
"version":"0.01",
"version":"0.02",
"description": "Simple app to power off your Bangle.js",
"icon": "app.png",
"tags": "tool, poweroff, shutdown",