mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Skip bookmark check when cancelling downloads (#5853)
* Skip bookmark check when cancelling downloads * DownloadManager: simplified filteredChapters declaration * Completed documentation of DownloadManager's deleteChapters()
This commit is contained in:
		| @@ -217,7 +217,7 @@ class DownloadManager(private val context: Context) { | ||||
|      * @param download the download to cancel. | ||||
|      */ | ||||
|     fun deletePendingDownload(download: Download) { | ||||
|         deleteChapters(listOf(download.chapter), download.manga, download.source) | ||||
|         deleteChapters(listOf(download.chapter), download.manga, download.source, true) | ||||
|     } | ||||
|  | ||||
|     fun deletePendingDownloads(vararg downloads: Download) { | ||||
| @@ -225,7 +225,7 @@ class DownloadManager(private val context: Context) { | ||||
|         downloadsByManga.map { entry -> | ||||
|             val manga = entry.value.first().manga | ||||
|             val source = entry.value.first().source | ||||
|             deleteChapters(entry.value.map { it.chapter }, manga, source) | ||||
|             deleteChapters(entry.value.map { it.chapter }, manga, source, true) | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -235,9 +235,15 @@ class DownloadManager(private val context: Context) { | ||||
|      * @param chapters the list of chapters to delete. | ||||
|      * @param manga the manga of the chapters. | ||||
|      * @param source the source of the chapters. | ||||
|      * @param isCancelling true if it's simply cancelling a download | ||||
|      */ | ||||
|     fun deleteChapters(chapters: List<Chapter>, manga: Manga, source: Source): List<Chapter> { | ||||
|         val filteredChapters = getChaptersToDelete(chapters) | ||||
|     fun deleteChapters(chapters: List<Chapter>, manga: Manga, source: Source, isCancelling: Boolean = false): List<Chapter> { | ||||
|         val filteredChapters = if (isCancelling) { | ||||
|             chapters | ||||
|         } else { | ||||
|             getChaptersToDelete(chapters) | ||||
|         } | ||||
|  | ||||
|         launchIO { | ||||
|             removeFromDownloadQueue(filteredChapters) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user