2022-04-07 17:19:42 +00:00
|
|
|
function drawAlert(){
|
|
|
|
E.showPrompt("Innactivity detected",{
|
|
|
|
title:"Activity reminder",
|
|
|
|
buttons : {"Ok": true,"Dismiss": false}
|
|
|
|
}).then(function(v) {
|
2022-04-18 13:05:41 +00:00
|
|
|
console.log(stepsArray); // todo remove
|
2022-04-18 14:28:34 +00:00
|
|
|
if(v == true){
|
2022-04-18 13:05:41 +00:00
|
|
|
stepsArray = stepsArray.slice(0, activityreminder.maxInnactivityMin - 3);
|
|
|
|
require("activityreminder").saveStepsArray(stepsArray);
|
2022-04-07 17:19:42 +00:00
|
|
|
}
|
|
|
|
if(v == false){
|
2022-04-18 13:05:41 +00:00
|
|
|
stepsArray = stepsArray.slice(0, activityreminder.maxInnactivityMin - activityreminder.dismissDelayMin);
|
|
|
|
require("activityreminder").saveStepsArray(stepsArray);
|
2022-04-07 17:19:42 +00:00
|
|
|
}
|
|
|
|
load();
|
|
|
|
});
|
2022-04-18 14:28:34 +00:00
|
|
|
Bangle.buzz(400);
|
2022-04-07 17:19:42 +00:00
|
|
|
setTimeout(load, 10000);
|
|
|
|
}
|
2022-04-07 16:16:51 +00:00
|
|
|
|
2022-04-18 14:28:34 +00:00
|
|
|
function run(){
|
|
|
|
if(stepsArray.length == activityreminder.maxInnactivityMin){
|
|
|
|
if (stepsArray[0] - stepsArray[stepsArray.length-1] < activityreminder.minSteps){
|
|
|
|
drawAlert();
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
eval(require("Storage").read("activityreminder.settings.js"))(()=>load());
|
2022-04-07 17:19:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
g.clear();
|
|
|
|
Bangle.loadWidgets();
|
|
|
|
Bangle.drawWidgets();
|
2022-04-18 14:28:34 +00:00
|
|
|
activityreminder = require("activityreminder").loadSettings();
|
2022-04-18 13:05:41 +00:00
|
|
|
stepsArray = require("activityreminder").loadStepsArray();
|
|
|
|
run()
|