Skip to content

Commit ba7d29d

Browse files
Merge pull request #14020 from nextcloud/backport/14018/stable-3.30
[stable-3.30] save info to DB after downloading file
2 parents 60a4c60 + ea48116 commit ba7d29d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: app/src/main/java/com/owncloud/android/operations/SynchronizeFileOperation.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ private void requestForUpload(OCFile file) {
301301
}
302302

303303
private void requestForDownload(OCFile file) {
304+
final var fileDownloadHelper = FileDownloadHelper.Companion.instance();
305+
304306
if (syncInBackgroundWorker) {
305307
Log_OC.d("InternalTwoWaySyncWork", "download file: " + file.getFileName());
306308

@@ -313,6 +315,7 @@ private void requestForDownload(OCFile file) {
313315
String filename = file.getFileName();
314316
if (filename != null) {
315317
if (result.isSuccess()) {
318+
fileDownloadHelper.saveFile(file, operation, getStorageManager());
316319
Log_OC.d(TAG, "requestForDownload completed for: " + file.getFileName());
317320
} else {
318321
Log_OC.d(TAG, "requestForDownload failed for: " + file.getFileName());
@@ -322,7 +325,7 @@ private void requestForDownload(OCFile file) {
322325
Log_OC.d(TAG, "Exception caught at requestForDownload" + e);
323326
}
324327
} else {
325-
FileDownloadHelper.Companion.instance().downloadFile(mUser, file);
328+
fileDownloadHelper.downloadFile(mUser, file);
326329
}
327330
}
328331

Diff for: app/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,8 @@ private void syncContents() throws OperationCancelledException {
446446
}
447447

448448
private void startDirectDownloads() {
449+
final var fileDownloadHelper = FileDownloadHelper.Companion.instance();
450+
449451
if (syncInBackgroundWorker) {
450452
try {
451453
for (OCFile file: mFilesForDirectDownload) {
@@ -468,6 +470,7 @@ private void startDirectDownloads() {
468470
}
469471

470472
if (result.isSuccess()) {
473+
fileDownloadHelper.saveFile(file, operation, getStorageManager());
471474
Log_OC.d(TAG, "startDirectDownloads completed for: " + file.getFileName());
472475
} else {
473476
Log_OC.d(TAG, "startDirectDownloads failed for: " + file.getFileName());
@@ -477,7 +480,6 @@ private void startDirectDownloads() {
477480
Log_OC.d(TAG, "Exception caught at startDirectDownloads" + e);
478481
}
479482
} else {
480-
final var fileDownloadHelper = FileDownloadHelper.Companion.instance();
481483
mFilesForDirectDownload.forEach(file -> fileDownloadHelper.downloadFile(user, file));
482484
}
483485
}

0 commit comments

Comments
 (0)