From cf8199e17a1376dd7485b4f1a558f7501e2281f8 Mon Sep 17 00:00:00 2001 From: Jonas Mayer Date: Tue, 9 Apr 2024 16:55:52 +0200 Subject: [PATCH] Make code better readable and add early exit if no folder is enabled Signed-off-by: Jonas Mayer --- .../main/java/com/nextcloud/client/jobs/FilesSyncWork.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt b/app/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt index ed12c9bafa43..a81d43d109a6 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/FilesSyncWork.kt @@ -102,7 +102,12 @@ class FilesSyncWork( // or sync worker already running and no changed files to be processed val alreadyRunning = backgroundJobManager.bothFilesSyncJobsRunning() if (alreadyRunning && changedFiles.isNullOrEmpty()) { - Log_OC.d(TAG, "Kill Sync Worker since another instance of the worker seems to be running already!") + Log_OC.d(TAG, "FILESYNC Kill Sync Worker since another instance of the worker seems to be running already!") + return true + } + + if (! syncedFolderProvider.syncedFolders.any { it.isEnabled }){ + Log_OC.d(TAG, "FILESYNC Kill Sync Worker since no sync folder is enabled!") return true }