Fixed infinite loading when there's no result

This commit is contained in:
Pupil
2020-02-16 22:18:31 +09:00
parent bb6fadc182
commit 98d1f88579
4 changed files with 25 additions and 29 deletions

View File

@@ -187,14 +187,7 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
queue.remove(galleryID)
worker[galleryID]?.cancel()
clients[galleryID]?.dispatcher()?.queuedCalls()
?.filter {
@Suppress("UNCHECKED_CAST")
(it.request().tag() as? Pair<Int, Int>)?.first == galleryID
}
?.forEach {
it.cancel()
}
clients[galleryID]?.dispatcher()?.cancelAll()
clients.remove(galleryID)
progress.remove(galleryID)
@@ -283,7 +276,7 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
for (i in reader.galleryInfo.indices) {
val callback = object : Callback {
override fun onFailure(call: Call, e: IOException) {
if (Fabric.isInitialized())
if (Fabric.isInitialized() && e.message != "Canceled")
Crashlytics.logException(e)
progress[galleryID]?.set(i, Float.NaN)