From 5254f20bb660d0ae2737ad720c1b9dbb5d18beed Mon Sep 17 00:00:00 2001 From: KungPhoo Date: Wed, 30 Mar 2022 17:43:46 +0200 Subject: [PATCH] Redrawing the current clock, if a 'draw()' function exists. --- apps/widbt_notify/widget.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/widbt_notify/widget.js b/apps/widbt_notify/widget.js index d6bad5dc9..0c0a53bba 100644 --- a/apps/widbt_notify/widget.js +++ b/apps/widbt_notify/widget.js @@ -12,16 +12,26 @@ WIDGETS.bluetooth_notify = { } g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="), 2 + this.x, 2 + this.y); }, + + redrawCurrentApp: function(){ + if(typeof(draw)=='function'){ + draw(); + }else{ + load(); // fallback. This might reset some variables + } + }, + connect: function() { WIDGETS.bluetooth_notify.draw(); }, + disconnect: function() { if(WIDGETS.bluetooth_notify.warningEnabled == 1){ E.showMessage(/*LANG*/'Connection\nlost.', 'Bluetooth'); - // setInterval(()=>{load();}, 3000); // clear message - this will reload the widget, resetting 'warningEnabled'. + setInterval(WIDGETS.bluetooth_notify.redrawCurrentApp()=>{;}, 3000); // clear message WIDGETS.bluetooth_notify.warningEnabled = 0; - setTimeout('WIDGETS.bluetooth_notify.warningEnabled = 1;', 30000); // re-notify only after 30 seconds. + 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){