forked from FOSS/BangleApps
Merge branch 'master' of github.com:espruino/BangleApps
commit
2075127dfe
|
@ -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": [
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -24,9 +24,14 @@ function showAlarm(alarm) {
|
|||
}).then(function(sleep) {
|
||||
buzzCount = 0;
|
||||
if (sleep) {
|
||||
if(alarm.ohr===undefined) alarm.ohr = alarm.hr;
|
||||
alarm.hr += 10/60; // 10 minutes
|
||||
} else {
|
||||
alarm.last = (new Date()).getDate();
|
||||
if (alarm.ohr!==undefined) {
|
||||
alarm.hr = alarm.ohr;
|
||||
delete alarm.ohr;
|
||||
}
|
||||
if (!alarm.rp) alarm.on = false;
|
||||
}
|
||||
require("Storage").write("alarm.json",JSON.stringify(alarms));
|
||||
|
@ -38,6 +43,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);
|
||||
});
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue