swiperclocklaunch: fix detection of clock

pull/3489/head
Rob Pilling 2024-07-03 12:07:45 +01:00
parent 3211cf6955
commit 14a37529c9
3 changed files with 7 additions and 11 deletions

View File

@ -4,3 +4,4 @@
0.04: Update to work with new 'fast switch' clock->launcher functionality 0.04: Update to work with new 'fast switch' clock->launcher functionality
0.05: Keep track of event listeners we "overwrite", and remove them at the start of setUI 0.05: Keep track of event listeners we "overwrite", and remove them at the start of setUI
0.06: Handle apps that call setUI({}) to reset 0.06: Handle apps that call setUI({}) to reset
0.07: Use a more reliable method of detecting a clock

View File

@ -8,19 +8,14 @@
sui(mode,cb); sui(mode,cb);
oldSwipe = Bangle.swipeHandler; oldSwipe = Bangle.swipeHandler;
if ("object"==typeof mode) mode = mode.mode; if (Bangle.CLOCK) {
if (!mode) return;
if (mode.startsWith("clock")) {
// clock -> launcher // clock -> launcher
Bangle.swipeHandler = dir => { if (dir<0) Bangle.showLauncher(); }; Bangle.swipeHandler = dir => { if (dir<0) Bangle.showLauncher(); };
Bangle.on("swipe", Bangle.swipeHandler); Bangle.on("swipe", Bangle.swipeHandler);
} else { } else if (global.__FILE__ && __FILE__.endsWith(".app.js") && (require("Storage").readJSON(__FILE__.slice(0,-6)+"info",1)||{}).type==="launch") {
if (global.__FILE__ && __FILE__.endsWith(".app.js") && (require("Storage").readJSON(__FILE__.slice(0,-6)+"info",1)||{}).type=="launch") { // launcher -> clock
// launcher -> clock Bangle.swipeHandler = dir => { if (dir>0) load(); };
Bangle.swipeHandler = dir => { if (dir>0) load(); }; Bangle.on("swipe", Bangle.swipeHandler);
Bangle.on("swipe", Bangle.swipeHandler);
}
} }
}; };
})(); })();

View File

@ -1,7 +1,7 @@
{ {
"id": "swiperclocklaunch", "id": "swiperclocklaunch",
"name": "Swiper Clock Launch", "name": "Swiper Clock Launch",
"version": "0.06", "version": "0.07",
"description": "Navigate between clock and launcher with Swipe action", "description": "Navigate between clock and launcher with Swipe action",
"icon": "swiperclocklaunch.png", "icon": "swiperclocklaunch.png",
"type": "bootloader", "type": "bootloader",