From 15b0876aaae7bda84320731a076aaab259faf13b Mon Sep 17 00:00:00 2001 From: Marco H Date: Tue, 3 Jan 2023 12:41:05 +0100 Subject: [PATCH 01/11] Step goal reached notifications --- apps/health/boot.js | 23 +++++++++++++++++++++++ apps/health/settings.js | 11 ++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/apps/health/boot.js b/apps/health/boot.js index 7b9aa51aa..e73d37c69 100644 --- a/apps/health/boot.js +++ b/apps/health/boot.js @@ -36,6 +36,10 @@ Bangle.on("health", health => { const DB_HEADER_LEN = 8; const DB_FILE_LEN = DB_HEADER_LEN + DB_RECORDS_PER_MONTH*DB_RECORD_LEN; + if (health && health.steps > 0) { + handleStepGoalNotification(); + } + function getRecordFN(d) { return "health-"+d.getFullYear()+"-"+(d.getMonth()+1)+".raw"; } @@ -92,3 +96,22 @@ Bangle.on("health", health => { health.movement /= health.movCnt; require("Storage").write(fn, getRecordData(health), sumPos, DB_FILE_LEN); }); + +function handleStepGoalNotification() { + var settings = require("Storage").readJSON("health.json",1)||{}; + const steps = Bangle.getHealthStatus("day").steps; + if (settings.stepGoalNotification && settings.stepGoal > 0 && steps >= settings.stepGoal) { + const now = new Date(Date.now()).toISOString().split('T')[0]; // yyyy-mm-dd + if (!settings.stepGoalNotificationDate || settings.stepGoalNotificationDate < now) { // notification not yet shown today? + Bangle.buzz(200, 0.5); + /*LANG*/E.showPrompt("You reached your daily goal of " + settings.stepGoal + " steps!", { + /*LANG*/title: "Step goal reached!", + buttons: { "Ok": 1} + }).then(function (v) { + load(); + }); + settings.stepGoalNotificationDate = now; + require("Storage").writeJSON("health.json", settings); + } + } +} diff --git a/apps/health/settings.js b/apps/health/settings.js index f94efbb16..e7b0a7c15 100644 --- a/apps/health/settings.js +++ b/apps/health/settings.js @@ -1,7 +1,8 @@ (function (back) { var settings = Object.assign({ hrm: 0, - stepGoal: 10000 + stepGoal: 10000, + stepGoalNotification: false }, require("Storage").readJSON("health.json", true) || {}); E.showMenu({ @@ -34,6 +35,14 @@ settings.stepGoal = v; setSettings(settings); } + }, + /*LANG*/"Step Goal Notification": { + value: "stepGoalNotification" in settings ? settings.stepGoalNotification : false, + format: () => (settings.stepGoalNotification ? 'Yes' : 'No'), + onchange: () => { + settings.stepGoalNotification = !settings.stepGoalNotification; + setSettings(); + } } }); From 5707962f62308109a44af85c52a7d09048f36860 Mon Sep 17 00:00:00 2001 From: Marco H Date: Tue, 3 Jan 2023 12:52:23 +0100 Subject: [PATCH 02/11] Update README --- apps/health/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/health/README.md b/apps/health/README.md index 3cc234a3f..c7facfea1 100644 --- a/apps/health/README.md +++ b/apps/health/README.md @@ -24,7 +24,8 @@ Stores: * **Off** - Don't turn HRM on, but record heart rate if the HRM was turned on by another app/widget * **10 Min** - Turn HRM on every 10 minutes (for each heath entry) and turn it off after 2 minutes, or when a good reading is found * **Always** - Keep HRM on all the time (more accurate recording, but reduces battery life to ~36 hours) -* **Daily Step Goal** - Default 10000, daily step goal for pedometer apps to use +* **Daily Step Goal** - Default 10000, daily step goal for pedometer apps to use and for the step goal notification +* **Step Goal Notification** - True if you want a notification when the daily step goal is reached ## Technical Info From 6358325ec4276defdbdb9db3af365c5bb51171e7 Mon Sep 17 00:00:00 2001 From: Marco H Date: Wed, 4 Jan 2023 08:15:41 +0100 Subject: [PATCH 03/11] Fix translation --- apps/health/boot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/health/boot.js b/apps/health/boot.js index e73d37c69..3a438cb0e 100644 --- a/apps/health/boot.js +++ b/apps/health/boot.js @@ -104,8 +104,8 @@ function handleStepGoalNotification() { const now = new Date(Date.now()).toISOString().split('T')[0]; // yyyy-mm-dd if (!settings.stepGoalNotificationDate || settings.stepGoalNotificationDate < now) { // notification not yet shown today? Bangle.buzz(200, 0.5); - /*LANG*/E.showPrompt("You reached your daily goal of " + settings.stepGoal + " steps!", { - /*LANG*/title: "Step goal reached!", + E.showPrompt(/*LANG*/"You reached your daily goal of " + settings.stepGoal + " steps!", { + title: /*LANG*/"Step goal reached!", buttons: { "Ok": 1} }).then(function (v) { load(); From dd8040af5d6fb9f3a6d08e109d2d600fbf87cf8c Mon Sep 17 00:00:00 2001 From: Marco H Date: Wed, 4 Jan 2023 10:24:12 +0100 Subject: [PATCH 04/11] Use LCDOverlay for notificiation on Bangle.js 2 --- apps/health/boot.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/apps/health/boot.js b/apps/health/boot.js index 3a438cb0e..d318f6a2c 100644 --- a/apps/health/boot.js +++ b/apps/health/boot.js @@ -104,12 +104,26 @@ function handleStepGoalNotification() { const now = new Date(Date.now()).toISOString().split('T')[0]; // yyyy-mm-dd if (!settings.stepGoalNotificationDate || settings.stepGoalNotificationDate < now) { // notification not yet shown today? Bangle.buzz(200, 0.5); - E.showPrompt(/*LANG*/"You reached your daily goal of " + settings.stepGoal + " steps!", { - title: /*LANG*/"Step goal reached!", - buttons: { "Ok": 1} - }).then(function (v) { - load(); - }); + if (process.env.BOARD == "BANGLEJS2") { + var medal = atob("MDCBAAAAAAAAAAAAAAAAAAA/+D/4AAB//H/8AAB//H/8AAB//v/4AAA8H/B4AAA+H/D4AAAeD+DwAAAfD+HwAAAPB8HgAAAPh8PgAAAHg8PAAAAHw8PAAAADw+eAAAAD4eeAAAAB4f+AAAAB8P8AAAAA//8AAAAA//4AAAAA//8AAAAB//+AAAAD+B/AAAAH4AfgAAAPgAHwAAAPAADwAAAfAAD4AAAeAAB4AAA+AAB8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA+AAB4AAAeAAB4AAAfAAD4AAAPAADwAAAPgAHwAAAH4AfgAAAD+B/AAAAB//+AAAAA//8AAAAAP/wAAAAAD+AAAAAAAAAAAAAAAAAAAA=="); + var ovr = Graphics.createArrayBuffer(g.getWidth(),g.getHeight(),1,{msb:true}); + ovr.drawImage(medal, 10, 10); + ovr.setFont("Vector:18").setFontAlign(0, 0, 0); + ovr.drawString(/*LANG*/settings.stepGoal + " steps", g.getWidth() / 2 + 24 , 10 + 24); + ovr.drawString(/*LANG*/"Step goal reached!", g.getWidth() / 2, g.getHeight() / 2); + Bangle.setLCDOverlay(ovr,0,0); + setWatch(function() { + Bangle.setLCDOverlay(); + }, BTN); + } else { + E.showPrompt(/*LANG*/"You reached your daily goal of " + settings.stepGoal + " steps!", { + title: /*LANG*/"Step goal reached!", + buttons: { "Ok": 1} + }).then(function (v) { + load(); + }); + } + settings.stepGoalNotificationDate = now; require("Storage").writeJSON("health.json", settings); } From 3816c9ba211407e72e742305c6cffd27a857b9d5 Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 5 Jan 2023 11:56:20 +0100 Subject: [PATCH 05/11] Update boot.min.js --- apps/health/boot.min.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/health/boot.min.js b/apps/health/boot.min.js index 00313a1f5..1215baf1f 100644 --- a/apps/health/boot.min.js +++ b/apps/health/boot.min.js @@ -1,4 +1,6 @@ -(function(){var a=0|(require("Storage").readJSON("health.json",1)||{}).hrm;if(1==a||2==a){function f(){Bangle.setHRMPower(1,"health");setTimeout(()=>Bangle.setHRMPower(0,"health"),6E4*a);if(1==a)for(var b=1;2>=b;b++)setTimeout(()=>{Bangle.setHRMPower(1,"health");setTimeout(()=>{Bangle.setHRMPower(0,"health")},2E5*b+6E4)},2E5*b)}Bangle.on("health",f);Bangle.on("HRM",b=>{80{function f(c){return String.fromCharCode(c.steps>>8,c.steps&255,c.bpm,Math.min(c.movement/8,255))}var b=new Date(Date.now()-59E4),e=function(c){return 145*(c.getDate()-1)+6*c.getHours()+(0|6*c.getMinutes()/60)}(b);b=function(c){return"health-"+c.getFullYear()+"-"+(c.getMonth()+1)+".raw"}(b);var g=require("Storage").read(b);if(g){var d=g.substr(8+4*e,4);if("\u00ff\u00ff\u00ff\u00ff"!=d){print("HEALTH ERR: Already written!");return}}else require("Storage").write(b, -"HEALTH1\x00",0,17988);var h=8+4*e;require("Storage").write(b,f(a),h,17988);if(143==e%145)if(e=h+4,"\u00ff\u00ff\u00ff\u00ff"!=g.substr(e,4))print("HEALTH ERR: Daily summary already written!");else{a={steps:0,bpm:0,movement:0,movCnt:0,bpmCnt:0};for(var k=0;144>k;k++)d=g.substr(h,4),"\u00ff\u00ff\u00ff\u00ff"!=d&&(a.steps+=(d.charCodeAt(0)<<8)+d.charCodeAt(1),a.movement+=d.charCodeAt(2),a.movCnt++,d=d.charCodeAt(2),a.bpm+=d,d&&a.bpmCnt++),h-=4;a.bpmCnt&&(a.bpm/=a.bpmCnt);a.movCnt&&(a.movement/=a.movCnt); -require("Storage").write(b,f(a),e,17988)}}) \ No newline at end of file +function m(){var a=require("Storage").readJSON("health.json",1)||{},e=Bangle.getHealthStatus("day").steps;if(a.stepGoalNotification&&0=a.stepGoal&&(e=(new Date(Date.now())).toISOString().split("T")[0],!a.stepGoalNotificationDate||a.stepGoalNotificationDate=b;b++)setTimeout(function(){Bangle.setHRMPower(1,"health");setTimeout(function(){Bangle.setHRMPower(0,"health")},2E5*b+6E4)},2E5*b)};Bangle.on("health",e);Bangle.on("HRM",function(b){80>8,d.steps&255,d.bpm,Math.min(d.movement/8,255))}var b=new Date(Date.now()-59E4);a&&0l;l++)f=h.substr(k,4),"\u00ff\u00ff\u00ff\u00ff"!=f&&(a.steps+=(f.charCodeAt(0)<<8)+f.charCodeAt(1),a.movement+=f.charCodeAt(2),a.movCnt++,f=f.charCodeAt(2),a.bpm+= +f,f&&a.bpmCnt++),k-=4;a.bpmCnt&&(a.bpm/=a.bpmCnt);a.movCnt&&(a.movement/=a.movCnt);require("Storage").write(b,e(a),c,17988)}}) \ No newline at end of file From dda8d2ece15f83e1ce93acdc8ffb304a6192459a Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 5 Jan 2023 12:08:54 +0100 Subject: [PATCH 06/11] Add ChangeLog and increase version --- apps/health/ChangeLog | 1 + apps/health/metadata.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/health/ChangeLog b/apps/health/ChangeLog index 87a58a57b..fb97552b1 100644 --- a/apps/health/ChangeLog +++ b/apps/health/ChangeLog @@ -17,3 +17,4 @@ 0.16: Code tidyup, add back button in top left of health app graphs 0.17: Add automatic translation of bar chart labels 0.18: Show step goal in daily step chart +0.19: Can show notification when daily step goal is reached diff --git a/apps/health/metadata.json b/apps/health/metadata.json index ecaf9b563..ec5905b71 100644 --- a/apps/health/metadata.json +++ b/apps/health/metadata.json @@ -2,7 +2,7 @@ "id": "health", "name": "Health Tracking", "shortName": "Health", - "version": "0.18", + "version": "0.19", "description": "Logs health data and provides an app to view it", "icon": "app.png", "tags": "tool,system,health", From e90acffa7d0ff5ac148abef64c9c1a4e37706fe1 Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 5 Jan 2023 19:47:18 +0100 Subject: [PATCH 07/11] Improve notification on B2 when widgets are visible --- apps/health/boot.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/health/boot.js b/apps/health/boot.js index d318f6a2c..122b971fd 100644 --- a/apps/health/boot.js +++ b/apps/health/boot.js @@ -105,12 +105,13 @@ function handleStepGoalNotification() { if (!settings.stepGoalNotificationDate || settings.stepGoalNotificationDate < now) { // notification not yet shown today? Bangle.buzz(200, 0.5); if (process.env.BOARD == "BANGLEJS2") { + const widgetOffset = 24; var medal = atob("MDCBAAAAAAAAAAAAAAAAAAA/+D/4AAB//H/8AAB//H/8AAB//v/4AAA8H/B4AAA+H/D4AAAeD+DwAAAfD+HwAAAPB8HgAAAPh8PgAAAHg8PAAAAHw8PAAAADw+eAAAAD4eeAAAAB4f+AAAAB8P8AAAAA//8AAAAA//4AAAAA//8AAAAB//+AAAAD+B/AAAAH4AfgAAAPgAHwAAAPAADwAAAfAAD4AAAeAAB4AAA+AAB8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA+AAB4AAAeAAB4AAAfAAD4AAAPAADwAAAPgAHwAAAH4AfgAAAD+B/AAAAB//+AAAAA//8AAAAAP/wAAAAAD+AAAAAAAAAAAAAAAAAAAA=="); var ovr = Graphics.createArrayBuffer(g.getWidth(),g.getHeight(),1,{msb:true}); - ovr.drawImage(medal, 10, 10); + ovr.drawImage(medal, 10, widgetOffset + 10); ovr.setFont("Vector:18").setFontAlign(0, 0, 0); - ovr.drawString(/*LANG*/settings.stepGoal + " steps", g.getWidth() / 2 + 24 , 10 + 24); - ovr.drawString(/*LANG*/"Step goal reached!", g.getWidth() / 2, g.getHeight() / 2); + ovr.drawString(/*LANG*/settings.stepGoal + " steps", g.getWidth() / 2 + 24 , widgetOffset + 10 + 24); + ovr.drawString(/*LANG*/"Step goal reached!", g.getWidth() / 2, widgetOffset + g.getHeight() / 2); Bangle.setLCDOverlay(ovr,0,0); setWatch(function() { Bangle.setLCDOverlay(); From d9e080e7b8b2245e1e7962ad5387b7ba4c183568 Mon Sep 17 00:00:00 2001 From: Marco H Date: Fri, 6 Jan 2023 15:27:17 +0100 Subject: [PATCH 08/11] Use notify library for notification --- apps/health/boot.js | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/apps/health/boot.js b/apps/health/boot.js index d318f6a2c..a559145a9 100644 --- a/apps/health/boot.js +++ b/apps/health/boot.js @@ -105,23 +105,16 @@ function handleStepGoalNotification() { if (!settings.stepGoalNotificationDate || settings.stepGoalNotificationDate < now) { // notification not yet shown today? Bangle.buzz(200, 0.5); if (process.env.BOARD == "BANGLEJS2") { - var medal = atob("MDCBAAAAAAAAAAAAAAAAAAA/+D/4AAB//H/8AAB//H/8AAB//v/4AAA8H/B4AAA+H/D4AAAeD+DwAAAfD+HwAAAPB8HgAAAPh8PgAAAHg8PAAAAHw8PAAAADw+eAAAAD4eeAAAAB4f+AAAAB8P8AAAAA//8AAAAA//4AAAAA//8AAAAB//+AAAAD+B/AAAAH4AfgAAAPgAHwAAAPAADwAAAfAAD4AAAeAAB4AAA+AAB8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA+AAB4AAAeAAB4AAAfAAD4AAAPAADwAAAPgAHwAAAH4AfgAAAD+B/AAAAB//+AAAAA//8AAAAAP/wAAAAAD+AAAAAAAAAAAAAAAAAAAA=="); - var ovr = Graphics.createArrayBuffer(g.getWidth(),g.getHeight(),1,{msb:true}); - ovr.drawImage(medal, 10, 10); - ovr.setFont("Vector:18").setFontAlign(0, 0, 0); - ovr.drawString(/*LANG*/settings.stepGoal + " steps", g.getWidth() / 2 + 24 , 10 + 24); - ovr.drawString(/*LANG*/"Step goal reached!", g.getWidth() / 2, g.getHeight() / 2); - Bangle.setLCDOverlay(ovr,0,0); - setWatch(function() { - Bangle.setLCDOverlay(); - }, BTN); - } else { - E.showPrompt(/*LANG*/"You reached your daily goal of " + settings.stepGoal + " steps!", { - title: /*LANG*/"Step goal reached!", - buttons: { "Ok": 1} - }).then(function (v) { - load(); + require("notify").show({ + title : /*LANG*/ settings.stepGoal + " steps", + body : /*LANG*/ "Step goal reached!", + src : "health", + icon : atob( + "MDCBAAAAAAAAAAAAAAAAAAA/+D/4AAB//H/8AAB//H/8AAB//v/4AAA8H/B4AAA+H/D4AAAeD+DwAAAfD+HwAAAPB8HgAAAPh8PgAAAHg8PAAAAHw8PAAAADw+eAAAAD4eeAAAAB4f+AAAAB8P8AAAAA//8AAAAA//4AAAAA//8AAAAB//+AAAAD+B/AAAAH4AfgAAAPgAHwAAAPAADwAAAfAAD4AAAeAAB4AAA+AAB8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA+AAB4AAAeAAB4AAAfAAD4AAAPAADwAAAPgAHwAAAH4AfgAAAD+B/AAAAB//+AAAAA//8AAAAAP/wAAAAAD+AAAAAAAAAAAAAAAAAAAA==") }); + } else { + E.showPrompt(/*LANG*/ "You reached your daily goal of " + settings.stepGoal + " steps!", + {title : /*LANG*/ "Step goal reached!", buttons : {"Ok" : 1}}).then(function(v) { load(); }); } settings.stepGoalNotificationDate = now; From 1e0b07b563cc33212a9d0754676f5d03b56b0691 Mon Sep 17 00:00:00 2001 From: Marco H Date: Fri, 6 Jan 2023 15:33:14 +0100 Subject: [PATCH 09/11] Use notify library for B1 and B2 Minify boot.js --- apps/health/boot.js | 18 +++++------------- apps/health/boot.min.js | 11 +++++------ apps/health/metadata.json | 3 ++- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/apps/health/boot.js b/apps/health/boot.js index a559145a9..a3712b7e3 100644 --- a/apps/health/boot.js +++ b/apps/health/boot.js @@ -104,19 +104,11 @@ function handleStepGoalNotification() { const now = new Date(Date.now()).toISOString().split('T')[0]; // yyyy-mm-dd if (!settings.stepGoalNotificationDate || settings.stepGoalNotificationDate < now) { // notification not yet shown today? Bangle.buzz(200, 0.5); - if (process.env.BOARD == "BANGLEJS2") { - require("notify").show({ - title : /*LANG*/ settings.stepGoal + " steps", - body : /*LANG*/ "Step goal reached!", - src : "health", - icon : atob( - "MDCBAAAAAAAAAAAAAAAAAAA/+D/4AAB//H/8AAB//H/8AAB//v/4AAA8H/B4AAA+H/D4AAAeD+DwAAAfD+HwAAAPB8HgAAAPh8PgAAAHg8PAAAAHw8PAAAADw+eAAAAD4eeAAAAB4f+AAAAB8P8AAAAA//8AAAAA//4AAAAA//8AAAAB//+AAAAD+B/AAAAH4AfgAAAPgAHwAAAPAADwAAAfAAD4AAAeAAB4AAA+AAB8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA+AAB4AAAeAAB4AAAfAAD4AAAPAADwAAAPgAHwAAAH4AfgAAAD+B/AAAAB//+AAAAA//8AAAAAP/wAAAAAD+AAAAAAAAAAAAAAAAAAAA==") - }); - } else { - E.showPrompt(/*LANG*/ "You reached your daily goal of " + settings.stepGoal + " steps!", - {title : /*LANG*/ "Step goal reached!", buttons : {"Ok" : 1}}).then(function(v) { load(); }); - } - + require("notify").show({ + title : /*LANG*/"8000 steps", + body : /*LANG*/ "You reached your step goal!", + icon : atob("DAyBABmD6BaBMAsA8BCBCBCBCA8AAA==") + }); settings.stepGoalNotificationDate = now; require("Storage").writeJSON("health.json", settings); } diff --git a/apps/health/boot.min.js b/apps/health/boot.min.js index 1215baf1f..963da9c6b 100644 --- a/apps/health/boot.min.js +++ b/apps/health/boot.min.js @@ -1,6 +1,5 @@ -function m(){var a=require("Storage").readJSON("health.json",1)||{},e=Bangle.getHealthStatus("day").steps;if(a.stepGoalNotification&&0=a.stepGoal&&(e=(new Date(Date.now())).toISOString().split("T")[0],!a.stepGoalNotificationDate||a.stepGoalNotificationDate=b;b++)setTimeout(function(){Bangle.setHRMPower(1,"health");setTimeout(function(){Bangle.setHRMPower(0,"health")},2E5*b+6E4)},2E5*b)};Bangle.on("health",e);Bangle.on("HRM",function(b){80>8,d.steps&255,d.bpm,Math.min(d.movement/8,255))}var b=new Date(Date.now()-59E4);a&&0l;l++)f=h.substr(k,4),"\u00ff\u00ff\u00ff\u00ff"!=f&&(a.steps+=(f.charCodeAt(0)<<8)+f.charCodeAt(1),a.movement+=f.charCodeAt(2),a.movCnt++,f=f.charCodeAt(2),a.bpm+= -f,f&&a.bpmCnt++),k-=4;a.bpmCnt&&(a.bpm/=a.bpmCnt);a.movCnt&&(a.movement/=a.movCnt);require("Storage").write(b,e(a),c,17988)}}) \ No newline at end of file +function l(){var a=require("Storage").readJSON("health.json",1)||{},d=Bangle.getHealthStatus("day").steps;a.stepGoalNotification&&0=a.stepGoal&&(d=(new Date(Date.now())).toISOString().split("T")[0],!a.stepGoalNotificationDate||a.stepGoalNotificationDate=b;b++)setTimeout(function(){Bangle.setHRMPower(1,"health");setTimeout(function(){Bangle.setHRMPower(0,"health")},2E5*b+6E4)},2E5*b)};Bangle.on("health",d);Bangle.on("HRM",function(b){80>8,c.steps&255,c.bpm,Math.min(c.movement/8,255))}var b=new Date(Date.now()-59E4);a&&0k;k++)e=g.substr(h,4),"\u00ff\u00ff\u00ff\u00ff"!=e&&(a.steps+=(e.charCodeAt(0)<<8)+e.charCodeAt(1),a.movement+=e.charCodeAt(2),a.movCnt++,e=e.charCodeAt(2),a.bpm+=e,e&&a.bpmCnt++),h-=4;a.bpmCnt&&(a.bpm/= +a.bpmCnt);a.movCnt&&(a.movement/=a.movCnt);require("Storage").write(b,d(a),f,17988)}}) \ No newline at end of file diff --git a/apps/health/metadata.json b/apps/health/metadata.json index ec5905b71..aba9f5ce3 100644 --- a/apps/health/metadata.json +++ b/apps/health/metadata.json @@ -16,5 +16,6 @@ {"name":"health","url":"lib.min.js"}, {"name":"health.settings.js","url":"settings.js"} ], - "data": [{"name":"health.json"}] + "data": [{"name":"health.json"}], + "dependencies": {"notify":"type"}, } From 73f63839a8774dc3bd8657f983389ab2909ae676 Mon Sep 17 00:00:00 2001 From: Marco H Date: Fri, 6 Jan 2023 15:35:58 +0100 Subject: [PATCH 10/11] Don't use fixed step goal --- apps/health/boot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/health/boot.js b/apps/health/boot.js index a3712b7e3..0f4e6c832 100644 --- a/apps/health/boot.js +++ b/apps/health/boot.js @@ -105,7 +105,7 @@ function handleStepGoalNotification() { if (!settings.stepGoalNotificationDate || settings.stepGoalNotificationDate < now) { // notification not yet shown today? Bangle.buzz(200, 0.5); require("notify").show({ - title : /*LANG*/"8000 steps", + title : /*LANG*/ settings.stepGoal + " steps", body : /*LANG*/ "You reached your step goal!", icon : atob("DAyBABmD6BaBMAsA8BCBCBCBCA8AAA==") }); From 69e01a68942e48fe9232207f86bbf231fe2750cd Mon Sep 17 00:00:00 2001 From: Marco H Date: Fri, 6 Jan 2023 15:37:09 +0100 Subject: [PATCH 11/11] Fix JSON --- apps/health/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/health/metadata.json b/apps/health/metadata.json index aba9f5ce3..704101138 100644 --- a/apps/health/metadata.json +++ b/apps/health/metadata.json @@ -17,5 +17,5 @@ {"name":"health.settings.js","url":"settings.js"} ], "data": [{"name":"health.json"}], - "dependencies": {"notify":"type"}, + "dependencies": {"notify":"type"} }