mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-14 21:18:56 +01:00
Remove from queue after read (#3870)
* Add option to remove chapter from download queue after marked as read * Begone bug There was a bug when one queued a new download to the downloader. Which resulted in getChapterDownloadOrNull() would not find the corresponding download for the provided chapter * Fix review comment * Remove preference and just remove from queue
This commit is contained in:
@@ -173,6 +173,17 @@ class DownloadManager(private val context: Context) {
|
||||
return cache.isChapterDownloaded(chapter, manga, skipCache)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the download from queue if the chapter is queued for download
|
||||
* else it will return null which means that the chapter is not queued for download
|
||||
*
|
||||
* @param chapter the chapter to check.
|
||||
*/
|
||||
fun getChapterDownloadOrNull(chapter: Chapter): Download? {
|
||||
return downloader.queue
|
||||
.firstOrNull { it.chapter.id == chapter.id && it.chapter.manga_id == chapter.manga_id }
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of downloaded chapters for a manga.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user