mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-10-14 17:09:35 +02:00
Garmin: use developer device setting for keeping data on device
Make use of the previously added preference to toggle file archival (deletion) on the watch. Default is true (keep data on device) until we are sure of the consequences.
This commit is contained in:
parent
bcb8f7504d
commit
b75ecae454
@ -237,13 +237,17 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
|
|||||||
} else if (deviceEvent instanceof FileDownloadedDeviceEvent) {
|
} else if (deviceEvent instanceof FileDownloadedDeviceEvent) {
|
||||||
LOG.debug("FILE DOWNLOAD COMPLETE {}", ((FileDownloadedDeviceEvent) deviceEvent).directoryEntry.getFileName());
|
LOG.debug("FILE DOWNLOAD COMPLETE {}", ((FileDownloadedDeviceEvent) deviceEvent).directoryEntry.getFileName());
|
||||||
|
|
||||||
if (false) // delete file from watch upon successful download TODO: add device setting
|
if (!getKeepActivityDataOnDevice()) // delete file from watch upon successful download
|
||||||
sendOutgoingMessage(new SetFileFlagsMessage(((FileDownloadedDeviceEvent) deviceEvent).directoryEntry.getFileIndex(), SetFileFlagsMessage.FileFlags.ARCHIVE));
|
sendOutgoingMessage(new SetFileFlagsMessage(((FileDownloadedDeviceEvent) deviceEvent).directoryEntry.getFileIndex(), SetFileFlagsMessage.FileFlags.ARCHIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
super.evaluateGBDeviceEvent(deviceEvent);
|
super.evaluateGBDeviceEvent(deviceEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean getKeepActivityDataOnDevice() {
|
||||||
|
return getDevicePrefs().getBoolean("keep_activity_data_on_device", true); // TODO: change to default false once we are sure of the consequences
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFetchRecordedData(final int dataTypes) {
|
public void onFetchRecordedData(final int dataTypes) {
|
||||||
if (this.supportedFileTypeList.isEmpty()) {
|
if (this.supportedFileTypeList.isEmpty()) {
|
||||||
@ -419,7 +423,7 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
|
|||||||
FileTransferHandler.DirectoryEntry directoryEntry = filesToDownload.remove();
|
FileTransferHandler.DirectoryEntry directoryEntry = filesToDownload.remove();
|
||||||
while (checkFileExists(directoryEntry.getFileName())) {
|
while (checkFileExists(directoryEntry.getFileName())) {
|
||||||
LOG.debug("File: {} already downloaded, not downloading again.", directoryEntry.getFileName());
|
LOG.debug("File: {} already downloaded, not downloading again.", directoryEntry.getFileName());
|
||||||
if (false) // delete file from watch if already downloaded TODO: add device setting
|
if (!getKeepActivityDataOnDevice()) // delete file from watch if already downloaded
|
||||||
sendOutgoingMessage(new SetFileFlagsMessage(directoryEntry.getFileIndex(), SetFileFlagsMessage.FileFlags.ARCHIVE));
|
sendOutgoingMessage(new SetFileFlagsMessage(directoryEntry.getFileIndex(), SetFileFlagsMessage.FileFlags.ARCHIVE));
|
||||||
directoryEntry = filesToDownload.remove();
|
directoryEntry = filesToDownload.remove();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user