Skip to content

Commit

Permalink
fix cancel sync
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Jan 24, 2025
1 parent e0b0afd commit dbe58c9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions app/src/main/java/com/nextcloud/client/jobs/sync/SyncWorker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ class SyncWorker(

var result = true
files.forEachIndexed { index, file ->
if (isStopped) {
notificationManager.dismiss()
return@withContext Result.failure()
}

if (!checkDiskSize(file)) {
return@withContext Result.failure()
}
Expand All @@ -101,8 +96,9 @@ class SyncWorker(
notificationManager.showCompletionMessage(result)
}

downloadingFiles.clear()

if (result) {
downloadingFiles.remove(folder)
sendRefreshFolderEvent()
Log_OC.d(TAG, "SyncWorker completed")
Result.success()
Expand All @@ -113,6 +109,9 @@ class SyncWorker(
} catch (e: Exception) {
Log_OC.d(TAG, "SyncWorker failed reason: $e")
Result.failure()
} finally {
downloadingFiles.clear()
notificationManager.dismiss()
}
}
}
Expand Down

0 comments on commit dbe58c9

Please sign in to comment.