From 70d508558a6928622ff94cbf7b7aa4fe6dc9be4b Mon Sep 17 00:00:00 2001 From: "Cuong M. Tran" Date: Wed, 1 May 2024 03:57:03 +0700 Subject: [PATCH] =?UTF-8?q?Allow=20extensions=20to=20use=20both=20custom?= =?UTF-8?q?=20Related=20titles=20&=20App=E2=80=99s=20Related=20titles=20by?= =?UTF-8?q?=20search?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tachiyomi/source/online/HttpSource.kt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/library/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt b/library/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt index 9c9b912..4202c28 100644 --- a/library/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt +++ b/library/src/main/java/eu/kanade/tachiyomi/source/online/HttpSource.kt @@ -172,6 +172,20 @@ abstract class HttpSource : CatalogueSource { * @since komikku/extensions-lib 1.6 */ protected open val supportsRelatedMangas: Boolean = false + + /** + * Extensions provide custom [relatedMangaListRequest] and [relatedMangaListParse] + * while also want to use App's [getRelatedMangaListBySearch] together. + * @default false + * @since komikku/extensions-lib 1.6 + */ + protected open val supportsRelatedMangasAndSearch: Boolean = false + + /** + * Disable showing any related titles + * @default false + * @since komikku/extensions-lib 1.6 + */ protected open val disableRelatedMangas: Boolean = false /** @@ -187,6 +201,19 @@ abstract class HttpSource : CatalogueSource { throw Exception("Stub!") } + /** + * Fetch related mangas for a manga from source/site. + * Normally it's not needed to override this method. + * + * @since komikku/extensions-lib 1.6 + * @param manga the current manga to get related mangas. + * @return the related mangas for the current manga. + * @throws UnsupportedOperationException if a source doesn't support related mangas. + */ + protected open suspend fun fetchRelatedMangaList(manga: SManga): List { + throw Exception("Stub!") + } + /** * Fetch related mangas by searching for each keywords from manga's title *