mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-24 18:08:24 +01:00
Downloading chapters now always add them from the beginning
This commit is contained in:
parent
9aa6da0642
commit
46cc078e93
@ -111,11 +111,14 @@ class DownloadManager(private val context: Context, private val sourceManager: S
|
||||
fun downloadChapters(manga: Manga, chapters: List<Chapter>) {
|
||||
val source = sourceManager.get(manga.source) as? OnlineSource ?: return
|
||||
|
||||
// Add chapters to queue from the start
|
||||
val sortedChapters = chapters.sortedByDescending { it.source_order }
|
||||
|
||||
// Used to avoid downloading chapters with the same name
|
||||
val addedChapters = ArrayList<String>()
|
||||
val pending = ArrayList<Download>()
|
||||
|
||||
for (chapter in chapters) {
|
||||
for (chapter in sortedChapters) {
|
||||
if (addedChapters.contains(chapter.name))
|
||||
continue
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user