diff --git a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManager.kt b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManager.kt index 6c967e1441..d1731b12ff 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManager.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManager.kt @@ -172,5 +172,5 @@ interface BackgroundJobManager { fun startPeriodicallyOfflineOperation() fun scheduleInternal2WaySync(intervalMinutes: Long) fun cancelAllFilesDownloadJobs() - fun syncFolder(filePaths: List) + fun syncFolder(files: List) } diff --git a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt index be7d333b61..24badc052b 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt @@ -715,7 +715,9 @@ internal class BackgroundJobManagerImpl( workManager.enqueueUniquePeriodicWork(JOB_INTERNAL_TWO_WAY_SYNC, ExistingPeriodicWorkPolicy.UPDATE, request) } - override fun syncFolder(filePaths: List) { + override fun syncFolder(files: List) { + val filePaths = files.map { it.decryptedRemotePath } + val data = Data.Builder() .putStringArray(SyncWorker.FILE_PATHS, filePaths.toTypedArray()) .build() diff --git a/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadHelper.kt b/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadHelper.kt index 347d9bc152..7a263dc335 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadHelper.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadHelper.kt @@ -138,7 +138,7 @@ class FileDownloadHelper { ) } - fun syncFolder(filePaths: List) { - backgroundJobManager.syncFolder(filePaths) + fun syncFolder(files: List) { + backgroundJobManager.syncFolder(files) } } diff --git a/app/src/main/java/com/nextcloud/client/jobs/sync/SyncWorker.kt b/app/src/main/java/com/nextcloud/client/jobs/sync/SyncWorker.kt index 215421ef16..8b822d8894 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/sync/SyncWorker.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/sync/SyncWorker.kt @@ -59,7 +59,7 @@ class SyncWorker( val filePaths = inputData.getStringArray(FILE_PATHS) if (filePaths.isNullOrEmpty()) { - return@withContext Result.failure() + return@withContext Result.success() } val fileDataStorageManager = FileDataStorageManager(user, context.contentResolver) diff --git a/app/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java b/app/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java index 4e3b0fa984..2514801a50 100644 --- a/app/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -40,7 +40,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; @@ -501,13 +500,7 @@ public class SynchronizeFolderOperation extends SyncOperation { Log_OC.d(TAG, "Exception caught at startDirectDownloads" + e); } } else { - final var filePaths = new ArrayList(); - mFilesForDirectDownload.forEach(file -> filePaths.add(file.getDecryptedRemotePath())); - if (filePaths.isEmpty()) { - return; - } - - fileDownloadHelper.syncFolder(filePaths); + fileDownloadHelper.syncFolder(mFilesForDirectDownload); } }