Compare commits

..

No commits in common. "1e570bc9654fb0382a8d5b37923c9700e49be696" and "339dc33f5833b224c01577da3da081deecdbbca2" have entirely different histories.

5 changed files with 22 additions and 8 deletions

View File

@ -2,6 +2,7 @@ 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
@ -24,6 +25,7 @@ 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

@ -25,7 +25,7 @@ data class KitsuListSearchResult(
title = manga.canonicalTitle title = manga.canonicalTitle
total_chapters = manga.chapterCount ?: 0 total_chapters = manga.chapterCount ?: 0
cover_url = manga.posterImage?.original ?: "" cover_url = manga.posterImage?.original ?: ""
summary = manga.synopsis ?: "" summary = manga.synopsis
tracking_url = KitsuApi.mangaUrl(remote_id) tracking_url = KitsuApi.mangaUrl(remote_id)
publishing_status = manga.status publishing_status = manga.status
publishing_type = manga.mangaType ?: "" publishing_type = manga.mangaType ?: ""
@ -73,7 +73,7 @@ data class KitsuListSearchItemIncludedAttributes(
val chapterCount: Long?, val chapterCount: Long?,
val mangaType: String?, val mangaType: String?,
val posterImage: KitsuSearchItemCover?, val posterImage: KitsuSearchItemCover?,
val synopsis: String?, val synopsis: String,
val startDate: String?, val startDate: String?,
val status: String, val status: String,
) )

View File

@ -32,7 +32,7 @@ jsoup = "org.jsoup:jsoup:1.18.1"
disklrucache = "com.jakewharton:disklrucache:2.0.2" disklrucache = "com.jakewharton:disklrucache:2.0.2"
unifile = "com.github.tachiyomiorg:unifile:e0def6b3dc" unifile = "com.github.tachiyomiorg:unifile:e0def6b3dc"
libarchive = "me.zhanghai.android.libarchive:library:1.1.1" libarchive = "me.zhanghai.android.libarchive:library:1.1.0"
sqlite-framework = { module = "androidx.sqlite:sqlite-framework", version.ref = "sqlite" } sqlite-framework = { module = "androidx.sqlite:sqlite-framework", version.ref = "sqlite" }
sqlite-ktx = { module = "androidx.sqlite:sqlite-ktx", version.ref = "sqlite" } sqlite-ktx = { module = "androidx.sqlite:sqlite-ktx", version.ref = "sqlite" }

View File

@ -647,6 +647,7 @@
<!-- 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

@ -251,19 +251,28 @@ 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 client.newCall(chapterListRequest(manga)) return if (manga.status != SManga.LICENSED) {
.asObservableSuccess() client.newCall(chapterListRequest(manga))
.map { response -> .asObservableSuccess()
chapterListParse(response) .map { response ->
} chapterListParse(response)
}
} else {
Observable.error(LicensedMangaChaptersException())
}
} }
/** /**
@ -463,3 +472,5 @@ abstract class HttpSource : CatalogueSource {
*/ */
override fun getFilterList() = FilterList() override fun getFilterList() = FilterList()
} }
class LicensedMangaChaptersException : RuntimeException()