diff --git a/app/src/main/java/foundation/e/drive/periodicScan/FullScanWorker.kt b/app/src/main/java/foundation/e/drive/periodicScan/FullScanWorker.kt index bd655a1c3667e63477aeb5ad3dd18613864195ed..194dea8d5751d999a41bd45f879e3cda09efefb9 100644 --- a/app/src/main/java/foundation/e/drive/periodicScan/FullScanWorker.kt +++ b/app/src/main/java/foundation/e/drive/periodicScan/FullScanWorker.kt @@ -97,19 +97,38 @@ class FullScanWorker(private val context: Context, private val workerParams: Wor private fun checkStartConditions(account: Account?, prefs : SharedPreferences, requestCollector: SyncRequestCollector): Boolean { Timber.d("FullScanWorker.checkStartConditions()") - if (account == null) return false + if (account == null) { + Timber.w("Account is null") + return false + } - if (!isSetupDone(prefs)) return false + if (!isSetupDone(prefs)) { + Timber.w("Setup is not done") + return false + } - if (isFileSyncDisabled(account)) return false //@todo could be replaced by checking list of sync folders not empty after loading them + // TODO: could be replaced by checking list of sync folders not empty after loading them + if (isFileSyncDisabled(account)) { + Timber.w("File synchronization is disabled") + return false + } val forcedSync = workerParams.inputData.getBoolean(ACTION_FORCED_SYNC_KEY, false) - if (!forcedSync && !isMinimumDelayRespected(prefs)) return false + if (!forcedSync && !isMinimumDelayRespected(prefs)) { + Timber.w("Minimum delay not respected") + return false + } - if (!isConnectedToAllowedNetwork(account)) return false + if (!isConnectedToAllowedNetwork(account)) { + Timber.w("Not connected to allowed network") + return false + } - if (!requestCollector.onPeriodicScanStart(applicationContext as Application)) return false + if (!requestCollector.onPeriodicScanStart(applicationContext as Application)) { + Timber.w("Periodic scan start is not allowed") + return false + } return true }