From d5ecada5665aae177ac19efae602a7f53cba8c60 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.comā©> Date: Sat, 17 Feb 2024 13:14:22 +0100 Subject: [PATCH] android: tweak activity track logic --- apps/android/boot.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/apps/android/boot.js b/apps/android/boot.js index 475f8deb28..3f443173be 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -244,14 +244,27 @@ "fetchRec": function() { // GB({t:"fetchRec", id:"20230616a"}) // TODO: Decide on what names keys should have. let log = require("Storage").open("recorder.log"+event.id+".csv","r"); - let line = log.readLine(); + let line = "init";// = log.readLine(); + while (line) { - gbSend({t:"actTrk", log:event.id, line:line, last:"false"}); line = log.readLine(); - if (!line) { - gbSend({t:"actTrk", log:event.id, line:"end of recorder log", last:event.last}); - } + gbSend({t:"actTrk", log:event.id, line:line}); } + + //// Alternate way to send line, to try and avoid getting malformated JSON lines to Gadgetbridge. + //// My thinking is maybe the Bangle.js bt send que (??) get to full sometimes, this was an attempt to mitigate that. + //// Initial tests rendered new problems. Might come back to this. + //let sendLine = ()=>{ + // line = log.readLine(); + // gbSend({t:"actTrk", log:event.id, line:line}); + // if (!line && fetchRecInterval) { + // clearInterval(fetchRecInterval); + // delete fetchRecInterval; + // } + //} + //fetchRecInterval = setInterval(sendLine, 100) + + }, "nav": function() {