feat: Re-enable fetching chapters list for entries with licenced

This commit is contained in:
Roshan Varughese 2024-09-17 18:06:21 +07:00 committed by Ahmad Ansori Palembani
parent 353a002eb5
commit 0d8276040f
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -251,28 +251,19 @@ abstract class HttpSource : CatalogueSource {
* *
* @param manga the manga to update. * @param manga the manga to update.
* @return the chapters for the manga. * @return the chapters for the manga.
* @throws LicensedMangaChaptersException if a manga is licensed and therefore no chapters are available.
*/ */
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
override suspend fun getChapterList(manga: SManga): List<SChapter> { override suspend fun getChapterList(manga: SManga): List<SChapter> {
if (manga.status == SManga.LICENSED) {
throw LicensedMangaChaptersException()
}
return fetchChapterList(manga).awaitSingle() return fetchChapterList(manga).awaitSingle()
} }
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getChapterList")) @Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getChapterList"))
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> { override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
return if (manga.status != SManga.LICENSED) { return client.newCall(chapterListRequest(manga))
client.newCall(chapterListRequest(manga)) .asObservableSuccess()
.asObservableSuccess() .map { response ->
.map { response -> chapterListParse(response)
chapterListParse(response) }
}
} else {
Observable.error(LicensedMangaChaptersException())
}
} }
/** /**
@ -503,5 +494,3 @@ abstract class HttpSource : CatalogueSource {
*/ */
override fun getFilterList() = FilterList() override fun getFilterList() = FilterList()
} }
class LicensedMangaChaptersException : Exception("Licensed - No chapters to show")