mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Fix cancel notification
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
2754cc6ac6
commit
457f01dfd4
1 changed files with 6 additions and 5 deletions
|
@ -291,6 +291,8 @@ class FileDownloadWorker(
|
|||
return
|
||||
}
|
||||
|
||||
val fileName = currentDownload?.file?.fileName
|
||||
|
||||
setWorkerState(user)
|
||||
Log_OC.e(TAG, "FilesDownloadWorker downloading: $downloadKey")
|
||||
|
||||
|
@ -317,7 +319,7 @@ class FileDownloadWorker(
|
|||
Log_OC.e(TAG, "Error downloading", e)
|
||||
downloadResult = RemoteOperationResult<Any?>(e)
|
||||
} finally {
|
||||
cleanupDownloadProcess(downloadResult)
|
||||
cleanupDownloadProcess(downloadResult, fileName)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,9 +357,9 @@ class FileDownloadWorker(
|
|||
return file
|
||||
}
|
||||
|
||||
private fun cleanupDownloadProcess(result: RemoteOperationResult<*>?) {
|
||||
private fun cleanupDownloadProcess(result: RemoteOperationResult<*>?, fileName: String?) {
|
||||
result?.let {
|
||||
showFailedDownloadNotifications(it)
|
||||
showFailedDownloadNotifications(it, fileName)
|
||||
}
|
||||
|
||||
val removeResult = pendingDownloads.removePayload(
|
||||
|
@ -380,12 +382,11 @@ class FileDownloadWorker(
|
|||
}
|
||||
}
|
||||
|
||||
private fun showFailedDownloadNotifications(result: RemoteOperationResult<*>) {
|
||||
private fun showFailedDownloadNotifications(result: RemoteOperationResult<*>, fileName: String?) {
|
||||
if (result.isSuccess) {
|
||||
return
|
||||
}
|
||||
|
||||
val fileName = currentDownload?.file?.fileName ?: ""
|
||||
val failMessage = if (result.isCancelled) {
|
||||
context.getString(
|
||||
R.string.downloader_file_download_cancelled,
|
||||
|
|
Loading…
Reference in a new issue