sched/clkinfo: tapping an alarm toggles it on/off

pull/3579/head
Rob Pilling 2024-09-19 14:07:09 +01:00
parent 84f12124fc
commit 943de6fca8
3 changed files with 10 additions and 3 deletions

View File

@ -27,3 +27,4 @@
0.24: Emit alarmReload when alarms change (used by widalarm)
0.25: Fix wrap around when snoozed through midnight
0.26: Fix hitting snooze on an alarm after when the snooze would've fired
0.27: Tapping clkinfo enables/disables the selected alarm

View File

@ -96,12 +96,13 @@
}
var img = iconAlarmOn;
var all = alarm.getAlarms();
//get only alarms not created by other apps
var alarmItems = {
name: /*LANG*/"Alarms",
img: img,
dynamic: true,
items: alarm.getAlarms().filter(a=>!a.appid)
items: all.filter(a=>!a.appid)
//.sort((a,b)=>alarm.getTimeToAlarm(a)-alarm.getTimeToAlarm(b))
.sort((a,b)=>getAlarmOrder(a)-getAlarmOrder(b))
.map((a, i)=>({
@ -123,7 +124,12 @@
this.interval = undefined;
this.switchTimeout = undefined;
},
run: function() { }
run: function() {
a.on = !a.on;
this.emit("redraw");
alarm.setAlarms(all);
alarm.reload();
}
})),
};

View File

@ -1,7 +1,7 @@
{
"id": "sched",
"name": "Scheduler",
"version": "0.26",
"version": "0.27",
"description": "Scheduling library for alarms and timers",
"icon": "app.png",
"type": "scheduler",