Download ahead (#7226)

This commit is contained in:
nzoba
2022-08-22 23:37:54 +02:00
committed by GitHub
parent 2e81e1b7d8
commit f207e87722
6 changed files with 107 additions and 11 deletions
@@ -157,6 +157,20 @@ class DownloadManager(
downloader.queueChapters(manga, chapters, autoStart)
}
/**
* Tells the downloader to enqueue the given list of downloads at the start of the queue.
*
* @param downloads the list of downloads to enqueue.
*/
fun addDownloadsToStartOfQueue(downloads: List<Download>) {
val wasEmpty = queue.isEmpty()
queue.toMutableList().apply {
addAll(0, downloads)
reorderQueue(this)
}
if (wasEmpty) startDownloads()
}
/**
* Builds the page list of a downloaded chapter.
*