Re-enable fetching chapters list for entries with licenced status (mihonapp/mihon#1230)

Enable Licensed

(cherry picked from commit 9cc7d42dd9676319559eddc7a4a264fca155e1ca)
This commit is contained in:
Roshan Varughese 2024-09-17 20:47:04 +12:00 committed by Cuong-Tran
parent 4ad0748c4e
commit f701db1dbe
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
3 changed files with 5 additions and 19 deletions

View file

@ -2,7 +2,6 @@ package eu.kanade.presentation.util
import android.content.Context import android.content.Context
import eu.kanade.tachiyomi.network.HttpException import eu.kanade.tachiyomi.network.HttpException
import eu.kanade.tachiyomi.source.online.LicensedMangaChaptersException
import eu.kanade.tachiyomi.util.system.isOnline import eu.kanade.tachiyomi.util.system.isOnline
import tachiyomi.core.common.i18n.stringResource import tachiyomi.core.common.i18n.stringResource
import tachiyomi.data.source.NoResultsException import tachiyomi.data.source.NoResultsException
@ -25,7 +24,6 @@ val Throwable.formattedMessage: String
is NoResultsException -> return stringResource(MR.strings.no_results_found) is NoResultsException -> return stringResource(MR.strings.no_results_found)
is SourceNotInstalledException -> return stringResource(MR.strings.loader_not_implemented_error) is SourceNotInstalledException -> return stringResource(MR.strings.loader_not_implemented_error)
is LicensedMangaChaptersException -> return stringResource(MR.strings.licensed_manga_chapters_error)
} }
return when (val className = this::class.simpleName) { return when (val className = this::class.simpleName) {
"Exception", "IOException" -> message ?: className "Exception", "IOException" -> message ?: className

View file

@ -649,7 +649,6 @@
<!-- missing prompt after Compose rewrite #7901 --> <!-- missing prompt after Compose rewrite #7901 -->
<string name="no_more_results">No more results</string> <string name="no_more_results">No more results</string>
<string name="no_results_found">No results found</string> <string name="no_results_found">No results found</string>
<string name="licensed_manga_chapters_error">Licensed - No chapters to show</string>
<string name="local_source">Local source</string> <string name="local_source">Local source</string>
<string name="other_source">Other</string> <string name="other_source">Other</string>
<string name="last_used_source">Last used</string> <string name="last_used_source">Last used</string>

View file

@ -388,13 +388,8 @@ 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.
*/ */
override suspend fun getChapterList(manga: SManga): List<SChapter> { override suspend fun getChapterList(manga: SManga): List<SChapter> {
if (manga.status == SManga.LICENSED) {
throw LicensedMangaChaptersException()
}
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
return fetchChapterList(manga).awaitSingle() return fetchChapterList(manga).awaitSingle()
} }
@ -407,15 +402,11 @@ abstract class HttpSource : CatalogueSource {
*/ */
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getChapterList(manga)")) @Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getChapterList(manga)"))
open fun fetchChapterList(manga: SManga): Observable<List<SChapter>> { open 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())
}
} }
/** /**
@ -651,5 +642,3 @@ abstract class HttpSource : CatalogueSource {
} }
// EXH <-- // EXH <--
} }
class LicensedMangaChaptersException : RuntimeException()