Add auto-snooze option to alarms

pull/471/head
Sabin Iacob 2020-06-01 20:12:14 +03:00
parent 30ae2f65f5
commit 89909c0746
4 changed files with 14 additions and 2 deletions

View File

@ -140,7 +140,7 @@
"name": "Default Alarm",
"shortName":"Alarms",
"icon": "app.png",
"version":"0.08",
"version":"0.09",
"description": "Set and respond to alarms",
"tags": "tool,alarm,widget",
"storage": [

View File

@ -6,3 +6,4 @@
0.06: Change 'New Alarm' to 'Save', allow Deletion of Alarms
0.07: Don't overwrite existing settings on app update
0.08: Make alarm scheduling more reliable
0.09: Add per alarm auto-snooze option

View File

@ -38,6 +38,10 @@ function showAlarm(alarm) {
Bangle.buzz(100).then(function() {
if (buzzCount--)
setTimeout(buzz, 3000);
else if(alarm.as) { // auto-snooze
buzzCount = 10;
setTimeout(buzz, 600000);
}
});
},100);
});

View File

@ -8,6 +8,7 @@ var alarms = require("Storage").readJSON("alarm.json",1)||[];
msg : "Eat chocolate",
last : 0, // last day of the month we alarmed on - so we don't alarm twice in one day!
rp : true, // repeat
as : true, // auto snooze
}
];*/
@ -50,6 +51,7 @@ function editAlarm(alarmIndex) {
mins = Math.round((a.hr-hrs)*60);
en = a.on;
repeat = a.rp;
as = a.as;
}
const menu = {
'': { 'title': 'Alarms' },
@ -70,6 +72,11 @@ function editAlarm(alarmIndex) {
value: en,
format: v=>v?"Yes":"No",
onchange: v=>repeat=v
},
'Auto snooze': {
value: en,
format: v=>v?"Yes":"No",
onchange: v=>as=v
}
};
function getAlarm() {
@ -81,7 +88,7 @@ function editAlarm(alarmIndex) {
// Save alarm
return {
on : en, hr : hr,
last : day, rp : repeat
last : day, rp : repeat, as: as
};
}
menu["> Save"] = function() {