Add auto-snooze option to alarms

master
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", "name": "Default Alarm",
"shortName":"Alarms", "shortName":"Alarms",
"icon": "app.png", "icon": "app.png",
"version":"0.08", "version":"0.09",
"description": "Set and respond to alarms", "description": "Set and respond to alarms",
"tags": "tool,alarm,widget", "tags": "tool,alarm,widget",
"storage": [ "storage": [

View File

@ -6,3 +6,4 @@
0.06: Change 'New Alarm' to 'Save', allow Deletion of Alarms 0.06: Change 'New Alarm' to 'Save', allow Deletion of Alarms
0.07: Don't overwrite existing settings on app update 0.07: Don't overwrite existing settings on app update
0.08: Make alarm scheduling more reliable 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() { Bangle.buzz(100).then(function() {
if (buzzCount--) if (buzzCount--)
setTimeout(buzz, 3000); setTimeout(buzz, 3000);
else if(alarm.as) { // auto-snooze
buzzCount = 10;
setTimeout(buzz, 600000);
}
}); });
},100); },100);
}); });

View File

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