mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 18:01:49 +01:00
Fix download queue not being removed after all items downloaded
This commit is contained in:
parent
ff5e507255
commit
a65ac5cab5
@ -512,7 +512,7 @@ class Downloader(
|
|||||||
// Delete successful downloads from queue
|
// Delete successful downloads from queue
|
||||||
if (download.status == Download.DOWNLOADED) {
|
if (download.status == Download.DOWNLOADED) {
|
||||||
// remove downloaded chapter from queue
|
// remove downloaded chapter from queue
|
||||||
queue.remove(download, false)
|
queue.remove(download)
|
||||||
}
|
}
|
||||||
if (areAllDownloadsFinished()) {
|
if (areAllDownloadsFinished()) {
|
||||||
DownloadService.stop(context)
|
DownloadService.stop(context)
|
||||||
|
@ -31,7 +31,7 @@ class DownloadQueue(
|
|||||||
updatedRelay.call(Unit)
|
updatedRelay.call(Unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun remove(download: Download, callListeners: Boolean = true) {
|
fun remove(download: Download) {
|
||||||
val removed = queue.remove(download)
|
val removed = queue.remove(download)
|
||||||
store.remove(download)
|
store.remove(download)
|
||||||
download.setStatusSubject(null)
|
download.setStatusSubject(null)
|
||||||
@ -39,9 +39,7 @@ class DownloadQueue(
|
|||||||
if (download.status == Download.DOWNLOADING || download.status == Download.QUEUE) {
|
if (download.status == Download.DOWNLOADING || download.status == Download.QUEUE) {
|
||||||
download.status = Download.NOT_DOWNLOADED
|
download.status = Download.NOT_DOWNLOADED
|
||||||
}
|
}
|
||||||
if (callListeners) {
|
downloadListeners.forEach { it.updateDownload(download) }
|
||||||
downloadListeners.forEach { it.updateDownload(download) }
|
|
||||||
}
|
|
||||||
if (removed) {
|
if (removed) {
|
||||||
updatedRelay.call(Unit)
|
updatedRelay.call(Unit)
|
||||||
}
|
}
|
||||||
@ -88,7 +86,9 @@ class DownloadQueue(
|
|||||||
callListeners(download)
|
callListeners(download)
|
||||||
} else if (download.status == Download.DOWNLOADED || download.status == Download.ERROR) {
|
} else if (download.status == Download.DOWNLOADED || download.status == Download.ERROR) {
|
||||||
setPagesSubject(download.pages, null)
|
setPagesSubject(download.pages, null)
|
||||||
callListeners(download)
|
if (download.status == Download.ERROR) {
|
||||||
|
callListeners(download)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
callListeners(download)
|
callListeners(download)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user