Merge pull request #3489 from bobrippling/fix/swiperclock-detect

swiperclocklaunch: fix detection of clock
master
Rob Pilling 2024-07-05 12:43:51 +01:00 committed by GitHub
commit f4122d56b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 17 additions and 16 deletions

View File

@ -81,3 +81,4 @@ of 'Select Clock'
0.70: Fix load() typo
0.71: Minor code improvements
0.72: Add setting for configuring BLE privacy
0.73: Fix `const` bug / work with fastload

View File

@ -1,7 +1,7 @@
{
"id": "setting",
"name": "Settings",
"version": "0.72",
"version": "0.73",
"description": "A menu for setting up Bangle.js",
"icon": "settings.png",
"tags": "tool,system",

View File

@ -1,3 +1,4 @@
{
Bangle.loadWidgets();
Bangle.drawWidgets();
@ -984,3 +985,4 @@ function showTouchscreenCalibration() {
}
showMainMenu();
}

View File

@ -4,3 +4,4 @@
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.06: Handle apps that call setUI({}) to reset
0.07: Use a more reliable method of detecting a clock

View File

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

View File

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