mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Fix codacy
Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
This commit is contained in:
parent
b121c21406
commit
80eff53688
1 changed files with 5 additions and 4 deletions
|
@ -93,25 +93,26 @@ class FilesSyncWork(
|
|||
}
|
||||
|
||||
private fun canExitEarly(changedFiles: Array<String>?): Boolean {
|
||||
var canExitEarly = false
|
||||
// If we are in power save mode better to postpone scan and upload
|
||||
val overridePowerSaving = inputData.getBoolean(OVERRIDE_POWER_SAVING, false)
|
||||
if ((powerManagementService.isPowerSavingEnabled && !overridePowerSaving)){
|
||||
return true
|
||||
canExitEarly = true
|
||||
}
|
||||
|
||||
// or sync worker already running and no changed files to be processed
|
||||
val alreadyRunning = backgroundJobManager.bothFilesSyncJobsRunning()
|
||||
if (alreadyRunning && changedFiles.isNullOrEmpty()) {
|
||||
Log_OC.d(TAG, "FILESYNC Kill Sync Worker since another instance of the worker seems to be running already!")
|
||||
return true
|
||||
canExitEarly = true
|
||||
}
|
||||
|
||||
if (! syncedFolderProvider.syncedFolders.any { it.isEnabled }){
|
||||
Log_OC.d(TAG, "FILESYNC Kill Sync Worker since no sync folder is enabled!")
|
||||
return true
|
||||
canExitEarly = true
|
||||
}
|
||||
|
||||
return false
|
||||
return canExitEarly
|
||||
}
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
|
|
Loading…
Reference in a new issue