diff --git a/apps/alarmqm/ChangeLog b/apps/alarmqm/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/alarmqm/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/alarmqm/app.png b/apps/alarmqm/app.png new file mode 100644 index 000000000..ee0085206 Binary files /dev/null and b/apps/alarmqm/app.png differ diff --git a/apps/alarmqm/boot.js b/apps/alarmqm/boot.js new file mode 100644 index 000000000..cf35452c0 --- /dev/null +++ b/apps/alarmqm/boot.js @@ -0,0 +1,20 @@ +(function () { + function dismissAlarm(alarm) { + // Run only for alarms, not timers + if (!alarm.timer) { + if ("qmsched" in WIDGETS) { + require("qmsched").setMode(0); + } else { + // Code from qmsched.js, so we can work without it + require("Storage").writeJSON( + "setting.json", + Object.assign(require("Storage").readJSON("setting.json", 1) || {}, { + quiet: 0, + }) + ); + } + } + } + + Bangle.on("alarmDismiss", dismissAlarm); + })(); \ No newline at end of file diff --git a/apps/alarmqm/metadata.json b/apps/alarmqm/metadata.json new file mode 100644 index 000000000..bae4b0807 --- /dev/null +++ b/apps/alarmqm/metadata.json @@ -0,0 +1,13 @@ +{ "id": "alarmqm", + "name": "Alarm Quiet Mode", + "shortName":"AlarmQM", + "version":"0.01", + "description": "Service that turns off quiet mode after alarm dismiss", + "icon": "app.png", + "tags": "quiet,alarm", + "supports" : ["BANGLEJS2"], + "type": "bootloader", + "storage": [ + {"name":"alarmqm.boot.js","url":"boot.js"} + ] +} diff --git a/apps/sched/ChangeLog b/apps/sched/ChangeLog index 6813345b7..ae931e99e 100644 --- a/apps/sched/ChangeLog +++ b/apps/sched/ChangeLog @@ -20,3 +20,4 @@ 0.17: Fix midnight in local timezone (alarms wouldn't always fire as expected in timezone != 0) 0.18: Update clock_info to avoid a redraw 0.19: Update clock_info to refresh periodically on active alarms/timers +0.20: Alarm dismiss and snooze events \ No newline at end of file diff --git a/apps/sched/metadata.json b/apps/sched/metadata.json index 9ffc28524..a56cec042 100644 --- a/apps/sched/metadata.json +++ b/apps/sched/metadata.json @@ -1,7 +1,7 @@ { "id": "sched", "name": "Scheduler", - "version": "0.19", + "version": "0.20", "description": "Scheduling library for alarms and timers", "icon": "app.png", "type": "scheduler", diff --git a/apps/sched/sched.js b/apps/sched/sched.js index b0fe21d91..f2f2644f9 100644 --- a/apps/sched/sched.js +++ b/apps/sched/sched.js @@ -36,6 +36,7 @@ function showAlarm(alarm) { alarm.ot = alarm.t; } alarm.t += settings.defaultSnoozeMillis; + Bangle.emit("alarmSnooze", alarm); } else { let del = alarm.del === undefined ? settings.defaultDeleteExpiredTimers : alarm.del; if (del) { @@ -52,6 +53,7 @@ function showAlarm(alarm) { alarm.on = false; } } + Bangle.emit("alarmDismiss", alarm); } // The updated alarm is still a member of 'alarms'