fix code analytics

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-12-12 16:04:42 +01:00 committed by Alper Öztürk
parent f1cbb590eb
commit b39269d926
5 changed files with 8 additions and 13 deletions

View file

@ -172,5 +172,5 @@ interface BackgroundJobManager {
fun startPeriodicallyOfflineOperation() fun startPeriodicallyOfflineOperation()
fun scheduleInternal2WaySync(intervalMinutes: Long) fun scheduleInternal2WaySync(intervalMinutes: Long)
fun cancelAllFilesDownloadJobs() fun cancelAllFilesDownloadJobs()
fun syncFolder(filePaths: List<String>) fun syncFolder(files: List<OCFile>)
} }

View file

@ -715,7 +715,9 @@ internal class BackgroundJobManagerImpl(
workManager.enqueueUniquePeriodicWork(JOB_INTERNAL_TWO_WAY_SYNC, ExistingPeriodicWorkPolicy.UPDATE, request) workManager.enqueueUniquePeriodicWork(JOB_INTERNAL_TWO_WAY_SYNC, ExistingPeriodicWorkPolicy.UPDATE, request)
} }
override fun syncFolder(filePaths: List<String>) { override fun syncFolder(files: List<OCFile>) {
val filePaths = files.map { it.decryptedRemotePath }
val data = Data.Builder() val data = Data.Builder()
.putStringArray(SyncWorker.FILE_PATHS, filePaths.toTypedArray()) .putStringArray(SyncWorker.FILE_PATHS, filePaths.toTypedArray())
.build() .build()

View file

@ -138,7 +138,7 @@ class FileDownloadHelper {
) )
} }
fun syncFolder(filePaths: List<String>) { fun syncFolder(files: List<OCFile>) {
backgroundJobManager.syncFolder(filePaths) backgroundJobManager.syncFolder(files)
} }
} }

View file

@ -59,7 +59,7 @@ class SyncWorker(
val filePaths = inputData.getStringArray(FILE_PATHS) val filePaths = inputData.getStringArray(FILE_PATHS)
if (filePaths.isNullOrEmpty()) { if (filePaths.isNullOrEmpty()) {
return@withContext Result.failure() return@withContext Result.success()
} }
val fileDataStorageManager = FileDataStorageManager(user, context.contentResolver) val fileDataStorageManager = FileDataStorageManager(user, context.contentResolver)

View file

@ -40,7 +40,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Vector; import java.util.Vector;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 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); Log_OC.d(TAG, "Exception caught at startDirectDownloads" + e);
} }
} else { } else {
final var filePaths = new ArrayList<String>(); fileDownloadHelper.syncFolder(mFilesForDirectDownload);
mFilesForDirectDownload.forEach(file -> filePaths.add(file.getDecryptedRemotePath()));
if (filePaths.isEmpty()) {
return;
}
fileDownloadHelper.syncFolder(filePaths);
} }
} }