diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index aac6512fae..3030b3b8a1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -796,7 +796,7 @@ class LibraryPresenter( /** Remove manga from the library and delete the downloads */ fun confirmDeletion(mangas: List) { - presenterScope.launch { + launchIO { val mangaToDelete = mangas.distinctBy { it.id } mangaToDelete.forEach { manga -> coverCache.deleteFromCache(manga) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt index f790f156f1..5bc6536a5a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt @@ -303,7 +303,7 @@ class MangaDetailsPresenter( * @param chapters the list of chapters to delete. */ fun deleteChapters(chapters: List, update: Boolean = true, isEverything: Boolean = false) { - scope.launchIO { + launchIO { if (isEverything) { downloadManager.deleteManga(manga, source) } else { @@ -583,7 +583,7 @@ class MangaDetailsPresenter( } fun confirmDeletion() { - scope.launchIO { + launchIO { coverCache.deleteFromCache(manga) customMangaManager.saveMangaInfo(CustomMangaManager.MangaJson(manga.id!!)) downloadManager.deleteManga(manga, source) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsPresenter.kt index fad75afe89..2d383c20f5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recents/RecentsPresenter.kt @@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.ui.base.presenter.BaseCoroutinePresenter import eu.kanade.tachiyomi.util.system.executeOnIO +import eu.kanade.tachiyomi.util.system.launchIO import eu.kanade.tachiyomi.util.system.launchUI import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job @@ -400,8 +401,9 @@ class RecentsPresenter( */ fun deleteChapter(chapter: Chapter, manga: Manga, update: Boolean = true) { val source = Injekt.get().getOrStub(manga.source) - downloadManager.deleteChapters(listOf(chapter), manga, source) - + launchIO { + downloadManager.deleteChapters(listOf(chapter), manga, source) + } if (update) { val item = recentItems.find { it.chapter.id == chapter.id } ?: return item.apply { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourcePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourcePresenter.kt index 1dd9d55dac..a638f192d9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourcePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourcePresenter.kt @@ -28,6 +28,7 @@ import eu.kanade.tachiyomi.ui.source.filter.TextItem import eu.kanade.tachiyomi.ui.source.filter.TextSectionItem import eu.kanade.tachiyomi.ui.source.filter.TriStateItem import eu.kanade.tachiyomi.ui.source.filter.TriStateSectionItem +import eu.kanade.tachiyomi.util.system.launchIO import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job @@ -294,9 +295,11 @@ open class BrowseSourcePresenter( } fun confirmDeletion(manga: Manga) { - coverCache.deleteFromCache(manga) - val downloadManager: DownloadManager = Injekt.get() - downloadManager.deleteManga(manga, source) + launchIO { + coverCache.deleteFromCache(manga) + val downloadManager: DownloadManager = Injekt.get() + downloadManager.deleteManga(manga, source) + } } /**