mirror of https://github.com/espruino/BangleApps
widbt_notify: Added "connection restored" notification. Fixed restoring of the watchface.
parent
088cd53b9c
commit
c99a0de9a9
|
@ -9,3 +9,4 @@
|
||||||
0.10: Bug fix
|
0.10: Bug fix
|
||||||
0.11: Avoid too many notifications. Change disconnected colour to red.
|
0.11: Avoid too many notifications. Change disconnected colour to red.
|
||||||
0.12: Prevent repeated execution of `draw()` from the current app.
|
0.12: Prevent repeated execution of `draw()` from the current app.
|
||||||
|
0.13: Added "connection restored" notification. Fixed restoring of the watchface.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "widbt_notify",
|
"id": "widbt_notify",
|
||||||
"name": "Bluetooth Widget with Notification",
|
"name": "Bluetooth Widget with Notification",
|
||||||
"version": "0.12",
|
"version": "0.13",
|
||||||
"description": "Show the current Bluetooth connection status in the top right of the clock and vibrate when disconnected.",
|
"description": "Show the current Bluetooth connection status in the top right of the clock and vibrate when disconnected.",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
@ -15,13 +15,28 @@ WIDGETS.bluetooth_notify = {
|
||||||
|
|
||||||
redrawCurrentApp: function(){
|
redrawCurrentApp: function(){
|
||||||
if(typeof(draw)=='function'){
|
if(typeof(draw)=='function'){
|
||||||
|
g.clear();
|
||||||
draw();
|
draw();
|
||||||
|
Bangle.loadWidgets();
|
||||||
|
Bangle.drawWidgets();
|
||||||
}else{
|
}else{
|
||||||
load(); // fallback. This might reset some variables
|
load(); // fallback. This might reset some variables
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
connect: function() {
|
connect: function() {
|
||||||
|
if(WIDGETS.bluetooth_notify.warningEnabled == 1){
|
||||||
|
E.showMessage(/*LANG*/'Connection\n restored.', 'Bluetooth');
|
||||||
|
setTimeout(()=>{WIDGETS.bluetooth_notify.redrawCurrentApp();}, 3000); // clear message - this will reload the widget, resetting 'warningEnabled'.
|
||||||
|
|
||||||
|
WIDGETS.bluetooth_notify.warningEnabled = 0;
|
||||||
|
setTimeout('WIDGETS.bluetooth_notify.warningEnabled = 1;', 30000); // don't buzz for the next 30 seconds.
|
||||||
|
|
||||||
|
var quiet = (require('Storage').readJSON('setting.json',1)||{}).quiet;
|
||||||
|
if(!quiet){
|
||||||
|
Bangle.buzz(700, 1); // buzz on connection loss
|
||||||
|
}
|
||||||
|
}
|
||||||
WIDGETS.bluetooth_notify.draw();
|
WIDGETS.bluetooth_notify.draw();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue