1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 18:45:49 +01:00

Bangle.js:actTrk: Auto-reload when fetch done

This commit is contained in:
Ganblejs 2024-03-03 18:15:09 +01:00 committed by José Rebelo
parent e492160531
commit bfa5d94587

View File

@ -83,6 +83,7 @@ public class BangleJSActivityTrack extends BangleJSDeviceSupport {
LOG.info("New recorder logs since last fetch: " + String.valueOf(tracksList)); LOG.info("New recorder logs since last fetch: " + String.valueOf(tracksList));
if (tracksList.length()==0) { if (tracksList.length()==0) {
device.unsetBusyTask(); device.unsetBusyTask();
device.sendDeviceUpdateIntent(context);
GB.updateTransferNotification(context.getString(R.string.busy_task_fetch_activity_data), "", false, 100, context); GB.updateTransferNotification(context.getString(R.string.busy_task_fetch_activity_data), "", false, 100, context);
return null; return null;
} else { } else {
@ -122,6 +123,7 @@ public class BangleJSActivityTrack extends BangleJSDeviceSupport {
LOG.info("packetCount Aborting: " + prevPacketCount); LOG.info("packetCount Aborting: " + prevPacketCount);
returnArray = new JSONArray().put(stopObj).put(tracksList).put(prevPacketCount); returnArray = new JSONArray().put(stopObj).put(tracksList).put(prevPacketCount);
device.unsetBusyTask(); device.unsetBusyTask();
device.sendDeviceUpdateIntent(context);
GB.updateTransferNotification(context.getString(R.string.busy_task_fetch_activity_data), "", false, 100, context); GB.updateTransferNotification(context.getString(R.string.busy_task_fetch_activity_data), "", false, 100, context);
return returnArray; return returnArray;
} }
@ -143,19 +145,19 @@ public class BangleJSActivityTrack extends BangleJSDeviceSupport {
parseFetchedRecorderCSV(dir, filename, log, device, context); parseFetchedRecorderCSV(dir, filename, log, device, context);
if (tracksList.length()==0) { if (tracksList.length()==0) {
device.unsetBusyTask(); device.unsetBusyTask();
device.sendDeviceUpdateIntent(context);
GB.updateTransferNotification(context.getString(R.string.busy_task_fetch_activity_data), "", false, 100, context); GB.updateTransferNotification(context.getString(R.string.busy_task_fetch_activity_data), "", false, 100, context);
int resetPacketCount = -1; int resetPacketCount = -1;
LOG.info("packetCount reset1: " + resetPacketCount); LOG.info("packetCount reset1: " + resetPacketCount);
returnArray = new JSONArray().put(null).put(tracksList).put(resetPacketCount); returnArray = new JSONArray().put(null).put(tracksList).put(resetPacketCount);
return returnArray;
} else { } else {
JSONObject requestTrackObj = BangleJSActivityTrack.compileTrackRequest(tracksList.getString(0), 1==tracksList.length()); JSONObject requestTrackObj = BangleJSActivityTrack.compileTrackRequest(tracksList.getString(0), 1==tracksList.length());
tracksList.remove(0); tracksList.remove(0);
int resetPacketCount = -1; int resetPacketCount = -1;
LOG.info("packetCount reset2: " + resetPacketCount); LOG.info("packetCount reset2: " + resetPacketCount);
returnArray = new JSONArray().put(requestTrackObj).put(tracksList).put(resetPacketCount); returnArray = new JSONArray().put(requestTrackObj).put(tracksList).put(resetPacketCount);
return returnArray;
} }
return returnArray;
} else { // We received a lines of the csv, now we append it to the file in storage. } else { // We received a lines of the csv, now we append it to the file in storage.
String lines = json.getString("lines"); String lines = json.getString("lines");