widdst: ensure DST is applied when leaving settings

pull/3459/head
Rob Pilling 2024-06-16 19:56:12 +01:00
parent 20810b4403
commit caaed8fc5e
3 changed files with 15 additions and 3 deletions

View File

@ -2,4 +2,5 @@
0.02: Checks for correct firmware; E.setDST(...) moved to boot.js 0.02: Checks for correct firmware; E.setDST(...) moved to boot.js
0.03: Convert Yes/No On/Off in settings to checkboxes 0.03: Convert Yes/No On/Off in settings to checkboxes
0.04: Give the boot file the highest priority to ensure it runs before sched (fix #2663) 0.04: Give the boot file the highest priority to ensure it runs before sched (fix #2663)
0.05: Tweaks to ensure Gadgetbridge can't overwrite timezone on 2v19.106 and later 0.05: Tweaks to ensure Gadgetbridge can't overwrite timezone on 2v19.106 and later
0.06: If fastload is present, ensure DST changes are still applied when leaving settings

View File

@ -1,6 +1,6 @@
{ "id": "widdst", { "id": "widdst",
"name": "Daylight Saving", "name": "Daylight Saving",
"version":"0.05", "version":"0.06",
"description": "Widget to set daylight saving rules. Requires Espruino 2v15 or later - see the instructions below for more information.", "description": "Widget to set daylight saving rules. Requires Espruino 2v15 or later - see the instructions below for more information.",
"icon": "icon.png", "icon": "icon.png",
"type": "widget", "type": "widget",

View File

@ -33,8 +33,11 @@
at: 0 at: 0
}; };
var writtenSettings = false;
function writeSettings() { function writeSettings() {
require('Storage').writeJSON("widdst.json", settings); require('Storage').writeJSON("widdst.json", settings);
writtenSettings = true;
} }
function writeSubMenuSettings() { function writeSubMenuSettings() {
@ -136,7 +139,15 @@
"": { "": {
"Title": /*LANG*/"Daylight Saving" "Title": /*LANG*/"Daylight Saving"
}, },
"< Back": () => back(), "< Back": () => {
if(writtenSettings && global._load){
// disable fastload to ensure settings are applied
// when we exit the settings app
global.load = global._load;
delete global._load;
}
back();
},
/*LANG*/"Enabled": { /*LANG*/"Enabled": {
value: !!settings.has_dst, value: !!settings.has_dst,
onchange: v => { onchange: v => {