0.03: Fix unfreed memory, and clearInterval that disabled all clocks at midnight (fix #946)

Fix app icon
      Change menu order so 'back' is at the top
pull/987/head
Gordon Williams 2021-12-02 10:07:45 +00:00
parent ce2d182247
commit 5b967184b6
6 changed files with 19 additions and 13 deletions

View File

@ -4310,7 +4310,7 @@
"name": "Q Alarm and Timer",
"shortName": "Q Alarm",
"icon": "app.png",
"version": "0.02",
"version": "0.03",
"description": "Alarm and timer app with days of week and 'hard' option.",
"tags": "tool,alarm,widget",
"supports": ["BANGLEJS", "BANGLEJS2"],

View File

@ -1,2 +1,5 @@
0.01: First version!
0.02: Fixed alarms not working and localised days of week.
0.03: Fix unfreed memory, and clearInterval that disabled all clocks at midnight
Fix app icon
Change menu order so 'back' is at the top

View File

@ -1 +1 @@
require("heatshrink").decompress(atob("/wA/AH4A/AH4AF0WiF1wwtF73GB53MAAgkY4wABFqIxPEhQuXGB4vUFxYwMEpBpGBwouNGAwfFF5I1KF6ZQHGAwNLFx4wHF/4v/F/4v/AoYGDF6gaFF5AwHL7QuMBJQvWEpwvxBQ4uRGBAkJT4wuWGBIuIRjKRNF8wwXFy4wWFzIwU53NFzPN5wuR5/PGK4tBDYSNQ5wVCCwIzBAAQoIAAQWGSJ5HFDYYAQIYTCRKRIeBAAYmDAAZsJMCQAbeCAybFiQ0XFTQAIzgAGFcYvz0QAGF84wGF1AwFF1QA/AH4A/ADQ="))
require("heatshrink").decompress(atob("mEw4UA///gH+93+oH9Jf8AgfABZMP+ALRmADCitUAgUMAQP8AQMBqtVoAFBn4CBDwUFBYNQFAQLEioLBEgQLBgfwE4IKBAAI3BBYXAE4ILE/gJBAIM8HQQ8CngL/n4LFKYR3BhgLFNYSDCBYqPFBZKzBUwSoDWYTLBUwSoDZYQABBQa0DBZCoBAAY6EcojhEHgoACkoLFrALD1WVBQdW1QLDtQMDBQOpHQmqAAg8DIwQKEJAg6FMApfLDIoJFAAX//4KIBbE/aAIAIh7oBAH4A=="))

View File

@ -41,6 +41,7 @@ function getCurrentTime() {
function showMainMenu() {
const menu = {
"": { title: "Alarms" },
"< Back" : () => load(),
"New Alarm": () => showEditAlarmMenu(-1),
"New Timer": () => showEditTimerMenu(-1),
};
@ -54,9 +55,7 @@ function showMainMenu() {
else showEditAlarmMenu(idx);
};
});
menu["< Back"] = () => {
load();
};
menu
if (WIDGETS["qalarm"]) WIDGETS["qalarm"].reload();
return E.showMenu(menu);
@ -86,6 +85,7 @@ function showEditAlarmMenu(alarmIndex, alarm) {
const menu = {
"": { title: alarm.msg ? alarm.msg : "Alarms" },
"< Back" : showMainMenu,
Hours: {
value: hrs,
onchange: function (v) {
@ -162,7 +162,6 @@ function showEditAlarmMenu(alarmIndex, alarm) {
showMainMenu();
};
}
menu["< Back"] = showMainMenu;
return E.showMenu(menu);
}
@ -206,6 +205,7 @@ function showEditTimerMenu(timerIndex) {
const menu = {
"": { title: "Timer" },
"< Back" : showMainMenu,
Hours: {
value: hrs,
onchange: function (v) {
@ -264,7 +264,7 @@ function showEditTimerMenu(timerIndex) {
showMainMenu();
};
}
menu["< Back"] = showMainMenu;
return E.showMenu(menu);
}

View File

@ -1 +1 @@
eval(require("Storage").read("qalarmcheck.js"));
(function() { eval(require("Storage").read("qalarmcheck.js")); })()

View File

@ -4,7 +4,10 @@
print("Checking for alarms...");
clearInterval();
if (Bangle.QALARM) {
clearInterval(Bangle.QALARM);
Bangle.QALARM = undefined;
}
function getCurrentTime() {
let time = new Date();
@ -29,13 +32,13 @@ let nextAlarms = (require("Storage").readJSON("qalarm.json", 1) || [])
.sort((a, b) => a.t - b.t);
if (nextAlarms[0]) {
setTimeout(() => {
Bangle.QALARM = setTimeout(() => {
eval(require("Storage").read("qalarmcheck.js"));
load("qalarm.js");
}, nextAlarms[0].t - t);
} else {
// No alarms found: will re-check at midnight
setTimeout(() => {
Bangle.QALARM = setTimeout(() => {
eval(require("Storage").read("qalarmcheck.js"));
}, 86400000 - t);
}