mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-07-09 15:11:34 +02:00
Garmin: Remove handling of legacy cache directory
This commit is contained in:
parent
c3a6db3309
commit
ebe371de3c
|
@ -472,9 +472,6 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
|
||||||
private boolean isBusyFetching;
|
private boolean isBusyFetching;
|
||||||
|
|
||||||
private void processDownloadQueue() {
|
private void processDownloadQueue() {
|
||||||
|
|
||||||
moveFilesFromLegacyCache(); //TODO: remove before merging
|
|
||||||
|
|
||||||
if (!filesToDownload.isEmpty() && !fileTransferHandler.isDownloading()) {
|
if (!filesToDownload.isEmpty() && !fileTransferHandler.isDownloading()) {
|
||||||
if (!gbDevice.isBusy()) {
|
if (!gbDevice.isBusy()) {
|
||||||
isBusyFetching = true;
|
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() {
|
private void enableBatteryLevelUpdate() {
|
||||||
final ProtobufMessage batteryLevelProtobufRequest = protocolBufferHandler.prepareProtobufRequest(GdiSmartProto.Smart.newBuilder()
|
final ProtobufMessage batteryLevelProtobufRequest = protocolBufferHandler.prepareProtobufRequest(GdiSmartProto.Smart.newBuilder()
|
||||||
.setDeviceStatusService(
|
.setDeviceStatusService(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user