weatherclock v0.06

master
lunctis-viribus 2023-02-26 16:46:02 +01:00
parent 4dc02a5a32
commit b7222c485b
2 changed files with 7 additions and 15 deletions

View File

@ -3,4 +3,4 @@
0.03: Minor layout extra spaces.
0.04: Layout now compatible with Bangle.js 2.
0.05: Use weather condition code for icon selection.
0.06: Dev8-New settings to hide the weather icon, day of week, date and/or wind speed.
0.06: Dev9-New settings to hide the weather icon, day of week, date and/or wind speed.

View File

@ -1,22 +1,14 @@
(function(back) {
const SETTINGS_FILE = "weatherClock.json";
// initialize with default settings...
let s = {
'icon': true,
'day': true,
'date': true,
'wind': true
}
// ...and overwrite them with any saved values
// This way saved values are preserved if a new version adds more settings
// Load setings file
const storage = require('Storage')
let settings = storage.readJSON(SETTINGS_FILE, 1) || {}
const saved = settings || {}
for (const key in saved) {
s[key] = saved[key]
}
let s;
s.icon = (settings.icon === undefined ? true : settings.icon);
s.day = (settings.day === undefined ? true : settings.day);
s.date = (settings.date === undefined ? true : settings.date);
s.wind = (settings.wind === undefined ? true : settings.wind);
function save() {
settings = s