0.51: Fix long-touch to enable alarm/timer not updating time (fix #3804)
parent
abb6f4896b
commit
0a67619541
|
|
@ -55,3 +55,4 @@
|
|||
to select an alarm in the main menu.
|
||||
0.50: Bangle.js 2: Long touch of alarm in main menu toggle it on/off. Touching the icon on
|
||||
the right will do the same.
|
||||
0.51: Fix long-touch to enable alarm/timer not updating time (fix #3804)
|
||||
|
|
@ -99,6 +99,7 @@ function showMainMenu(scroll, group, scrollback) {
|
|||
onchange: (v, touch) => {
|
||||
if (touch && (2==touch.type || 145<touch.x)) { // Long touch or touched icon.
|
||||
e.on = v;
|
||||
if (e.on) prepareForSave(e, index);
|
||||
saveAndReload();
|
||||
} else {
|
||||
setTimeout(e.timer ? showEditTimerMenu : showEditAlarmMenu, 10, e, index, undefined, scroller?scroller.scroll:undefined, group);
|
||||
|
|
@ -328,6 +329,14 @@ function prepareAlarmForSave(alarm, alarmIndex, time, date, temp) {
|
|||
}
|
||||
}
|
||||
|
||||
function prepareForSave(alarm, alarmIndex) {
|
||||
if (alarm.timer) {
|
||||
prepareTimerForSave(alarm, alarmIndex, require("time_utils").decodeTime(alarm.timer));
|
||||
} else {
|
||||
prepareAlarmForSave(alarm, alarmIndex, require("time_utils").decodeTime(alarm.t));
|
||||
}
|
||||
}
|
||||
|
||||
function saveAndReload() {
|
||||
// Before saving revert the dow to the standard format (alarms only!)
|
||||
alarms.filter(e => e.timer === undefined).forEach(a => a.dow = handleFirstDayOfWeek(a.dow));
|
||||
|
|
@ -574,13 +583,7 @@ function enableAll(on) {
|
|||
if (confirm) {
|
||||
alarms.forEach((alarm, i) => {
|
||||
alarm.on = on;
|
||||
if (on) {
|
||||
if (alarm.timer) {
|
||||
prepareTimerForSave(alarm, i, require("time_utils").decodeTime(alarm.timer));
|
||||
} else {
|
||||
prepareAlarmForSave(alarm, i, require("time_utils").decodeTime(alarm.t));
|
||||
}
|
||||
}
|
||||
if (on) prepareForSave(alarm, i);
|
||||
});
|
||||
saveAndReload();
|
||||
showMainMenu();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"id": "alarm",
|
||||
"name": "Alarms & Timers",
|
||||
"shortName": "Alarms",
|
||||
"version": "0.50",
|
||||
"version": "0.51",
|
||||
"description": "Set alarms and timers on your Bangle",
|
||||
"icon": "app.png",
|
||||
"tags": "tool,alarm",
|
||||
|
|
|
|||
Loading…
Reference in New Issue