Fix widgets reappearing

pull/3560/head
Martin Pool 2024-09-06 21:43:14 +02:00
parent 17b82f9ae1
commit bbc9d63d51
3 changed files with 13 additions and 9 deletions

View File

@ -1 +1,2 @@
0.12: First release 0.12: First release
0.13: Fix widgets reappearing

View File

@ -1,5 +1,6 @@
const storage = require("Storage"); const storage = require("Storage");
const locale = require('locale'); const locale = require('locale');
const widget_utils = require('widget_utils');
const SCREEN_WIDTH = g.getWidth(); const SCREEN_WIDTH = g.getWidth();
const SCREEN_HEIGHT = g.getHeight(); const SCREEN_HEIGHT = g.getHeight();
@ -46,14 +47,12 @@ const Y = SCREEN_HEIGHT / 2
let date, mins; let date, mins;
function initialize() { function initialize() {
// Load widgets
Bangle.loadWidgets();
// draw immediately at first // draw immediately at first
tick(); tick();
// for (let mm = 0; mm < 60; mm++) {
// console.log(23, mm);
// console.log(getTimeLines(23 * 60 + mm));
// }
// now check every second // now check every second
let secondInterval = setInterval(tick, 1000); let secondInterval = setInterval(tick, 1000);
// Stop updates when LCD is off, restart when on // Stop updates when LCD is off, restart when on
@ -76,6 +75,10 @@ function tick() {
mins = m; mins = m;
draw(); draw();
} }
if (!settings.showWidgets) {
widget_utils.hide();
}
} }
function draw() { function draw() {
@ -106,9 +109,9 @@ function draw() {
Bangle.setUI("clock"); Bangle.setUI("clock");
if (settings.showWidgets) { if (settings.showWidgets) {
// Load widgets
Bangle.loadWidgets();
Bangle.drawWidgets(); Bangle.drawWidgets();
} else {
widget_utils.hide();
} }
} }

View File

@ -3,7 +3,7 @@
"name": "Dutch Clock", "name": "Dutch Clock",
"shortName":"Dutch Clock", "shortName":"Dutch Clock",
"icon": "app.png", "icon": "app.png",
"version":"0.12", "version":"0.13",
"description": "A clock that displays the time the way a Dutch person would respond when asked what time it is.", "description": "A clock that displays the time the way a Dutch person would respond when asked what time it is.",
"type": "clock", "type": "clock",
"tags": "clock,dutch,text", "tags": "clock,dutch,text",