1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-24 14:00:48 +02:00

Garmin: Remove handling of legacy cache directory

This commit is contained in:
Daniele Gobbetti 2024-05-06 09:24:22 +02:00
parent c3a6db3309
commit ebe371de3c

View File

@ -472,9 +472,6 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
private boolean isBusyFetching;
private void processDownloadQueue() {
moveFilesFromLegacyCache(); //TODO: remove before merging
if (!filesToDownload.isEmpty() && !fileTransferHandler.isDownloading()) {
if (!gbDevice.isBusy()) {
isBusyFetching = true;
@ -545,36 +542,6 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
}
}
private void moveFilesFromLegacyCache() { //TODO: remove before merging
File legacyDir;
try {
legacyDir = new File(FileUtils.getExternalFilesDir() + "/" + FileUtils.makeValidFileName(getDevice().getName() + "_" + getDevice().getAddress()));
if (legacyDir.isDirectory()) {
final File newDir = getWritableExportDirectory();
File[] files = legacyDir.listFiles();
for (File file : files) {
if (file.isFile()) {
File destFile = new File(newDir, file.getName());
boolean success = file.renameTo(destFile);
if (!success) {
LOG.error("Failed to move file {}", file.getName());
} else {
LOG.info("Moved file {} to new cache directory", file.getName());
}
}
}
boolean removed = legacyDir.delete();
if (!removed) {
LOG.error("Failed to remove legacy directory: {}", legacyDir);
}
}
} catch (IOException e) {
LOG.error(e.getMessage());
}
}
private void enableBatteryLevelUpdate() {
final ProtobufMessage batteryLevelProtobufRequest = protocolBufferHandler.prepareProtobufRequest(GdiSmartProto.Smart.newBuilder()
.setDeviceStatusService(