Skip to content

Commit

Permalink
Fix cancel in same root
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Jan 11, 2024
1 parent a92e14a commit 04697a2
Showing 1 changed file with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ class FileDownloadWorker(
Log_OC.e(TAG, "FilesDownloadWorker stopped")

notificationManager.dismissNotification()
cancelAllDownloads()
removePendingDownload(currentDownload?.user?.accountName)
setIdleWorkerState()

super.onStopped()
Expand All @@ -173,16 +171,9 @@ class FileDownloadWorker(
}

private fun setIdleWorkerState() {
currentDownload = null
WorkerStateLiveData.instance().setWorkState(WorkerState.Idle)
}

private fun cancelAllDownloads() {
pendingDownloads.all.forEach {
it.value.payload?.cancel()
}
}

private fun removePendingDownload(accountName: String?) {
pendingDownloads.remove(accountName)
}
Expand Down

0 comments on commit 04697a2

Please sign in to comment.