Skip to content

Commit

Permalink
android:actTrk: fix find index and return list
Browse files Browse the repository at this point in the history
  • Loading branch information
thyttan committed Mar 9, 2024
1 parent e58e00b commit 450cdb6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/android/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,12 @@
"listRecs": function() {
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.
let isFirstNonsyncedIdx = recs.findIndex((logId) => logId > event.id);
recs = recs.slice(isFirstNonsyncedIdx+1);
let firstNonsyncedIdx = recs.findIndex((logId) => logId > event.id);
if (-1 == firstNonsyncedIdx) {
recs = []
} else {
recs = recs.slice(firstNonsyncedIdx);
}
}
gbSend({t:"actTrksList", list: recs}); // TODO: split up in multiple transmissions?
},
Expand Down

0 comments on commit 450cdb6

Please sign in to comment.