From ef91392a9c6e1baf47519a767c9a3686c167e79c Mon Sep 17 00:00:00 2001 From: msdeibel Date: Sun, 24 May 2020 17:57:55 +0200 Subject: [PATCH] RandomClockWidget even less invasive --- apps.json | 2 +- apps/rndmclk/ChangeLog | 1 + apps/rndmclk/README.md | 4 ++-- apps/rndmclk/widget.js | 10 ++++------ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/apps.json b/apps.json index 04c2f637d..fde4aeba0 100644 --- a/apps.json +++ b/apps.json @@ -1725,7 +1725,7 @@ { "id": "rndmclk", "name": "Random Clock Loader", "icon": "rndmclk.png", - "version":"0.02", + "version":"0.03", "description": "Load a different clock whenever the LCD is switched on.", "readme": "README.md", "tags": "widget,clock", diff --git a/apps/rndmclk/ChangeLog b/apps/rndmclk/ChangeLog index 2d387a04b..1f53ea4ae 100644 --- a/apps/rndmclk/ChangeLog +++ b/apps/rndmclk/ChangeLog @@ -1,2 +1,3 @@ 0.01: New widget 0.02: Less invasive, change default clock setting instead of directly loading the new clock (no longer breaks Gadgetbridge notifications) +0.03: Only changes when the widget id reloaded (no longer uses LCD turning off) diff --git a/apps/rndmclk/README.md b/apps/rndmclk/README.md index 86138e0e7..d75a53343 100644 --- a/apps/rndmclk/README.md +++ b/apps/rndmclk/README.md @@ -1,6 +1,6 @@ # Summary -Random Clock is a widget that will randomly show one of the installed watch faces each time the LCD is turned on. +Random Clock is a widget that will randomly show one of the installed watch faces each time after the widget is (re-)loaded. # How it works -Everytime the LCD is turned off, the widget randomly changes the clock. When you long press BTN 3 the next time, +Everytime the widget is reloaded, it randomly changes the clock. When you long press BTN 3 the next time, you might (or might not, it's random after all) see another watch face. \ No newline at end of file diff --git a/apps/rndmclk/widget.js b/apps/rndmclk/widget.js index 566d8eed5..479d8b2c3 100644 --- a/apps/rndmclk/widget.js +++ b/apps/rndmclk/widget.js @@ -16,20 +16,18 @@ if (clockApps && clockApps.length > 0) { var clockIndex = getRandomInt(clockApps.length); - // Only update the file if the clock really change to be nice to the FLASH mem + // Only update the file if the clock really changed to be nice to the FLASH mem if (clockApps[clockIndex].src != currentClock) { currentClock = clockApps[clockIndex].src; settings = require("Storage").readJSON('setting.json', 1); settings.clock = clockApps[clockIndex].src; require("Storage").write('setting.json', settings); + + console.log("RandomClockWidget set the clock to '" + clockApps[clockIndex].name + "'"); } } } - Bangle.on('lcdPower', (on) => { - if (!on) { - loadRandomClock(); - } - }); + loadRandomClock(); })(); \ No newline at end of file