taglaunch: Fix remove handler

master
Erik Andresen 2023-07-26 23:58:20 +02:00
parent 4777d98c10
commit 2024f9267c
3 changed files with 11 additions and 7 deletions

View File

@ -2,3 +2,4 @@
0.02: Use Bangle.showClock for changing to clock (Backport from launch) 0.02: Use Bangle.showClock for changing to clock (Backport from launch)
0.03: Remove app from 'tool' when it has at least one other known tag 0.03: Remove app from 'tool' when it has at least one other known tag
Add tag 'health' for apps like Heart Rate Monitor Add tag 'health' for apps like Heart Rate Monitor
0.04: Fix remove handler

View File

@ -73,6 +73,12 @@ let tagKeys = Object.keys(tags).filter(tag => tag !== "clock" || settings.showCl
if (!settings.fullscreen) if (!settings.fullscreen)
Bangle.loadWidgets(); Bangle.loadWidgets();
const unload = () => {
// cleanup the timeout to not leave anything behind after being removed from ram
if (lockTimeout) clearTimeout(lockTimeout);
Bangle.removeListener("lock", lockHandler);
};
let showTagMenu = (tag) => { let showTagMenu = (tag) => {
E.showScroller({ E.showScroller({
h : 64*scaleval, c : appsByTag[tag].length, h : 64*scaleval, c : appsByTag[tag].length,
@ -96,7 +102,8 @@ let showTagMenu = (tag) => {
load(app.src); load(app.src);
} }
}, },
back : showMainMenu back : showMainMenu,
remove: unload
}); });
}; };
@ -118,11 +125,7 @@ let showMainMenu = () => {
showTagMenu(tag); showTagMenu(tag);
}, },
back : Bangle.showClock, // button press or tap in top left shows clock now back : Bangle.showClock, // button press or tap in top left shows clock now
remove : () => { remove : unload
// cleanup the timeout to not leave anything behind after being removed from ram
if (lockTimeout) clearTimeout(lockTimeout);
Bangle.removeListener("lock", lockHandler);
}
}); });
}; };
showMainMenu(); showMainMenu();

View File

@ -2,7 +2,7 @@
"id": "taglaunch", "id": "taglaunch",
"name": "Tag Launcher", "name": "Tag Launcher",
"shortName": "Taglauncher", "shortName": "Taglauncher",
"version": "0.03", "version": "0.04",
"description": "Launcher that puts all applications into submenus based on their tag. With many applications installed this can result in a faster application selection than the linear access of the default launcher.", "description": "Launcher that puts all applications into submenus based on their tag. With many applications installed this can result in a faster application selection than the linear access of the default launcher.",
"readme": "README.md", "readme": "README.md",
"icon": "app.png", "icon": "app.png",