ComickFun: Fixed WebView not working correctly (#13686)

* Fixed Open in WebView not working correctly

* Make use of fetchMangaDetails to avoid unnecessary calls
This commit is contained in:
Sergio Malagon 2022-10-03 13:48:15 +02:00 committed by GitHub
parent 85dd728243
commit 123db0a17a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 8 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Comick.fun'
pkgNameSuffix = 'all.comickfun'
extClass = '.ComickFunFactory'
extVersionCode = 14
extVersionCode = 15
isNsfw = true
}

View File

@ -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 mangaDetailsRequest(manga: SManga): Request {
return GET(
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
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("$baseUrl${manga.url}".toHttpUrl().toString())
}
override fun mangaDetailsParse(response: Response): SManga {
val mangaData = json.decodeFromString<MangaDetails>(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
}
}