Add cancel all for series in download queue (#5062)

Co-authored-by: Jays2Kings <jays@outlook.com>
This commit is contained in:
Riztard Lanthorn
2021-05-14 04:35:47 +07:00
committed by GitHub
parent 5700c7a0c7
commit 7ba43ae5c2
5 changed files with 26 additions and 0 deletions

View File

@@ -203,6 +203,15 @@ class DownloadManager(private val context: Context) {
deleteChapters(listOf(download.chapter), download.manga, download.source)
}
fun deletePendingDownloads(vararg downloads: Download) {
val downloadsByManga = downloads.groupBy { it.manga.id }
downloadsByManga.map { entry ->
val manga = entry.value.first().manga
val source = entry.value.first().source
deleteChapters(entry.value.map { it.chapter }, manga, source)
}
}
/**
* Deletes the directories of a list of downloaded chapters.
*