Alarm: Change 'New Alarm' to 'Save', allow Deletion of Alarms

pull/251/head
Gordon Williams 2020-04-08 09:35:38 +01:00
parent 36a8957942
commit 3b7eec70e3
3 changed files with 11 additions and 10 deletions

View File

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

View File

@ -3,3 +3,4 @@
0.03: More alarm scheduling issues
0.04: Tweaks for variable size widget system
0.05: Add alarm.boot.js and move code from the bootloader
0.06: Change 'New Alarm' to 'Save', allow Deletion of Alarms

View File

@ -84,15 +84,15 @@ function editAlarm(alarmIndex) {
last : day, rp : repeat
};
}
if (newAlarm) {
menu["> New Alarm"] = function() {
alarms.push(getAlarm());
menu["> Save"] = function() {
if (newAlarm) alarms.push(getAlarm());
else alarms[alarmIndex] = getAlarm();
require("Storage").write("alarm.json",JSON.stringify(alarms));
showMainMenu();
};
} else {
menu["> Save"] = function() {
alarms[alarmIndex] = getAlarm();
if (!newAlarm) {
menu["> Delete"] = function() {
alarms.splice(alarmIndex,1);
require("Storage").write("alarm.json",JSON.stringify(alarms));
showMainMenu();
};