mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Fix tracking current download status
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
742f01259d
commit
db1d58205c
2 changed files with 9 additions and 5 deletions
|
@ -196,6 +196,10 @@ class DownloadNotificationManager(private val context: Context, private val view
|
|||
notificationManager.cancel(R.string.downloader_download_in_progress_ticker)
|
||||
}
|
||||
|
||||
fun dismissAll() {
|
||||
notificationManager.cancelAll()
|
||||
}
|
||||
|
||||
fun setCredentialContentIntent(user: User) {
|
||||
val intent = Intent(context, AuthenticatorActivity::class.java).apply {
|
||||
putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, user.toPlatformAccount())
|
||||
|
|
|
@ -128,11 +128,11 @@ class FileDownloadWorker(
|
|||
downloadFile(it)
|
||||
}
|
||||
|
||||
setIdleWorkerState()
|
||||
folder?.let {
|
||||
notifyForFolderResult(it)
|
||||
}
|
||||
|
||||
setIdleWorkerState()
|
||||
Log_OC.e(TAG, "FilesDownloadWorker successfully completed")
|
||||
Result.success()
|
||||
} catch (t: Throwable) {
|
||||
|
@ -144,9 +144,9 @@ class FileDownloadWorker(
|
|||
override fun onStopped() {
|
||||
Log_OC.e(TAG, "FilesDownloadWorker stopped")
|
||||
|
||||
cancelAllDownloads()
|
||||
notificationManager.dismissDownloadInProgressNotification()
|
||||
removePendingDownload(currentDownload?.user?.accountName)
|
||||
cancelAllDownloads()
|
||||
notificationManager.dismissAll()
|
||||
setIdleWorkerState()
|
||||
|
||||
super.onStopped()
|
||||
|
@ -157,6 +157,8 @@ class FileDownloadWorker(
|
|||
}
|
||||
|
||||
private fun setIdleWorkerState() {
|
||||
pendingDownloads.all.clear()
|
||||
currentDownload = null
|
||||
WorkerStateLiveData.instance().setWorkState(WorkerState.Idle)
|
||||
}
|
||||
|
||||
|
@ -219,8 +221,6 @@ class FileDownloadWorker(
|
|||
pendingDownloads.all.forEach {
|
||||
it.value.payload?.cancel()
|
||||
}
|
||||
pendingDownloads.all.clear()
|
||||
currentDownload = null
|
||||
}
|
||||
|
||||
private fun setUser() {
|
||||
|
|
Loading…
Reference in a new issue