|
@@ -15,7 +15,6 @@ import android.content.Intent;
|
|
|
import android.text.TextUtils;
|
|
|
|
|
|
import com.nextcloud.client.account.User;
|
|
|
-import com.nextcloud.client.jobs.download.FileDownloadHelper;
|
|
|
import com.owncloud.android.datamodel.FileDataStorageManager;
|
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
|
import com.owncloud.android.datamodel.e2e.v1.decrypted.DecryptedFolderMetadataFileV1;
|
|
@@ -40,7 +39,6 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Vector;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
-import java.util.function.Consumer;
|
|
|
|
|
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|
|
|
|
@@ -441,8 +439,28 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
|
|
}
|
|
|
|
|
|
private void startDirectDownloads() {
|
|
|
- final var fileDownloadHelper = FileDownloadHelper.Companion.instance();
|
|
|
- mFilesForDirectDownload.forEach(file -> fileDownloadHelper.downloadFile(user, file));
|
|
|
+ try {
|
|
|
+ for (OCFile file: mFilesForDirectDownload) {
|
|
|
+ if (file != null) {
|
|
|
+ // delay 1 second before each download
|
|
|
+ Thread.sleep(1000);
|
|
|
+
|
|
|
+ final var operation = new DownloadFileOperation(user, file, mContext);
|
|
|
+ var result = operation.execute(getClient());
|
|
|
+
|
|
|
+ String filename = file.getFileName();
|
|
|
+ if (filename != null) {
|
|
|
+ if (result.isSuccess()) {
|
|
|
+ Log_OC.d(TAG, "startDirectDownloads completed for: " + file.getFileName());
|
|
|
+ } else {
|
|
|
+ Log_OC.d(TAG, "startDirectDownloads failed for: " + file.getFileName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ Log_OC.d(TAG, "Exception caught at startDirectDownloads" + e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|