mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 04:49:15 +01:00
Using a global scope to delete chapters
This commit is contained in:
parent
887d2fb293
commit
80c127bc10
@ -796,7 +796,7 @@ class LibraryPresenter(
|
||||
|
||||
/** Remove manga from the library and delete the downloads */
|
||||
fun confirmDeletion(mangas: List<Manga>) {
|
||||
presenterScope.launch {
|
||||
launchIO {
|
||||
val mangaToDelete = mangas.distinctBy { it.id }
|
||||
mangaToDelete.forEach { manga ->
|
||||
coverCache.deleteFromCache(manga)
|
||||
|
@ -303,7 +303,7 @@ class MangaDetailsPresenter(
|
||||
* @param chapters the list of chapters to delete.
|
||||
*/
|
||||
fun deleteChapters(chapters: List<ChapterItem>, 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)
|
||||
|
@ -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<SourceManager>().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 {
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user