From beb28b86ac644eb1a1133498f245bf7dbf9b6a4c Mon Sep 17 00:00:00 2001 From: Jobobby04 Date: Sat, 11 Feb 2023 20:03:26 -0500 Subject: [PATCH] Support getMangaUrl and getChapterUrl for delegated sources --- .../java/exh/source/DelegatedHttpSource.kt | 24 +++++++++++++++++++ .../java/exh/source/EnhancedHttpSource.kt | 18 ++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/source-api/src/main/java/exh/source/DelegatedHttpSource.kt b/source-api/src/main/java/exh/source/DelegatedHttpSource.kt index d14c1d05a..ce3802252 100644 --- a/source-api/src/main/java/exh/source/DelegatedHttpSource.kt +++ b/source-api/src/main/java/exh/source/DelegatedHttpSource.kt @@ -276,6 +276,30 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() { return delegate.getImage(page) } + /** + * Returns the url of the provided manga + * + * @since extensions-lib 1.4 + * @param manga the manga + * @return url of the manga + */ + override fun getMangaUrl(manga: SManga): String { + ensureDelegateCompatible() + return delegate.getMangaUrl(manga) + } + + /** + * Returns the url of the provided chapter + * + * @since extensions-lib 1.4 + * @param chapter the chapter + * @return url of the chapter + */ + override fun getChapterUrl(chapter: SChapter): String { + ensureDelegateCompatible() + return delegate.getChapterUrl(chapter) + } + /** * Called before inserting a new chapter into database. Use it if you need to override chapter * fields, like the title or the chapter number. Do not change anything to [manga]. diff --git a/source-api/src/main/java/exh/source/EnhancedHttpSource.kt b/source-api/src/main/java/exh/source/EnhancedHttpSource.kt index b0ce7d34f..43dc38dcf 100644 --- a/source-api/src/main/java/exh/source/EnhancedHttpSource.kt +++ b/source-api/src/main/java/exh/source/EnhancedHttpSource.kt @@ -240,6 +240,24 @@ class EnhancedHttpSource( */ override suspend fun getImage(page: Page) = source().getImage(page) + /** + * Returns the url of the provided manga + * + * @since extensions-lib 1.4 + * @param manga the manga + * @return url of the manga + */ + override fun getMangaUrl(manga: SManga) = source().getMangaUrl(manga) + + /** + * Returns the url of the provided chapter + * + * @since extensions-lib 1.4 + * @param chapter the chapter + * @return url of the chapter + */ + override fun getChapterUrl(chapter: SChapter) = source().getChapterUrl(chapter) + /** * Called before inserting a new chapter into database. Use it if you need to override chapter * fields, like the title or the chapter number. Do not change anything to [manga].