From 45eb06fbd1ae155cb6430adccac2cf3ead8284f1 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Fri, 4 Nov 2022 14:10:18 +0000 Subject: [PATCH] swiper 0.04: Update to work with new 'fast switch' clock->launcher functionality --- apps/swiperclocklaunch/ChangeLog | 1 + apps/swiperclocklaunch/boot.js | 30 ++++++++++++++-------------- apps/swiperclocklaunch/metadata.json | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/apps/swiperclocklaunch/ChangeLog b/apps/swiperclocklaunch/ChangeLog index 244b602b5..e7ad4555c 100644 --- a/apps/swiperclocklaunch/ChangeLog +++ b/apps/swiperclocklaunch/ChangeLog @@ -1,3 +1,4 @@ 0.01: New App! 0.02: Fix issue with mode being undefined 0.03: Update setUI to work with new Bangle.js 2v13 menu style +0.04: Update to work with new 'fast switch' clock->launcher functionality diff --git a/apps/swiperclocklaunch/boot.js b/apps/swiperclocklaunch/boot.js index bb285ea94..ea00a6735 100644 --- a/apps/swiperclocklaunch/boot.js +++ b/apps/swiperclocklaunch/boot.js @@ -1,19 +1,19 @@ -// clock -> launcher (function() { - var sui = Bangle.setUI; - Bangle.setUI = function(mode, cb) { - sui(mode,cb); - if(!mode) return; - if ("object"==typeof mode) mode = mode.mode; - if (!mode.startsWith("clock")) return; - Bangle.swipeHandler = dir => { if (dir<0) Bangle.showLauncher(); }; - Bangle.on("swipe", Bangle.swipeHandler); - }; -})(); -// launcher -> clock -setTimeout(function() { - if (global.__FILE__ && __FILE__.endsWith(".app.js") && (require("Storage").readJSON(__FILE__.slice(0,-6)+"info",1)||{}).type=="launch") { + var sui = Bangle.setUI; + Bangle.setUI = function(mode, cb) { + sui(mode,cb); + if(!mode) return; + if ("object"==typeof mode) mode = mode.mode; + if (mode.startsWith("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); + } } -}, 10); + }; +})(); diff --git a/apps/swiperclocklaunch/metadata.json b/apps/swiperclocklaunch/metadata.json index 5e4a0d648..4f27da528 100644 --- a/apps/swiperclocklaunch/metadata.json +++ b/apps/swiperclocklaunch/metadata.json @@ -1,7 +1,7 @@ { "id": "swiperclocklaunch", "name": "Swiper Clock Launch", - "version": "0.03", + "version": "0.04", "description": "Navigate between clock and launcher with Swipe action", "icon": "swiperclocklaunch.png", "type": "bootloader",