diff --git a/apps/widtwenties/ChangeLog b/apps/widtwenties/ChangeLog index 87935d810..c2fbd70a2 100644 --- a/apps/widtwenties/ChangeLog +++ b/apps/widtwenties/ChangeLog @@ -1,2 +1,3 @@ 0.01: New Widget! -0.02: Fix calling null on draw \ No newline at end of file +0.02: Fix calling null on draw +0.03: Only vibrate during work \ No newline at end of file diff --git a/apps/widtwenties/metadata.json b/apps/widtwenties/metadata.json index 2e51457ac..5695a0ed9 100644 --- a/apps/widtwenties/metadata.json +++ b/apps/widtwenties/metadata.json @@ -2,7 +2,7 @@ "id": "widtwenties", "name": "Twenties", "shortName": "twenties", - "version": "0.02", + "version": "0.03", "description": "Buzzes every 20m to stand / sit and look 20ft away for 20s.", "icon": "widget.png", "type": "widget", diff --git a/apps/widtwenties/widget.js b/apps/widtwenties/widget.js index 58bc622eb..f722f8d03 100644 --- a/apps/widtwenties/widget.js +++ b/apps/widtwenties/widget.js @@ -7,9 +7,15 @@ they don't interfere with currently-running apps */ const look = 20 * 1000; // 20 seconds buzz = _ => { - Bangle.buzz().then(_ => { - setTimeout(Bangle.buzz, look); - }); + 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); + }); + } }; // add widget @@ -21,4 +27,4 @@ they don't interfere with currently-running apps */ setInterval(WIDGETS.twenties.buzz, move); // buzz to stand / sit })(); -// Bangle.drawWidgets(); // <-- for development only \ No newline at end of file +// Bangle.drawWidgets(); // <-- for development only