fix spotless

Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
This commit is contained in:
Jonas Mayer 2024-05-16 19:54:24 +02:00 committed by Jonas Mayer
parent 46eaf83a5a
commit 8bb1eaaf2e
5 changed files with 23 additions and 12 deletions

View file

@ -128,7 +128,7 @@ interface BackgroundJobManager {
fun startImmediateFilesSyncJob(
syncedFolderID: Long,
overridePowerSaving: Boolean = false,
changedFiles: Array<String> = arrayOf<String>(),
changedFiles: Array<String> = arrayOf<String>()
)
fun scheduleOfflineSync()

View file

@ -429,7 +429,7 @@ internal class BackgroundJobManagerImpl(
override fun startImmediateFilesSyncJob(
syncedFolderID: Long,
overridePowerSaving: Boolean,
changedFiles: Array<String>,
changedFiles: Array<String>
) {
val arguments = Data.Builder()
.putBoolean(FilesSyncWork.OVERRIDE_POWER_SAVING, overridePowerSaving)

View file

@ -54,7 +54,12 @@ class ContentObserverWork(
for (uri in params.triggeredContentUris) {
changedFiles.add(uri.toString())
}
FilesSyncHelper.startFilesSyncForAllFolders(syncedFolderProvider, backgroundJobManager, false, changedFiles.toTypedArray())
FilesSyncHelper.startFilesSyncForAllFolders(
syncedFolderProvider,
backgroundJobManager,
false,
changedFiles.toTypedArray()
)
}
}

View file

@ -64,7 +64,6 @@ class FilesSyncWork(
private lateinit var syncedFolder: SyncedFolder
@Suppress("ReturnCount")
private fun canExitEarly(changedFiles: Array<String>?, syncedFolderID: Long): Boolean {
// If we are in power save mode better to postpone scan and upload
@ -81,18 +80,21 @@ class FilesSyncWork(
// or sync worker already running and no changed files to be processed
val alreadyRunning = backgroundJobManager.bothFilesSyncJobsRunning(syncedFolderID)
if (alreadyRunning && changedFiles.isNullOrEmpty()) {
Log_OC.d(TAG, "File-sync kill worker since another instance of the worker ($syncedFolderID) seems to be running already!")
Log_OC.d(
TAG,
"File-sync kill worker since another instance of the worker " +
"($syncedFolderID) seems to be running already!"
)
return true
}
val syncedFolderTmp = syncedFolderProvider.getSyncedFolderByID(syncedFolderID)
if (syncedFolderTmp == null || !syncedFolderTmp.isEnabled || !syncedFolderTmp.isExisting) {
Log_OC.d(TAG, "File-sync kill worker since syncedFolder (${syncedFolderID}) is not enabled!")
Log_OC.d(TAG, "File-sync kill worker since syncedFolder ($syncedFolderID) is not enabled!")
return true
}
syncedFolder = syncedFolderTmp
if (syncedFolder.isChargingOnly &&
!powerManagementService.battery.isCharging &&
!powerManagementService.battery.isFull
@ -128,7 +130,11 @@ class FilesSyncWork(
)
// Get changed files from ContentObserverWork (only images and videos) or by scanning filesystem
Log_OC.d(TAG, "File-sync worker (${syncedFolder.remotePath}) changed files from observer: " + changedFiles.contentToString())
Log_OC.d(
TAG,
"File-sync worker (${syncedFolder.remotePath}) changed files from observer: " +
changedFiles.contentToString()
)
collectChangedFiles(changedFiles)
Log_OC.d(TAG, "File-sync worker (${syncedFolder.remotePath}) finished checking files.")