mirror of https://github.com/espruino/BangleApps
Moving stuff around to be sure to instanciate the variable before even referencing them in functions
parent
85a52afbf5
commit
59ee5b1a78
|
@ -1,4 +1,10 @@
|
|||
(function () {
|
||||
|
||||
const activityreminder = require("activityreminder");
|
||||
const storage = require("Storage");
|
||||
const activityreminder_settings = activityreminder.loadSettings();
|
||||
const activityreminder_data = activityreminder.loadData();
|
||||
|
||||
function drawAlert() {
|
||||
E.showPrompt("Inactivity detected", {
|
||||
title: "Activity reminder",
|
||||
|
@ -31,13 +37,10 @@
|
|||
eval(storage.read("activityreminder.settings.js"))(() => load());
|
||||
}
|
||||
}
|
||||
|
||||
const activityreminder = require("activityreminder");
|
||||
const storage = require("Storage");
|
||||
|
||||
g.clear();
|
||||
Bangle.loadWidgets();
|
||||
Bangle.drawWidgets();
|
||||
const activityreminder_settings = activityreminder.loadSettings();
|
||||
const activityreminder_data = activityreminder.loadData();
|
||||
run();
|
||||
|
||||
})();
|
|
@ -1,4 +1,15 @@
|
|||
(function () {
|
||||
|
||||
const activityreminder = require("activityreminder");
|
||||
const activityreminder_settings = activityreminder.loadSettings();
|
||||
if (activityreminder_settings.enabled) {
|
||||
const activityreminder_data = activityreminder.loadData();
|
||||
if (activityreminder_data.firstLoad) {
|
||||
activityreminder_data.firstLoad = false;
|
||||
activityreminder.saveData(activityreminder_data);
|
||||
}
|
||||
}
|
||||
|
||||
function run() {
|
||||
if (isNotWorn()) return;
|
||||
let now = new Date();
|
||||
|
@ -49,15 +60,8 @@
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
const activityreminder = require("activityreminder");
|
||||
const activityreminder_settings = activityreminder.loadSettings();
|
||||
|
||||
if (activityreminder_settings.enabled) {
|
||||
const activityreminder_data = activityreminder.loadData();
|
||||
if (activityreminder_data.firstLoad) {
|
||||
activityreminder_data.firstLoad = false;
|
||||
activityreminder.saveData(activityreminder_data);
|
||||
}
|
||||
setInterval(run, 60000);
|
||||
/* todo in a futur release
|
||||
increase setInterval time to something that is still sensible (5 mins ?)
|
||||
|
|
Loading…
Reference in New Issue