From 854d2f9ade63f8e6ca459d290caa6bc176254feb Mon Sep 17 00:00:00 2001 From: crazysaem Date: Fri, 10 Dec 2021 14:41:49 +0000 Subject: [PATCH] ptlaunch: Make tap to confirm new pattern more reliable. Also allow for easier creation of single circle patterns. --- apps.json | 2 +- apps/ptlaunch/ChangeLog | 1 + apps/ptlaunch/README.md | 1 + apps/ptlaunch/app.js | 13 +++++++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/apps.json b/apps.json index fd2e14e60..af47e5a48 100644 --- a/apps.json +++ b/apps.json @@ -4829,7 +4829,7 @@ "id": "ptlaunch", "name": "Pattern Launcher", "shortName": "Pattern Launcher", - "version": "0.02", + "version": "0.03", "description": "Directly launch apps from the clock screen with custom patterns.", "icon": "app.png", "tags": "tools", diff --git a/apps/ptlaunch/ChangeLog b/apps/ptlaunch/ChangeLog index f50936885..f93cedeab 100644 --- a/apps/ptlaunch/ChangeLog +++ b/apps/ptlaunch/ChangeLog @@ -1,2 +1,3 @@ 0.01: Initial creation of the pattern launch app 0.02: Turn on lcd when launching an app if the lock screen was disabled in the settings +0.03: Make tap to confirm new pattern more reliable. Also allow for easier creation of single circle patterns. diff --git a/apps/ptlaunch/README.md b/apps/ptlaunch/README.md index a69492782..af91658a5 100644 --- a/apps/ptlaunch/README.md +++ b/apps/ptlaunch/README.md @@ -18,6 +18,7 @@ From the main menu you can: - Add a new pattern and link it to an app (first entry) - To create a new pattern first select "Add Pattern" - Now draw any pattern you like, this will later launch the linked app from the clock screen + - You can also draw a single-circle pattern (meaning a single tap on one circle) instead of drawing a 'complex' pattern - If you don't like the pattern, simply re-draw it. The previous pattern will be discarded. - If you are happy with the pattern tap on screen or press the button to continue - Now select the app you want to launch with the pattern. diff --git a/apps/ptlaunch/app.js b/apps/ptlaunch/app.js index 8ba1adf81..f5fad7897 100644 --- a/apps/ptlaunch/app.js +++ b/apps/ptlaunch/app.js @@ -147,13 +147,26 @@ var createPattern = () => { setWatch(() => finishHandler(), BTN); setTimeout(() => Bangle.on("tap", finishHandler), 250); + positions = []; var dragHandler = (position) => { + log(position); positions.push(position); debounce().then(() => { if (isFinished) { return; } + + // This might actually be a 'tap' event. + // Use this check in addition to the actual tap handler to make it more reliable + if (pattern.length > 0 && positions.length === 2) { + if (positions[0].x === positions[1].x && positions[0].y === positions[1].y) { + finishHandler(); + positions = []; + return; + } + } + E.showMessage("Calculating..."); var t0 = Date.now();