From 123db0a17a586927f62a53a22d0c58aaef7e9242 Mon Sep 17 00:00:00 2001 From: Sergio Malagon <42176762+sergiomalagon@users.noreply.github.com> Date: Mon, 3 Oct 2022 13:48:15 +0200 Subject: [PATCH] ComickFun: Fixed WebView not working correctly (#13686) * Fixed Open in WebView not working correctly * Make use of fetchMangaDetails to avoid unnecessary calls --- src/all/comickfun/build.gradle | 2 +- .../extension/all/comickfun/ComickFun.kt | 23 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/all/comickfun/build.gradle b/src/all/comickfun/build.gradle index 5b9ae3f37..9d55aff10 100644 --- a/src/all/comickfun/build.gradle +++ b/src/all/comickfun/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Comick.fun' pkgNameSuffix = 'all.comickfun' extClass = '.ComickFunFactory' - extVersionCode = 14 + extVersionCode = 15 isNsfw = true } diff --git a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt index da49a7607..d5c5f92ff 100644 --- a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt +++ b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.extension.all.comickfun import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -15,6 +16,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.Response +import rx.Observable import java.text.SimpleDateFormat const val API_BASE = "https://api.comick.fun" @@ -192,18 +194,26 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S } /** Manga Details **/ + override fun fetchMangaDetails(manga: SManga): Observable { + return client.newCall( + GET( + "$API_BASE${manga.url}".toHttpUrl().newBuilder().apply { + addQueryParameter("tachiyomi", "true") + }.toString(), + headers + ) + ).asObservableSuccess() + .map { response -> mangaDetailsParse(response).apply { initialized = true } } + } + override fun mangaDetailsRequest(manga: SManga): Request { - return GET( - "$API_BASE${manga.url}".toHttpUrl().newBuilder().apply { - addQueryParameter("tachiyomi", "true") - }.toString(), - headers - ) + return GET("$baseUrl${manga.url}".toHttpUrl().toString()) } override fun mangaDetailsParse(response: Response): SManga { val mangaData = json.decodeFromString(response.body!!.string()) return SManga.create().apply { + url = "$baseUrl/comic/${mangaData.comic.slug}" title = mangaData.comic.title artist = mangaData.artists.joinToString { it.name.trim() } author = mangaData.authors.joinToString { it.name.trim() } @@ -211,7 +221,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S genre = mangaData.genres.joinToString { it.name.trim() } status = parseStatus(mangaData.comic.status) thumbnail_url = mangaData.comic.cover_url - initialized = true } }