Skip to content

Commit

Permalink
fix code analytics
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Dec 18, 2024
1 parent 6566438 commit a0799b9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,5 @@ interface BackgroundJobManager {
fun startPeriodicallyOfflineOperation()
fun scheduleInternal2WaySync(intervalMinutes: Long)
fun cancelAllFilesDownloadJobs()
fun syncFolder(filePaths: List<String>)
fun syncFolder(files: List<OCFile>)
}
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,9 @@ internal class BackgroundJobManagerImpl(
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()
.putStringArray(SyncWorker.FILE_PATHS, filePaths.toTypedArray())
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class FileDownloadHelper {
)
}

fun syncFolder(filePaths: List<String>) {
backgroundJobManager.syncFolder(filePaths)
fun syncFolder(files: List<OCFile>) {
backgroundJobManager.syncFolder(files)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
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;

Expand Down Expand Up @@ -501,13 +500,7 @@ private void startDirectDownloads() {
Log_OC.d(TAG, "Exception caught at startDirectDownloads" + e);
}
} else {
final var filePaths = new ArrayList<String>();
mFilesForDirectDownload.forEach(file -> filePaths.add(file.getDecryptedRemotePath()));
if (filePaths.isEmpty()) {
return;
}

fileDownloadHelper.syncFolder(filePaths);
fileDownloadHelper.syncFolder(mFilesForDirectDownload);
}
}

Expand Down

0 comments on commit a0799b9

Please sign in to comment.