Fixed downloader not fully cancelled after DownloadWorker.cancel() is called

This commit is contained in:
tom5079
2020-08-28 21:51:44 +09:00
parent 5488e14f32
commit ece127e982

View File

@@ -179,6 +179,11 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
}.forEach {
it.cancel()
}
client.dispatcher().runningCalls().filter {
it.request().tag() is Pair<*, *>
}.forEach {
it.cancel()
}
progress.clear()
notification.clear()
@@ -194,6 +199,11 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
}.forEach {
it.cancel()
}
client.dispatcher().runningCalls().filter {
((it.request().tag() as Pair<*, *>).first as Int) == galleryID
}.forEach {
it.cancel()
}
progress.remove(galleryID)
notification.remove(galleryID)