mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Fix stucked downloads when service not started (#7846)
* Fix stucked downloads when service not started * Fix chapter download restart even if should be deleted
This commit is contained in:
parent
ce44c0615b
commit
a70b848646
2 changed files with 4 additions and 2 deletions
|
@ -163,12 +163,12 @@ class DownloadManager(
|
|||
* @param downloads the list of downloads to enqueue.
|
||||
*/
|
||||
fun addDownloadsToStartOfQueue(downloads: List<Download>) {
|
||||
val wasEmpty = queue.isEmpty()
|
||||
if (downloads.isEmpty()) return
|
||||
queue.toMutableList().apply {
|
||||
addAll(0, downloads)
|
||||
reorderQueue(this)
|
||||
}
|
||||
if (wasEmpty) startDownloads()
|
||||
if (!DownloadService.isRunning(context)) DownloadService.start(context)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -500,6 +500,8 @@ class ReaderPresenter(
|
|||
|
||||
if (removeAfterReadSlots != 0 && chapterDownload != null) {
|
||||
downloadManager.addDownloadsToStartOfQueue(listOf(chapterDownload!!))
|
||||
} else {
|
||||
chapterDownload = null
|
||||
}
|
||||
// Check if deleting option is enabled and chapter exists
|
||||
if (removeAfterReadSlots != -1 && chapterToDelete != null) {
|
||||
|
|
Loading…
Reference in a new issue