[ActivityReminder] Actually commiting the fix to mustAlert
parent
740b81e076
commit
f46159ef8e
|
|
@ -10,6 +10,10 @@ function run() {
|
|||
activityreminder_data.stepsOnDate = health.steps;
|
||||
activityreminder_data.stepsDate = now;
|
||||
activityreminder.saveData(activityreminder_data);
|
||||
/* todo in a futur release
|
||||
add settimer to trigger like 10 secs after the stepsDate + minSteps
|
||||
cancel all other timers of this app
|
||||
*/
|
||||
}
|
||||
|
||||
if(activityreminder.mustAlert(activityreminder_data, activityreminder_settings)){
|
||||
|
|
@ -20,7 +24,7 @@ function run() {
|
|||
}
|
||||
|
||||
function isNotWorn() {
|
||||
// todo check temperature and mouvement in a futur release
|
||||
// todo in a futur release check temperature and mouvement in a futur release
|
||||
return Bangle.isCharging();
|
||||
}
|
||||
|
||||
|
|
@ -33,4 +37,9 @@ if (activityreminder_settings.enabled) {
|
|||
activityreminder.saveData(activityreminder_data);
|
||||
}
|
||||
setInterval(run, 60000);
|
||||
/* todo in a futur release
|
||||
increase setInterval time to something that is still sensible (5 mins ?)
|
||||
add settimer to trigger like 10 secs after the stepsDate + minSteps
|
||||
cancel all other timers of this app
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,9 +47,9 @@ exports.loadData = function () {
|
|||
exports.mustAlert = function(activityreminder_data, activityreminder_settings) {
|
||||
let now = new Date();
|
||||
if ((now - activityreminder_data.stepsDate) / 60000 > activityreminder_settings.maxInnactivityMin) { // inactivity detected
|
||||
if ((now - activityreminder_settings.okDate) / 60000 > 3 && // last alert anwsered with ok was more than 3 min ago
|
||||
(now - activityreminder_settings.dismissDate) / 60000 > activityreminder_settings.dismissDelayMin && // last alert was more than dismissDelayMin ago
|
||||
(now - activityreminder_settings.pauseDate) / 60000 > activityreminder_settings.pauseDelayMin) { // last alert was more than pauseDelayMin ago
|
||||
if ((now - activityreminder_data.okDate) / 60000 > 3 && // last alert anwsered with ok was more than 3 min ago
|
||||
(now - activityreminder_data.dismissDate) / 60000 > activityreminder_settings.dismissDelayMin && // last alert was more than dismissDelayMin ago
|
||||
(now - activityreminder_data.pauseDate) / 60000 > activityreminder_settings.pauseDelayMin) { // last alert was more than pauseDelayMin ago
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue