mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 20:19:05 +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:
@@ -361,6 +361,7 @@ class ReaderPresenter(
|
||||
selectedChapter.chapter.read = true
|
||||
updateTrackChapterRead(selectedChapter)
|
||||
deleteChapterIfNeeded(selectedChapter)
|
||||
deleteChapterFromDownloadQueue(currentChapters.currChapter)
|
||||
}
|
||||
|
||||
if (selectedChapter != currentChapters.currChapter) {
|
||||
@@ -370,6 +371,16 @@ class ReaderPresenter(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes [currentChapter] from download queue
|
||||
* if setting is enabled and [currentChapter] is queued for download
|
||||
*/
|
||||
private fun deleteChapterFromDownloadQueue(currentChapter: ReaderChapter) {
|
||||
downloadManager.getChapterDownloadOrNull(currentChapter.chapter)?.let { download ->
|
||||
downloadManager.deletePendingDownload(download)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if deleting option is enabled and nth to last chapter actually exists.
|
||||
* If both conditions are satisfied enqueues chapter for delete
|
||||
|
||||
Reference in New Issue
Block a user