Minor cleanup

This commit is contained in:
arkon
2022-11-27 17:05:04 -05:00
parent 5076ab3049
commit 3480b45098
14 changed files with 74 additions and 91 deletions
@@ -339,7 +339,7 @@ class ReaderPresenter(
newChapters.ref()
oldChapters?.unref()
chapterToDownload = deleteChapterFromDownloadQueue(newChapters.currChapter)
chapterToDownload = cancelQueuedDownloads(newChapters.currChapter)
viewerChaptersRelay.call(newChapters)
}
}
@@ -489,9 +489,9 @@ class ReaderPresenter(
* Removes [currentChapter] from download queue
* if setting is enabled and [currentChapter] is queued for download
*/
private fun deleteChapterFromDownloadQueue(currentChapter: ReaderChapter): Download? {
return downloadManager.getChapterDownloadOrNull(currentChapter.chapter.toDomainChapter()!!)?.also {
downloadManager.deletePendingDownloads(listOf(it))
private fun cancelQueuedDownloads(currentChapter: ReaderChapter): Download? {
return downloadManager.getQueuedDownloadOrNull(currentChapter.chapter.id!!.toLong())?.also {
downloadManager.cancelQueuedDownloads(listOf(it))
}
}
@@ -875,7 +875,7 @@ class ReaderPresenter(
val manga = manga ?: return
presenterScope.launchNonCancellable {
downloadManager.enqueueDeleteChapters(listOf(chapter.chapter.toDomainChapter()!!), manga.toDomainManga()!!)
downloadManager.enqueueChaptersToDelete(listOf(chapter.chapter.toDomainChapter()!!), manga.toDomainManga()!!)
}
}