Re-enable fetching chapters list for entries with licenced status

Enable Licensed

Co-authored-by: Roshan Varughese <40583749+Animeboynz@users.noreply.github.com>
This commit is contained in:
Secozzi 2024-10-30 18:51:10 +01:00
parent 34deae5e27
commit f87a59a512
No known key found for this signature in database
GPG key ID: DD93E0B3A962AA86
4 changed files with 10 additions and 37 deletions

View file

@ -1,7 +1,6 @@
package eu.kanade.presentation.util
import android.content.Context
import eu.kanade.tachiyomi.animesource.online.LicensedEntryItemsException
import eu.kanade.tachiyomi.network.HttpException
import eu.kanade.tachiyomi.util.system.isOnline
import tachiyomi.core.common.i18n.stringResource
@ -30,9 +29,6 @@ val Throwable.formattedMessage: String
is SourceNotInstalledException, is AnimeSourceNotInstalledException -> return stringResource(
MR.strings.loader_not_implemented_error,
)
is LicensedEntryItemsException -> return stringResource(
MR.strings.licensed_manga_chapters_error,
)
}
return when (val className = this::class.simpleName) {
"Exception", "IOException" -> message ?: className

View file

@ -1051,7 +1051,6 @@
<string name="channel_new_chapters_episodes">Chapter/Episode updates</string>
<string name="pref_invalidate_download_cache_summary">Force app to recheck downloaded chapters and episodes</string>
<string name="player_controls_skip_intro_text">+%1$d s</string>
<string name="licensed_manga_chapters_error">Licensed - No items to show</string>
<string name="no_next_episode">Next Episode not found!</string>
<string name="label_storage">Storage</string>
<string name="label_history">Manga</string>

View file

@ -252,28 +252,19 @@ abstract class AnimeHttpSource : AnimeCatalogueSource {
*
* @param anime the anime to update.
* @return the chapters for the manga.
* @throws LicensedEntryItemsException if a anime is licensed and therefore no episodes are available.
*/
@Suppress("DEPRECATION")
override suspend fun getEpisodeList(anime: SAnime): List<SEpisode> {
if (anime.status == SAnime.LICENSED) {
throw LicensedEntryItemsException()
}
return fetchEpisodeList(anime).awaitSingle()
}
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getEpisodeList"))
override fun fetchEpisodeList(anime: SAnime): Observable<List<SEpisode>> {
return if (anime.status != SAnime.LICENSED) {
client.newCall(episodeListRequest(anime))
.asObservableSuccess()
.map { response ->
episodeListParse(response)
}
} else {
Observable.error(LicensedEntryItemsException())
}
return client.newCall(episodeListRequest(anime))
.asObservableSuccess()
.map { response ->
episodeListParse(response)
}
}
/**
@ -535,5 +526,3 @@ abstract class AnimeHttpSource : AnimeCatalogueSource {
*/
override fun getFilterList() = AnimeFilterList()
}
class LicensedEntryItemsException : RuntimeException()

View file

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