1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-29 12:05:53 +01:00

Fixup: Introduce device specific writable directory (MAC address)

Add logic to not fetch again files which had the previously defined name
This commit is contained in:
Daniele Gobbetti 2024-05-03 12:22:15 +02:00
parent 8c88cc992a
commit 457ff8b88f
2 changed files with 7 additions and 1 deletions

View File

@ -341,6 +341,12 @@ public class FileTransferHandler implements MessageHandler {
return getFiletype().name() + "_" + dateString + "_" + getFileIndex() + (getFiletype().isFitFile() ? ".fit" : ".bin");
}
public String getLegacyFileName() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
String dateString = dateFormat.format(fileDate);
return getFiletype().name() + "_" + getFileIndex() + "_" + dateString + (getFiletype().isFitFile() ? ".fit" : ".bin");
}
@NonNull
@Override
public String toString() {

View File

@ -457,7 +457,7 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
try {
FileTransferHandler.DirectoryEntry directoryEntry = filesToDownload.remove();
while (checkFileExists(directoryEntry.getFileName())) {
while (checkFileExists(directoryEntry.getFileName()) || checkFileExists(directoryEntry.getLegacyFileName())) {
LOG.debug("File: {} already downloaded, not downloading again.", directoryEntry.getFileName());
if (!getKeepActivityDataOnDevice()) // delete file from watch if already downloaded
sendOutgoingMessage(new SetFileFlagsMessage(directoryEntry.getFileIndex(), SetFileFlagsMessage.FileFlags.ARCHIVE));