Skip to content

Commit

Permalink
quicklaunch: undo timeout, load settings on demand
Browse files Browse the repository at this point in the history
  • Loading branch information
thyttan committed Nov 13, 2024
1 parent e8ef71e commit ac7ed7d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/quicklaunch/boot.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
setTimeout(() => { // wrap in zero ms timeout so the foreground app loads first.
const storage = require("Storage");
let settings = storage.readJSON("quicklaunch.json", true) || {};
let settings;

let leaveTrace = function(trace) {
if (!settings) settings = storage.readJSON("quicklaunch.json", true) || {};

settings.trace = trace;
storage.writeJSON("quicklaunch.json", settings);
return trace;
};

let launchApp = function(trace) {
if (!settings) settings = storage.readJSON("quicklaunch.json", true) || {};

if (settings[trace+"app"].src){
if (settings[trace+"app"].name == "Show Launcher") Bangle.showLauncher();
else if (!storage.read(settings[trace+"app"].src)) {
Expand Down Expand Up @@ -41,5 +44,4 @@ setTimeout(() => { // wrap in zero ms timeout so the foreground app loads first.
if (ud == 1) trace = leaveTrace("d"); // d=down.
launchApp(trace);
});
}, 0);
}

0 comments on commit ac7ed7d

Please sign in to comment.