From 87f0ffcd96ee6c71432523b5d4ec3440fa757d96 Mon Sep 17 00:00:00 2001 From: Adam Schmalhofer Date: Sat, 18 Dec 2021 00:08:04 +0100 Subject: [PATCH 1/6] widhwt: Ported to Bangle.js2 Tactically all that was needed was to state that it works with Bangle.js2. However the swipe gesture interfered with using the menu on Bangle.js2. So it has been deactivated and we recommend using Pattern Launcher instead. --- apps.json | 7 ++++--- apps/widhwt/ChangeLog | 1 + apps/widhwt/app.js | 11 +++++++++++ apps/widhwt/widget.js | 14 ++++++++++---- 4 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 apps/widhwt/app.js diff --git a/apps.json b/apps.json index 8b4e86d52..f69889d50 100644 --- a/apps.json +++ b/apps.json @@ -1889,12 +1889,13 @@ { "id": "widhwt", "name": "Hand Wash Timer", - "version": "0.01", - "description": "Swipe your wrist over the watch face to start your personal Bangle.js hand wash timer for 35 sec. Start washing after the short buzz and stop after the long buzz.", + "version": "0.02-rc6", + "description": "On Bangle.js 1 swipe your wrist over the watch face to start your personal Bangle.js 1 hand wash timer. On Bangle.js2 the Pattern Launcher is recommended to start the timer. Start washing after the short buzz and stop after the long buzz 35sec. later.", "icon": "widget.png", "type": "widget", "tags": "widget,tool", - "supports": ["BANGLEJS"], + "allow_emulator": true, + "supports": ["BANGLEJS", "BANGLEJS2"], "storage": [ {"name":"widhwt.wid.js","url":"widget.js"} ] diff --git a/apps/widhwt/ChangeLog b/apps/widhwt/ChangeLog index 4c21f3ace..76c4fcec9 100644 --- a/apps/widhwt/ChangeLog +++ b/apps/widhwt/ChangeLog @@ -1 +1,2 @@ 0.01: New Widget! +0.02: Ported to Bangle.js2 diff --git a/apps/widhwt/app.js b/apps/widhwt/app.js new file mode 100644 index 000000000..68555d21d --- /dev/null +++ b/apps/widhwt/app.js @@ -0,0 +1,11 @@ +// Replace the "Loading..." box +// with our own message +g.clearRect(38, 68, 138, 108); +g.drawRect(38, 68, 138, 108); +g.setFontVector(13).drawString("Wash...", 60, 82); + +Bangle.buzz(); +setTimeout(() => { + Bangle.buzz(1E3, 1); + setTimeout(() => load(), 2E3); +}, 35E3); diff --git a/apps/widhwt/widget.js b/apps/widhwt/widget.js index d178a5b5d..5e1f95a41 100644 --- a/apps/widhwt/widget.js +++ b/apps/widhwt/widget.js @@ -6,9 +6,7 @@ g.reset().setColor(color).drawImage(require("heatshrink").decompress(atob("jEYwIKHgwCBhwCBh4CEggPCkACBmAXDBwVZ+EB+F4gEsjl8EgMP+EChk/gEMh+ehkA+YIBxwxBnF/4HggH/wEAj0AA==")), this.x + 1, 0); } - WIDGETS["widhwt"] = { area: "tr", width: 26, draw: draw }; - - Bangle.on('swipe', function() { + function startTimer() { color = 0x41f; Bangle.buzz(); Bangle.drawWidgets(); @@ -17,6 +15,14 @@ Bangle.buzz(1E3, 1); Bangle.drawWidgets(); }, 35E3); + } - }); + if (process.env.HWVERSION == 1) { + WIDGETS["widhwt"] = { + area: "tr", + width: 26, + draw: draw, + }; + Bangle.on('swipe', startTimer); + } })(); From d51c6679fe342ccb6058184b345ebc4e4816a98c Mon Sep 17 00:00:00 2001 From: Adam Schmalhofer Date: Sat, 18 Dec 2021 14:57:19 +0100 Subject: [PATCH 2/6] Bumped hwt version number --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index f69889d50..b4acc8f0c 100644 --- a/apps.json +++ b/apps.json @@ -1889,7 +1889,7 @@ { "id": "widhwt", "name": "Hand Wash Timer", - "version": "0.02-rc6", + "version": "0.02-rc7", "description": "On Bangle.js 1 swipe your wrist over the watch face to start your personal Bangle.js 1 hand wash timer. On Bangle.js2 the Pattern Launcher is recommended to start the timer. Start washing after the short buzz and stop after the long buzz 35sec. later.", "icon": "widget.png", "type": "widget", From c5536ee49a6508da2e7a1fac1298bdf9ed00ddba Mon Sep 17 00:00:00 2001 From: Adam Schmalhofer Date: Sat, 18 Dec 2021 17:37:04 +0100 Subject: [PATCH 3/6] hwt: Center "Wash ..." text properly --- apps.json | 2 +- apps/widhwt/app.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index b4acc8f0c..092584ecf 100644 --- a/apps.json +++ b/apps.json @@ -1889,7 +1889,7 @@ { "id": "widhwt", "name": "Hand Wash Timer", - "version": "0.02-rc7", + "version": "0.02-rc8", "description": "On Bangle.js 1 swipe your wrist over the watch face to start your personal Bangle.js 1 hand wash timer. On Bangle.js2 the Pattern Launcher is recommended to start the timer. Start washing after the short buzz and stop after the long buzz 35sec. later.", "icon": "widget.png", "type": "widget", diff --git a/apps/widhwt/app.js b/apps/widhwt/app.js index 68555d21d..2aaf7f08a 100644 --- a/apps/widhwt/app.js +++ b/apps/widhwt/app.js @@ -2,7 +2,9 @@ // with our own message g.clearRect(38, 68, 138, 108); g.drawRect(38, 68, 138, 108); -g.setFontVector(13).drawString("Wash...", 60, 82); +g.setFontVector(13).setFontAlign(0, 0, 0).drawString("Wash...", + g.getWidth()/2, + g.getHeight()/2); Bangle.buzz(); setTimeout(() => { From 51422c44c0fc89874b96fc893b3d06014de0f771 Mon Sep 17 00:00:00 2001 From: Adam Schmalhofer Date: Sat, 18 Dec 2021 18:46:16 +0100 Subject: [PATCH 4/6] hwt: Reduce line lenght --- apps.json | 2 +- apps/widhwt/app.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps.json b/apps.json index 092584ecf..cb991dbed 100644 --- a/apps.json +++ b/apps.json @@ -1889,7 +1889,7 @@ { "id": "widhwt", "name": "Hand Wash Timer", - "version": "0.02-rc8", + "version": "0.02-rc9", "description": "On Bangle.js 1 swipe your wrist over the watch face to start your personal Bangle.js 1 hand wash timer. On Bangle.js2 the Pattern Launcher is recommended to start the timer. Start washing after the short buzz and stop after the long buzz 35sec. later.", "icon": "widget.png", "type": "widget", diff --git a/apps/widhwt/app.js b/apps/widhwt/app.js index 2aaf7f08a..f18e78643 100644 --- a/apps/widhwt/app.js +++ b/apps/widhwt/app.js @@ -2,9 +2,9 @@ // with our own message g.clearRect(38, 68, 138, 108); g.drawRect(38, 68, 138, 108); -g.setFontVector(13).setFontAlign(0, 0, 0).drawString("Wash...", - g.getWidth()/2, - g.getHeight()/2); +g.setFontVector(13); +g.setFontAlign(0, 0, 0); +g.drawString("Wash...", g.getWidth()/2, g.getHeight()/2); Bangle.buzz(); setTimeout(() => { From 505ed38753a1a6611b9f5da7f4aa32789f0f69a0 Mon Sep 17 00:00:00 2001 From: Adam Schmalhofer Date: Sat, 18 Dec 2021 22:14:26 +0100 Subject: [PATCH 5/6] hwt: Add app.js to apps.json --- apps.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps.json b/apps.json index cb991dbed..d572a9aad 100644 --- a/apps.json +++ b/apps.json @@ -1889,7 +1889,7 @@ { "id": "widhwt", "name": "Hand Wash Timer", - "version": "0.02-rc9", + "version": "0.02-rc10", "description": "On Bangle.js 1 swipe your wrist over the watch face to start your personal Bangle.js 1 hand wash timer. On Bangle.js2 the Pattern Launcher is recommended to start the timer. Start washing after the short buzz and stop after the long buzz 35sec. later.", "icon": "widget.png", "type": "widget", @@ -1897,6 +1897,7 @@ "allow_emulator": true, "supports": ["BANGLEJS", "BANGLEJS2"], "storage": [ + {"name":"widhwt.app.js","url":"app.js"}, {"name":"widhwt.wid.js","url":"widget.js"} ] }, From 707118ffbbc92dc8869b5643fce60847521ef530 Mon Sep 17 00:00:00 2001 From: Adam Schmalhofer Date: Sun, 9 Jan 2022 19:04:00 +0100 Subject: [PATCH 6/6] Bumped Hand Wash Timer version number --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 6fbc82e8b..b73cfe0e6 100644 --- a/apps.json +++ b/apps.json @@ -1893,7 +1893,7 @@ { "id": "widhwt", "name": "Hand Wash Timer", - "version": "0.02-rc10", + "version": "0.02", "description": "On Bangle.js 1 swipe your wrist over the watch face to start your personal Bangle.js 1 hand wash timer. On Bangle.js2 the Pattern Launcher is recommended to start the timer. Start washing after the short buzz and stop after the long buzz 35sec. later.", "icon": "widget.png", "type": "widget",