Skip to content

Commit

Permalink
Merge pull request #3459 from bobrippling/fix/dst-apply
Browse files Browse the repository at this point in the history
widdst: ensure DST is applied when leaving settings
  • Loading branch information
bobrippling authored Jun 19, 2024
2 parents 7069440 + caaed8f commit 0256a6a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/widdst/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
0.02: Checks for correct firmware; E.setDST(...) moved to boot.js
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.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
2 changes: 1 addition & 1 deletion apps/widdst/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ "id": "widdst",
"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.",
"icon": "icon.png",
"type": "widget",
Expand Down
13 changes: 12 additions & 1 deletion apps/widdst/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
at: 0
};

var writtenSettings = false;

function writeSettings() {
require('Storage').writeJSON("widdst.json", settings);
writtenSettings = true;
}

function writeSubMenuSettings() {
Expand Down Expand Up @@ -136,7 +139,15 @@
"": {
"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": {
value: !!settings.has_dst,
onchange: v => {
Expand Down

0 comments on commit 0256a6a

Please sign in to comment.