mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Garmin: Fix activity fetch getting stuck on error
If fetch unknown files was enabled, an INDEX_UNKNOWN might sometimes be received for some of the files, which would make the activity fetch get stuck as we do not check the isDownloading() state anymore.
This commit is contained in:
+7
-1
@@ -141,8 +141,14 @@ public CreateFileMessage initiateUpload(byte[] fileAsByteArray, FileType.FILETYP
|
||||
throw new IllegalStateException("Received file transfer of unknown file");
|
||||
if (downloadRequestStatusMessage.canProceed())
|
||||
currentlyDownloading.setSize(downloadRequestStatusMessage);
|
||||
else
|
||||
else {
|
||||
// Signal to the support class that the download failed so it can also continue to the next one
|
||||
FileDownloadedDeviceEvent fileDownloadedDeviceEvent = new FileDownloadedDeviceEvent();
|
||||
fileDownloadedDeviceEvent.directoryEntry = currentlyDownloading.directoryEntry;
|
||||
fileDownloadedDeviceEvent.success = false;
|
||||
deviceSupport.evaluateGBDeviceEvent(fileDownloadedDeviceEvent);
|
||||
currentlyDownloading = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void saveFileToExternalStorage() {
|
||||
|
||||
+7
@@ -383,6 +383,13 @@ public class GarminSupport extends AbstractBTLESingleDeviceSupport implements IC
|
||||
this.supportedFileTypeList.addAll(((SupportedFileTypesDeviceEvent) deviceEvent).getSupportedFileTypes());
|
||||
} else if (deviceEvent instanceof FileDownloadedDeviceEvent fileDownloadedDeviceEvent) {
|
||||
final FileTransferHandler.DirectoryEntry entry = fileDownloadedDeviceEvent.directoryEntry;
|
||||
if (!fileDownloadedDeviceEvent.success) {
|
||||
LOG.warn("FILE DOWNLOAD FAILED");
|
||||
// Continue to the next one
|
||||
currentlyDownloading = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry != null) {
|
||||
final String filename = entry.getFileName();
|
||||
LOG.debug("FILE DOWNLOAD COMPLETE {}", filename);
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.FileTransferHandler;
|
||||
|
||||
public class FileDownloadedDeviceEvent extends GBDeviceEvent {
|
||||
public boolean success = true;
|
||||
public FileTransferHandler.DirectoryEntry directoryEntry;
|
||||
public String localPath;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user