From 5ca4db69d7636ee9578ab1366911ea886f754fb8 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Sun, 11 Jun 2023 14:36:40 +0100 Subject: [PATCH 1/2] swiperclocklaunch: ensure we clear old listeners too Previously we wouldn't clear old listeners, which meant that they'd remain hanging around, potentially interfering with the currently shown app/clock. We now remember to clear them too, so setUI behaves as a proper reset. See #2809 for more details. --- apps/swiperclocklaunch/boot.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/swiperclocklaunch/boot.js b/apps/swiperclocklaunch/boot.js index ea00a6735..11abb84c9 100644 --- a/apps/swiperclocklaunch/boot.js +++ b/apps/swiperclocklaunch/boot.js @@ -1,7 +1,13 @@ (function() { var sui = Bangle.setUI; + var oldSwipe; + Bangle.setUI = function(mode, cb) { + if (oldSwipe && oldSwipe !== Bangle.swipeHandler) + Bangle.removeListener("swipe", oldSwipe); sui(mode,cb); + oldSwipe = Bangle.swipeHandler; + if(!mode) return; if ("object"==typeof mode) mode = mode.mode; if (mode.startsWith("clock")) { From fc273a81c811477a4d85c51aae0ba9221fe0e891 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Sun, 11 Jun 2023 14:41:14 +0100 Subject: [PATCH 2/2] swiperclocklaunch: bump version --- apps/swiperclocklaunch/ChangeLog | 1 + apps/swiperclocklaunch/metadata.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/swiperclocklaunch/ChangeLog b/apps/swiperclocklaunch/ChangeLog index e7ad4555c..f62e10940 100644 --- a/apps/swiperclocklaunch/ChangeLog +++ b/apps/swiperclocklaunch/ChangeLog @@ -2,3 +2,4 @@ 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 +0.05: Keep track of event listeners we "overwrite", and remove them at the start of setUI diff --git a/apps/swiperclocklaunch/metadata.json b/apps/swiperclocklaunch/metadata.json index 4f27da528..d46c56693 100644 --- a/apps/swiperclocklaunch/metadata.json +++ b/apps/swiperclocklaunch/metadata.json @@ -1,7 +1,7 @@ { "id": "swiperclocklaunch", "name": "Swiper Clock Launch", - "version": "0.04", + "version": "0.05", "description": "Navigate between clock and launcher with Swipe action", "icon": "swiperclocklaunch.png", "type": "bootloader",