From 0b6b8cd5bff56945d3bfea5a6a6c4b2e2e0d1051 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.comā©> Date: Fri, 7 Jul 2023 13:19:45 +0200 Subject: [PATCH] Android: GB Activity tracks, handle first read ... when there is no id of the last read recorder log supplied from Gadgetbridge. --- apps/android/boot.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/android/boot.js b/apps/android/boot.js index 5ab0f87dd8..f18b0c06ad 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -201,8 +201,10 @@ "listRecs": function() { // GB({t:"listRecs", id:"20230616a"}) let recs = require("Storage").list(/^recorder\.log.*\.csv$/,{sf:true}).map(s => s.slice(12, 21)); + if (event.id.length > 2) { // Handle if there was no id supplied. Then we send a list all available recorder logs back. recs = recs.slice(recs.indexOf(event.id)); // FIXME: Currently does not handle if the last fetched log was deleted on the watch, so that there won't be any entry corresponding to `event.id` recs.shift(); + } Bluetooth.println(""); Bluetooth.println(JSON.stringify({t:"trksList", list: recs})); // TODO: split up in multiple transmissions? },