Skip to content

Commit

Permalink
Re-enable fetching chapters list for entries with licenced status (#1230
Browse files Browse the repository at this point in the history
)

Enable Licensed
  • Loading branch information
Animeboynz authored Sep 17, 2024
1 parent f5c6d2e commit 9cc7d42
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package eu.kanade.presentation.util

import android.content.Context
import eu.kanade.tachiyomi.network.HttpException
import eu.kanade.tachiyomi.source.online.LicensedMangaChaptersException
import eu.kanade.tachiyomi.util.system.isOnline
import tachiyomi.core.common.i18n.stringResource
import tachiyomi.data.source.NoResultsException
Expand All @@ -25,7 +24,6 @@ val Throwable.formattedMessage: String

is NoResultsException -> return stringResource(MR.strings.no_results_found)
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) {
"Exception", "IOException" -> message ?: className
Expand Down
1 change: 0 additions & 1 deletion i18n/src/commonMain/moko-resources/base/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,6 @@
<!-- missing prompt after Compose rewrite #7901 -->
<string name="no_more_results">No more results</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="other_source">Other</string>
<string name="last_used_source">Last used</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,28 +251,19 @@ abstract class HttpSource : CatalogueSource {
*
* @param manga the manga to update.
* @return the chapters for the manga.
* @throws LicensedMangaChaptersException 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 LicensedMangaChaptersException()
}

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(LicensedMangaChaptersException())
}
return client.newCall(chapterListRequest(manga))
.asObservableSuccess()
.map { response ->
chapterListParse(response)
}
}

/**
Expand Down Expand Up @@ -472,5 +463,3 @@ abstract class HttpSource : CatalogueSource {
*/
override fun getFilterList() = FilterList()
}

class LicensedMangaChaptersException : RuntimeException()

0 comments on commit 9cc7d42

Please sign in to comment.