mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2025-01-11 05:29:11 +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 */
|
/** Remove manga from the library and delete the downloads */
|
||||||
fun confirmDeletion(mangas: List<Manga>) {
|
fun confirmDeletion(mangas: List<Manga>) {
|
||||||
presenterScope.launch {
|
launchIO {
|
||||||
val mangaToDelete = mangas.distinctBy { it.id }
|
val mangaToDelete = mangas.distinctBy { it.id }
|
||||||
mangaToDelete.forEach { manga ->
|
mangaToDelete.forEach { manga ->
|
||||||
coverCache.deleteFromCache(manga)
|
coverCache.deleteFromCache(manga)
|
||||||
|
@ -303,7 +303,7 @@ class MangaDetailsPresenter(
|
|||||||
* @param chapters the list of chapters to delete.
|
* @param chapters the list of chapters to delete.
|
||||||
*/
|
*/
|
||||||
fun deleteChapters(chapters: List<ChapterItem>, update: Boolean = true, isEverything: Boolean = false) {
|
fun deleteChapters(chapters: List<ChapterItem>, update: Boolean = true, isEverything: Boolean = false) {
|
||||||
scope.launchIO {
|
launchIO {
|
||||||
if (isEverything) {
|
if (isEverything) {
|
||||||
downloadManager.deleteManga(manga, source)
|
downloadManager.deleteManga(manga, source)
|
||||||
} else {
|
} else {
|
||||||
@ -583,7 +583,7 @@ class MangaDetailsPresenter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun confirmDeletion() {
|
fun confirmDeletion() {
|
||||||
scope.launchIO {
|
launchIO {
|
||||||
coverCache.deleteFromCache(manga)
|
coverCache.deleteFromCache(manga)
|
||||||
customMangaManager.saveMangaInfo(CustomMangaManager.MangaJson(manga.id!!))
|
customMangaManager.saveMangaInfo(CustomMangaManager.MangaJson(manga.id!!))
|
||||||
downloadManager.deleteManga(manga, source)
|
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.source.SourceManager
|
||||||
import eu.kanade.tachiyomi.ui.base.presenter.BaseCoroutinePresenter
|
import eu.kanade.tachiyomi.ui.base.presenter.BaseCoroutinePresenter
|
||||||
import eu.kanade.tachiyomi.util.system.executeOnIO
|
import eu.kanade.tachiyomi.util.system.executeOnIO
|
||||||
|
import eu.kanade.tachiyomi.util.system.launchIO
|
||||||
import eu.kanade.tachiyomi.util.system.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
@ -400,8 +401,9 @@ class RecentsPresenter(
|
|||||||
*/
|
*/
|
||||||
fun deleteChapter(chapter: Chapter, manga: Manga, update: Boolean = true) {
|
fun deleteChapter(chapter: Chapter, manga: Manga, update: Boolean = true) {
|
||||||
val source = Injekt.get<SourceManager>().getOrStub(manga.source)
|
val source = Injekt.get<SourceManager>().getOrStub(manga.source)
|
||||||
downloadManager.deleteChapters(listOf(chapter), manga, source)
|
launchIO {
|
||||||
|
downloadManager.deleteChapters(listOf(chapter), manga, source)
|
||||||
|
}
|
||||||
if (update) {
|
if (update) {
|
||||||
val item = recentItems.find { it.chapter.id == chapter.id } ?: return
|
val item = recentItems.find { it.chapter.id == chapter.id } ?: return
|
||||||
item.apply {
|
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.TextSectionItem
|
||||||
import eu.kanade.tachiyomi.ui.source.filter.TriStateItem
|
import eu.kanade.tachiyomi.ui.source.filter.TriStateItem
|
||||||
import eu.kanade.tachiyomi.ui.source.filter.TriStateSectionItem
|
import eu.kanade.tachiyomi.ui.source.filter.TriStateSectionItem
|
||||||
|
import eu.kanade.tachiyomi.util.system.launchIO
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
@ -294,9 +295,11 @@ open class BrowseSourcePresenter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun confirmDeletion(manga: Manga) {
|
fun confirmDeletion(manga: Manga) {
|
||||||
coverCache.deleteFromCache(manga)
|
launchIO {
|
||||||
val downloadManager: DownloadManager = Injekt.get()
|
coverCache.deleteFromCache(manga)
|
||||||
downloadManager.deleteManga(manga, source)
|
val downloadManager: DownloadManager = Injekt.get()
|
||||||
|
downloadManager.deleteManga(manga, source)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user