diff --git a/apps/widbt_notify/ChangeLog b/apps/widbt_notify/ChangeLog index 3708089c1..7214407bb 100644 --- a/apps/widbt_notify/ChangeLog +++ b/apps/widbt_notify/ChangeLog @@ -9,3 +9,4 @@ 0.10: Bug fix 0.11: Avoid too many notifications. Change disconnected colour to red. 0.12: Prevent repeated execution of `draw()` from the current app. +0.13: Added "connection restored" notification. Fixed restoring of the watchface. diff --git a/apps/widbt_notify/metadata.json b/apps/widbt_notify/metadata.json index 0a144ade1..bab4a777c 100644 --- a/apps/widbt_notify/metadata.json +++ b/apps/widbt_notify/metadata.json @@ -1,7 +1,7 @@ { "id": "widbt_notify", "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.", "icon": "widget.png", "type": "widget", diff --git a/apps/widbt_notify/widget.js b/apps/widbt_notify/widget.js index fd088c670..517ab5965 100644 --- a/apps/widbt_notify/widget.js +++ b/apps/widbt_notify/widget.js @@ -15,13 +15,28 @@ WIDGETS.bluetooth_notify = { redrawCurrentApp: function(){ if(typeof(draw)=='function'){ + g.clear(); draw(); + Bangle.loadWidgets(); + Bangle.drawWidgets(); }else{ load(); // fallback. This might reset some variables } }, 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(); },