1
0
Fork 0

Merge pull request #1881 from alessandrococco/dow-patch-1

[Alarms & Timers] Fix dow handling for new timers
master
Gordon Williams 2022-05-26 08:25:46 +01:00 committed by GitHub
commit 0b8ef9d5ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -28,3 +28,4 @@
0.26: Add support for Monday as first day of the week (#1780) 0.26: Add support for Monday as first day of the week (#1780)
0.27: New UI! 0.27: New UI!
0.28: Fix bug with alarms not firing when configured to fire only once 0.28: Fix bug with alarms not firing when configured to fire only once
0.29: Fix wrong 'dow' handling in new timer if first day of week is Monday

View File

@ -37,8 +37,8 @@ function handleFirstDayOfWeek(dow) {
return dow; return dow;
} }
// Check the first day of week and update the dow field accordingly. // Check the first day of week and update the dow field accordingly (alarms only!)
alarms.forEach(alarm => alarm.dow = handleFirstDayOfWeek(alarm.dow)); alarms.filter(e => e.timer === undefined).forEach(a => a.dow = handleFirstDayOfWeek(a.dow));
function showMainMenu() { function showMainMenu() {
const menu = { const menu = {
@ -158,14 +158,14 @@ function saveAlarm(alarm, alarmIndex, time) {
} }
function saveAndReload() { function saveAndReload() {
// Before saving revert the dow to the standard format // Before saving revert the dow to the standard format (alarms only!)
alarms.forEach(a => a.dow = handleFirstDayOfWeek(a.dow, firstDayOfWeek)); alarms.filter(e => e.timer === undefined).forEach(a => a.dow = handleFirstDayOfWeek(a.dow));
require("sched").setAlarms(alarms); require("sched").setAlarms(alarms);
require("sched").reload(); require("sched").reload();
// Fix after save // Fix after save
alarms.forEach(a => a.dow = handleFirstDayOfWeek(a.dow, firstDayOfWeek)); alarms.filter(e => e.timer === undefined).forEach(a => a.dow = handleFirstDayOfWeek(a.dow));
} }
function decodeDOW(alarm) { function decodeDOW(alarm) {

View File

@ -2,7 +2,7 @@
"id": "alarm", "id": "alarm",
"name": "Alarms & Timers", "name": "Alarms & Timers",
"shortName": "Alarms", "shortName": "Alarms",
"version": "0.28", "version": "0.29",
"description": "Set alarms and timers on your Bangle", "description": "Set alarms and timers on your Bangle",
"icon": "app.png", "icon": "app.png",
"tags": "tool,alarm,widget", "tags": "tool,alarm,widget",