forked from FOSS/BangleApps
Reassign to data, rather than separate settings
parent
0849edf198
commit
09bea87f18
|
@ -329,36 +329,20 @@ function readWeather() {
|
||||||
var weatherJson = require("Storage").readJSON('weather.json', 1);
|
var weatherJson = require("Storage").readJSON('weather.json', 1);
|
||||||
// save updated weather data if available and it has been an hour since last updated
|
// save updated weather data if available and it has been an hour since last updated
|
||||||
if (weatherJson && weatherJson.weather && weatherJson.weather.time && (data.time === undefined || (data.time + 3600000) < weatherJson.weather.time)) {
|
if (weatherJson && weatherJson.weather && weatherJson.weather.time && (data.time === undefined || (data.time + 3600000) < weatherJson.weather.time)) {
|
||||||
const newSettings = {
|
data.time = weatherJson.weather.time;
|
||||||
time: weatherJson.weather.time,
|
data.temp = weatherJson.weather.temp;
|
||||||
temp: weatherJson.weather.temp,
|
data.code = weatherJson.weather.code;
|
||||||
code: weatherJson.weather.code
|
require("Storage").writeJSON('mtnclock.json', data);
|
||||||
};
|
|
||||||
require("Storage").writeJSON(
|
|
||||||
'mtnclock.json',
|
|
||||||
Object.assign(
|
|
||||||
require("Storage").readJSON('mtnclock.json', 1),
|
|
||||||
newSettings
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const _GB = global.GB;
|
const _GB = global.GB;
|
||||||
global.GB = (event) => {
|
global.GB = (event) => {
|
||||||
if (event.t==="weather") {
|
if (event.t==="weather") {
|
||||||
const newSettings = {
|
data.temp = event.temp;
|
||||||
temp: event.temp,
|
data.code = event.code;
|
||||||
code: event.code,
|
data.time = Date.now();
|
||||||
time: Date.now()
|
require("Storage").writeJSON('mtnclock.json', data);
|
||||||
};
|
|
||||||
require("Storage").writeJSON(
|
|
||||||
'mtnclock.json',
|
|
||||||
Object.assign(
|
|
||||||
require("Storage").readJSON('mtnclock.json', 1),
|
|
||||||
newSettings
|
|
||||||
)
|
|
||||||
);
|
|
||||||
setWeather();
|
setWeather();
|
||||||
}
|
}
|
||||||
if (_GB) setTimeout(_GB, 0, event);
|
if (_GB) setTimeout(_GB, 0, event);
|
||||||
|
|
Loading…
Reference in New Issue