diff --git a/apps/twenties/ChangeLog b/apps/twenties/ChangeLog new file mode 100644 index 000000000..89eb9547f --- /dev/null +++ b/apps/twenties/ChangeLog @@ -0,0 +1,4 @@ +0.01: New Widget! +0.02: Fix calling null on draw +0.03: Only vibrate during work +0.04: Convert to boot code \ No newline at end of file diff --git a/apps/twenties/README.md b/apps/twenties/README.md new file mode 100644 index 000000000..8ee917b0e --- /dev/null +++ b/apps/twenties/README.md @@ -0,0 +1,17 @@ +# 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 Bangle 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 app and it will automatically run in the background. + +## Features + +Vibrates to remind you to stand up and look away for healthy living. + +Only vibrates during work days and hours. + +## Creator + +[@splch](https://github.com/splch/) diff --git a/apps/widtwenties/widget.png b/apps/twenties/app.png similarity index 100% rename from apps/widtwenties/widget.png rename to apps/twenties/app.png diff --git a/apps/twenties/boot.js b/apps/twenties/boot.js new file mode 100644 index 000000000..180f4cbb7 --- /dev/null +++ b/apps/twenties/boot.js @@ -0,0 +1,18 @@ +(() => { + const move = 20 * 60 * 1000; // 20 minutes + const look = 20 * 1000; // 20 seconds + + buzz = _ => { + const date = new Date(); + const day = date.getDay(); + const hour = date.getHours(); + // buzz at work + if (day <= 5 && hour >= 8 && hour <= 17) { + Bangle.buzz().then(_ => { + setTimeout(Bangle.buzz, look); + }); + } + }; + + setInterval(buzz, move); // buzz to stand / sit +})(); \ No newline at end of file diff --git a/apps/widtwenties/metadata.json b/apps/twenties/metadata.json similarity index 52% rename from apps/widtwenties/metadata.json rename to apps/twenties/metadata.json index 2e51457ac..b1dfe2134 100644 --- a/apps/widtwenties/metadata.json +++ b/apps/twenties/metadata.json @@ -1,13 +1,13 @@ { - "id": "widtwenties", + "id": "twenties", "name": "Twenties", "shortName": "twenties", - "version": "0.02", + "version": "0.04", "description": "Buzzes every 20m to stand / sit and look 20ft away for 20s.", - "icon": "widget.png", - "type": "widget", - "tags": "widget,tools", + "icon": "app.png", + "type": "bootloader", + "tags": "alarm,tool", "supports": ["BANGLEJS", "BANGLEJS2"], "readme": "README.md", - "storage": [{ "name": "widtwenties.wid.js", "url": "widget.js" }] + "storage": [{ "name": "twenties.boot.js", "url": "boot.js" }] } diff --git a/apps/widtwenties/ChangeLog b/apps/widtwenties/ChangeLog deleted file mode 100644 index 87935d810..000000000 --- a/apps/widtwenties/ChangeLog +++ /dev/null @@ -1,2 +0,0 @@ -0.01: New Widget! -0.02: Fix calling null on draw \ No newline at end of file diff --git a/apps/widtwenties/README.md b/apps/widtwenties/README.md deleted file mode 100644 index 1dea18b8e..000000000 --- a/apps/widtwenties/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# 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](https://github.com/splch/) diff --git a/apps/widtwenties/widget.js b/apps/widtwenties/widget.js deleted file mode 100644 index 58bc622eb..000000000 --- a/apps/widtwenties/widget.js +++ /dev/null @@ -1,24 +0,0 @@ -// 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: _ => { return null; }, - }; - - setInterval(WIDGETS.twenties.buzz, move); // buzz to stand / sit -})(); - -// Bangle.drawWidgets(); // <-- for development only \ No newline at end of file