From 9cab0af8b4b0ce270520197ca878882dbb8e1e9e Mon Sep 17 00:00:00 2001 From: Spencer Churchill Date: Sun, 4 Sep 2022 11:48:19 -0700 Subject: [PATCH 1/4] adds personal work-from-home health widget --- apps/widtwenties/ChangeLog | 1 + apps/widtwenties/README.md | 15 +++++++++++++++ apps/widtwenties/metadata.json | 13 +++++++++++++ apps/widtwenties/widget.js | 24 ++++++++++++++++++++++++ apps/widtwenties/widget.png | Bin 0 -> 1454 bytes 5 files changed, 53 insertions(+) create mode 100644 apps/widtwenties/ChangeLog create mode 100644 apps/widtwenties/README.md create mode 100644 apps/widtwenties/metadata.json create mode 100644 apps/widtwenties/widget.js create mode 100644 apps/widtwenties/widget.png diff --git a/apps/widtwenties/ChangeLog b/apps/widtwenties/ChangeLog new file mode 100644 index 000000000..4c21f3ace --- /dev/null +++ b/apps/widtwenties/ChangeLog @@ -0,0 +1 @@ +0.01: New Widget! diff --git a/apps/widtwenties/README.md b/apps/widtwenties/README.md new file mode 100644 index 000000000..e4f679989 --- /dev/null +++ b/apps/widtwenties/README.md @@ -0,0 +1,15 @@ +# Twenties + +Follow the [20-20-20 rule](https://www.aoa.org/AOA/Images/Patients/Eye%20Conditions/20-20-20-rule.pdf) with discrete reminders. Your BangleJS will buzz every 20 minutes for you to look away from your screen, and then buzz 20 seconds later to look back. Additionally, alternate between standing and sitting every 20 minutes to be standing for [more than 30 minutes](https://uwaterloo.ca/kinesiology-health-sciences/how-long-should-you-stand-rather-sit-your-work-station) per hour. + +## Usage + +Download this widget and as long as your watch-face supports widgets, it will automatically run in the background. + +## Features + +Vibrate to remind you to stand up and look away for healthy living. + +## Creator + +@splch diff --git a/apps/widtwenties/metadata.json b/apps/widtwenties/metadata.json new file mode 100644 index 000000000..ebc393a47 --- /dev/null +++ b/apps/widtwenties/metadata.json @@ -0,0 +1,13 @@ +{ + "id": "widtwenties", + "name": "Twenties", + "shortName": "twenties", + "version": "0.01", + "description": "Buzzes every 20m to stand / sit and look 20ft away for 20s.", + "icon": "widget.png", + "type": "widget", + "tags": "widget,tools", + "supports": ["BANGLEJS", "BANGLEJS2"], + "readme": "README.md", + "storage": [{ "name": "widtwenties.wid.js", "url": "widget.js" }] +} diff --git a/apps/widtwenties/widget.js b/apps/widtwenties/widget.js new file mode 100644 index 000000000..b38f91d80 --- /dev/null +++ b/apps/widtwenties/widget.js @@ -0,0 +1,24 @@ +// WIDGETS = {}; // <-- for development only + +/* run widgets in their own function scope so +they don't interfere with currently-running apps */ +(() => { + const move = 20 * 60 * 1000; // 20 minutes + const look = 20 * 1000; // 20 seconds + + buzz = _ => { + Bangle.buzz().then(_ => { + setTimeout(Bangle.buzz, look); + }); + }; + + // add widget + WIDGETS.twenties = { + buzz: buzz, + draw: null, + }; + + setInterval(WIDGETS.twenties.buzz, move); // buzz to stand / sit +})(); + +// Bangle.drawWidgets(); // <-- for development only \ No newline at end of file diff --git a/apps/widtwenties/widget.png b/apps/widtwenties/widget.png new file mode 100644 index 0000000000000000000000000000000000000000..7c6b02055d39c48ec885b7489966a5b6cd06e642 GIT binary patch literal 1454 zcmXX_3pkWn7#_EXrIf6+MM?-6=Ko#Sm>WjhPRy_=WKu0{dWc9RNiJPz?IYFNt*IpT=%fDx`&-0z{Kj;15^M3Dlo^$SaQ#`db4K-0Hl(rX{ zL#YPLEvr=m`nQAH~bv3-r3ikz|+2+6=LJf5~cs@xSY?Fs{Tx3#-wD8QKz z%kqwW4s5D*S;VgPu`jh?p*zIq8hV#`0-@yQg1r`%(OM#rO~Dc{FyZ06^j5Frqp?E) z)wt<_(wZD%$mX;6h-4bxWn@gjv8`jxCB#Zl(#2r9k928h@chiJ@?eciu2 zIJ3pA=qQFo#c^-|hnQ4*mJh_D+A=9HlL|9^AtnvjgTREf5i~pCmQBTcIUk2S8jeAS z*;I&4g$w+Ef_2^rhd%-~{(`+g5L4g>vwSf?fejS?KUFZ<;K2DlQF$~=aIqRMQ7JUk zUiyQYPtrAnbK|J7eoQNZ6bEnJlZA-mkqD>}K?m32VruEJT#h%)Y35$%ChlIZ&8*wj zc(J9SV^2>IFKcL&E1Z`P4Gs3ME_{?A^1lVc?L$+%u`W(W$11;jE_=9dyzTw$snz#*F%qw{yK~R(Ja^sP=FV zhzyT8pAWnmdQ$3%A8R$$NV;KgS6Am;T|Q+`Kx%2nh)me`#;yExP%da`b0qnAGz#UK ztQbmte->W?56Q}lg!hg6JtKQOc)P7ZqDooLi!jv>G+ncUd{$N-t5Tg*e^ce+vCux!NDmA!mU50=56g?owB84}?Bw5#Nk<*1K-!p&9w=UnUvrm95gAGve=LV5UBBRz7-`aRjA2WxskS zE0J!e7uL|mL}7o`RBN!#$78)zRMzw->6uEKEh##%Z9X*oLbGn>BQ$34(i$Lzq{ z<*2Fuwd3Y4C%&<#ZX2HB__**ZI-`xInse}Ru?9LRft+mRUl~?v;;%gMU9`kJs61ZH zV61h$#m_fXnxotte6RnGT&|t+;mqmo1Cy2)1XAmO3Llq`m*XnA8L@-Xp!zCy;^oeh z*D{k2hbNpn{$>Irn=URBkkNIjC&7)(Btpd^L1rFE9ToW^`Gr+jHV<)u1@e zbVZ{&A-Ag Date: Sun, 4 Sep 2022 11:55:56 -0700 Subject: [PATCH 2/4] return null instead of calling null --- apps/widtwenties/ChangeLog | 1 + apps/widtwenties/widget.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/widtwenties/ChangeLog b/apps/widtwenties/ChangeLog index 4c21f3ace..87935d810 100644 --- a/apps/widtwenties/ChangeLog +++ b/apps/widtwenties/ChangeLog @@ -1 +1,2 @@ 0.01: New Widget! +0.02: Fix calling null on draw \ No newline at end of file diff --git a/apps/widtwenties/widget.js b/apps/widtwenties/widget.js index b38f91d80..58bc622eb 100644 --- a/apps/widtwenties/widget.js +++ b/apps/widtwenties/widget.js @@ -15,7 +15,7 @@ they don't interfere with currently-running apps */ // add widget WIDGETS.twenties = { buzz: buzz, - draw: null, + draw: _ => { return null; }, }; setInterval(WIDGETS.twenties.buzz, move); // buzz to stand / sit From 062cd82eca1602098e35128151194c82d1c402fc Mon Sep 17 00:00:00 2001 From: Spencer Churchill Date: Sun, 4 Sep 2022 11:58:25 -0700 Subject: [PATCH 3/4] version and grammar fixes --- apps/widtwenties/README.md | 2 +- apps/widtwenties/metadata.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/widtwenties/README.md b/apps/widtwenties/README.md index e4f679989..484edfe3f 100644 --- a/apps/widtwenties/README.md +++ b/apps/widtwenties/README.md @@ -4,7 +4,7 @@ Follow the [20-20-20 rule](https://www.aoa.org/AOA/Images/Patients/Eye%20Conditi ## Usage -Download this widget and as long as your watch-face supports widgets, it will automatically run in the background. +Download this widget and, as long as your watch-face supports widgets, it will automatically run in the background. ## Features diff --git a/apps/widtwenties/metadata.json b/apps/widtwenties/metadata.json index ebc393a47..2e51457ac 100644 --- a/apps/widtwenties/metadata.json +++ b/apps/widtwenties/metadata.json @@ -2,7 +2,7 @@ "id": "widtwenties", "name": "Twenties", "shortName": "twenties", - "version": "0.01", + "version": "0.02", "description": "Buzzes every 20m to stand / sit and look 20ft away for 20s.", "icon": "widget.png", "type": "widget", From ecfca7d8b637b15fc208d08aa6ff5f93729a54b7 Mon Sep 17 00:00:00 2001 From: Spencer Churchill Date: Sun, 4 Sep 2022 12:11:27 -0700 Subject: [PATCH 4/4] link github username to profile --- apps/widtwenties/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/widtwenties/README.md b/apps/widtwenties/README.md index 484edfe3f..1dea18b8e 100644 --- a/apps/widtwenties/README.md +++ b/apps/widtwenties/README.md @@ -12,4 +12,4 @@ Vibrate to remind you to stand up and look away for healthy living. ## Creator -@splch +[@splch](https://github.com/splch/)