Remove 1.x source models (#7781)

(cherry picked from commit e36e9d9d5c)

# Conflicts:
#	app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt
#	app/src/main/java/eu/kanade/domain/manga/model/Manga.kt
#	app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt
#	app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt
#	app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt
#	app/src/main/java/eu/kanade/tachiyomi/source/Source.kt
#	app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt
#	app/src/main/java/eu/kanade/tachiyomi/source/model/SManga.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt
This commit is contained in:
stevenyomi
2022-08-19 02:07:13 +08:00
committed by Jobobby04
parent fff031cf1c
commit 39e0d7f4e8
58 changed files with 414 additions and 509 deletions
@@ -10,8 +10,6 @@ import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import rx.Observable
import tachiyomi.source.model.ChapterInfo
import tachiyomi.source.model.MangaInfo
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
@@ -183,6 +181,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
*
* @param manga the manga to be updated.
*/
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getMangaDetails"))
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
ensureDelegateCompatible()
return delegate.fetchMangaDetails(manga)
@@ -191,7 +190,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
/**
* [1.x API] Get the updated details for a manga.
*/
override suspend fun getMangaDetails(manga: MangaInfo): MangaInfo {
override suspend fun getMangaDetails(manga: SManga): SManga {
ensureDelegateCompatible()
return delegate.getMangaDetails(manga)
}
@@ -213,6 +212,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
*
* @param manga the manga to look for chapters.
*/
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getChapterList"))
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
ensureDelegateCompatible()
return delegate.fetchChapterList(manga)
@@ -221,7 +221,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
/**
* [1.x API] Get all the available chapters for a manga.
*/
override suspend fun getChapterList(manga: MangaInfo): List<ChapterInfo> {
override suspend fun getChapterList(manga: SManga): List<SChapter> {
ensureDelegateCompatible()
return delegate.getChapterList(manga)
}
@@ -231,6 +231,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
*
* @param chapter the chapter whose page list has to be fetched.
*/
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getPageList"))
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
ensureDelegateCompatible()
return delegate.fetchPageList(chapter)
@@ -239,7 +240,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
/**
* [1.x API] Get the list of pages a chapter has.
*/
override suspend fun getPageList(chapter: ChapterInfo): List<tachiyomi.source.model.Page> {
override suspend fun getPageList(chapter: SChapter): List<Page> {
ensureDelegateCompatible()
return delegate.getPageList(chapter)
}
@@ -8,8 +8,6 @@ import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource
import okhttp3.Response
import tachiyomi.source.model.ChapterInfo
import tachiyomi.source.model.MangaInfo
import uy.kohesive.injekt.injectLazy
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
@@ -177,12 +175,13 @@ class EnhancedHttpSource(
*
* @param manga the manga to be updated.
*/
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getMangaDetails"))
override fun fetchMangaDetails(manga: SManga) = source().fetchMangaDetails(manga)
/**
* [1.x API] Get the updated details for a manga.
*/
override suspend fun getMangaDetails(manga: MangaInfo): MangaInfo = source().getMangaDetails(manga)
override suspend fun getMangaDetails(manga: SManga): SManga = source().getMangaDetails(manga)
/**
* Returns the request for the details of a manga. Override only if it's needed to change the
@@ -198,24 +197,26 @@ class EnhancedHttpSource(
*
* @param manga the manga to look for chapters.
*/
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getChapterList"))
override fun fetchChapterList(manga: SManga) = source().fetchChapterList(manga)
/**
* [1.x API] Get all the available chapters for a manga.
*/
override suspend fun getChapterList(manga: MangaInfo): List<ChapterInfo> = source().getChapterList(manga)
override suspend fun getChapterList(manga: SManga): List<SChapter> = source().getChapterList(manga)
/**
* Returns an observable with the page list for a chapter.
*
* @param chapter the chapter whose page list has to be fetched.
*/
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getPageList"))
override fun fetchPageList(chapter: SChapter) = source().fetchPageList(chapter)
/**
* [1.x API] Get the list of pages a chapter has.
*/
override suspend fun getPageList(chapter: ChapterInfo): List<tachiyomi.source.model.Page> = source().getPageList(chapter)
override suspend fun getPageList(chapter: SChapter): List<Page> = source().getPageList(chapter)
/**
* Returns an observable with the page containing the source url of the image. If there's any