From e3f6cfa2df1c8406f89ca353230d0953870d9fe9 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 1 May 2022 10:46:37 -0400 Subject: [PATCH] Add newer methods to StubSource --- .../data/library/LibraryUpdateService.kt | 4 ++-- .../eu/kanade/tachiyomi/source/SourceManager.kt | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 08861b935..90656096d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -282,7 +282,7 @@ class LibraryUpdateService( * @param mangaToUpdate the list to update * @return an observable delivering the progress of each update. */ - suspend fun updateChapterList() { + private suspend fun updateChapterList() { val semaphore = Semaphore(5) val progressCount = AtomicInteger(0) val currentlyUpdatingManga = CopyOnWriteArrayList() @@ -401,7 +401,7 @@ class LibraryUpdateService( * @param manga the manga to update. * @return a pair of the inserted and removed chapters. */ - suspend fun updateManga(manga: Manga): Pair, List> { + private suspend fun updateManga(manga: Manga): Pair, List> { val source = sourceManager.getOrStub(manga.source) // Update manga details metadata diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt index 59a583bef..4e3495a2f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt @@ -11,6 +11,8 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.update import rx.Observable +import tachiyomi.source.model.ChapterInfo +import tachiyomi.source.model.MangaInfo open class SourceManager(private val context: Context) { @@ -65,19 +67,32 @@ open class SourceManager(private val context: Context) { LocalSource(context), ) + @Suppress("OverridingDeprecatedMember") inner class StubSource(override val id: Long) : Source { override val name: String get() = id.toString() + override suspend fun getMangaDetails(manga: MangaInfo): MangaInfo { + throw getSourceNotInstalledException() + } + override fun fetchMangaDetails(manga: SManga): Observable { return Observable.error(getSourceNotInstalledException()) } + override suspend fun getChapterList(manga: MangaInfo): List { + throw getSourceNotInstalledException() + } + override fun fetchChapterList(manga: SManga): Observable> { return Observable.error(getSourceNotInstalledException()) } + override suspend fun getPageList(chapter: ChapterInfo): List { + throw getSourceNotInstalledException() + } + override fun fetchPageList(chapter: SChapter): Observable> { return Observable.error(getSourceNotInstalledException()) }