From 4a2342fb554826efb6ee36a1b53081e761dc9fb7 Mon Sep 17 00:00:00 2001 From: thyttan <97237430+thyttan@users.noreply.github.com> Date: Wed, 9 Nov 2022 23:34:40 +0100 Subject: [PATCH 1/5] Comply w FW changes --- apps/torch/app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/torch/app.js b/apps/torch/app.js index e3f1ab89c..0dd376926 100644 --- a/apps/torch/app.js +++ b/apps/torch/app.js @@ -11,14 +11,16 @@ Bangle.setLCDBrightness(1); Bangle.setLCDPower(1); Bangle.setLCDTimeout(0); g.reset(); +bgBackup = g.theme.bg; g.setTheme({bg:settings.bg,fg:"#000"}); g.setColor(settings.bg); g.fillRect(0,0,g.getWidth(),g.getHeight()); Bangle.setUI({ mode : 'custom', - back : load, // B2: Clicking the hardware button or pressing upper left corner turns off (where red back button would be) - btn : (n)=>{ // B1: Any button turns off - if (process.env.HWVERSION==1 && (n==1 || n==2 || n==3)) { + back : ()=>{g.setTheme({bg:bgBackup});load();}, // B2: SW back button + btn : (n)=>{ // B1&2: Any HW button turns off + if (n==1 || n==2 || n==3) { + g.setTheme({bg:bgBackup}); load(); } } From b785ac3d3a4013ad59005aa6c2d01ad30863631e Mon Sep 17 00:00:00 2001 From: thyttan <97237430+thyttan@users.noreply.github.com> Date: Wed, 9 Nov 2022 23:35:59 +0100 Subject: [PATCH 2/5] Update ChangeLog --- apps/torch/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/torch/ChangeLog b/apps/torch/ChangeLog index 27d880e78..ab3580a03 100644 --- a/apps/torch/ChangeLog +++ b/apps/torch/ChangeLog @@ -6,3 +6,4 @@ 0.06: Press upper left corner to exit on Bangle.js 2 0.07: Code tweaks 0.08: Force background of widget field to the torch colour +0.09: Change code taking FW tweaks into account From 2a0e417fc99c73502b653e5d9f01a55050f5857f Mon Sep 17 00:00:00 2001 From: thyttan <97237430+thyttan@users.noreply.github.com> Date: Wed, 9 Nov 2022 23:36:20 +0100 Subject: [PATCH 3/5] Update metadata.json --- apps/torch/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/torch/metadata.json b/apps/torch/metadata.json index aff8dee37..207b2c4be 100644 --- a/apps/torch/metadata.json +++ b/apps/torch/metadata.json @@ -2,7 +2,7 @@ "id": "torch", "name": "Torch", "shortName": "Torch", - "version": "0.08", + "version": "0.09", "description": "Turns screen white to help you see in the dark. Select from the launcher or press BTN1,BTN3,BTN1,BTN3 quickly to start when in any app that shows widgets on Bangle.js 1. You can also set the color through the app's setting menu.", "icon": "app.png", "tags": "tool,torch", From dfa39f9cff4889abe7bdcafd3d9bf2cb2f2236e6 Mon Sep 17 00:00:00 2001 From: thyttan <97237430+thyttan@users.noreply.github.com> Date: Thu, 10 Nov 2022 16:27:45 +0100 Subject: [PATCH 4/5] remove code unnecessary on standard app loader --- apps/torch/app.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/torch/app.js b/apps/torch/app.js index 0dd376926..f3ffcfc2c 100644 --- a/apps/torch/app.js +++ b/apps/torch/app.js @@ -11,17 +11,13 @@ Bangle.setLCDBrightness(1); Bangle.setLCDPower(1); Bangle.setLCDTimeout(0); g.reset(); -bgBackup = g.theme.bg; g.setTheme({bg:settings.bg,fg:"#000"}); g.setColor(settings.bg); g.fillRect(0,0,g.getWidth(),g.getHeight()); Bangle.setUI({ mode : 'custom', - back : ()=>{g.setTheme({bg:bgBackup});load();}, // B2: SW back button + back : load, // B2: SW back button btn : (n)=>{ // B1&2: Any HW button turns off - if (n==1 || n==2 || n==3) { - g.setTheme({bg:bgBackup}); - load(); - } + if (n==1 || n==2 || n==3) load(); // n==4, n==5 is triggered by left/right press of touch screen on B1 and should not exit clock } }); From 9a9a6751ec4a29900ab950c841b30b53a711c7ef Mon Sep 17 00:00:00 2001 From: thyttan <97237430+thyttan@users.noreply.github.com> Date: Thu, 10 Nov 2022 16:43:47 +0100 Subject: [PATCH 5/5] remove unnecessary if-statement --- apps/torch/app.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/torch/app.js b/apps/torch/app.js index f3ffcfc2c..87f869531 100644 --- a/apps/torch/app.js +++ b/apps/torch/app.js @@ -16,8 +16,6 @@ g.setColor(settings.bg); g.fillRect(0,0,g.getWidth(),g.getHeight()); Bangle.setUI({ mode : 'custom', - back : load, // B2: SW back button - btn : (n)=>{ // B1&2: Any HW button turns off - if (n==1 || n==2 || n==3) load(); // n==4, n==5 is triggered by left/right press of touch screen on B1 and should not exit clock - } + back : load, // B2: SW back button to exit + btn : ()=>{load();}, // B1&2: HW button to exit. // A simple 'load' as on the line above did not work for btn??? });