Comick: fix deep links (#15535)

* Comick: slug/hid search for deep linking

* bump
This commit is contained in:
mobi2002 2023-03-01 20:21:10 +05:00 committed by GitHub
parent d09671ecdd
commit 8ce11b816b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

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

View File

@ -15,6 +15,7 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import rx.Observable
import java.text.ParseException import java.text.ParseException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
@ -53,6 +54,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
), ),
) )
} }
override fun popularMangaParse(response: Response) = searchMangaParse(response) override fun popularMangaParse(response: Response) = searchMangaParse(response)
/** Latest Manga **/ /** Latest Manga **/
@ -69,6 +71,17 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
override fun latestUpdatesParse(response: Response) = searchMangaParse(response) override fun latestUpdatesParse(response: Response) = searchMangaParse(response)
/** Manga Search **/ /** Manga Search **/
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
if (!query.startsWith(SLUG_SEARCH_PREFIX)) {
return super.fetchSearchManga(page, query, filters)
}
val slugOrHid = query.substringAfter(SLUG_SEARCH_PREFIX)
return fetchMangaDetails(SManga.create().apply { this.url = "/comic/$slugOrHid#" }).map {
MangasPage(listOf(it), false)
}
}
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = apiUrl.toHttpUrl().newBuilder().apply { val url = apiUrl.toHttpUrl().newBuilder().apply {
addPathSegment("search") addPathSegment("search")
@ -195,7 +208,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
} }
override fun getMangaUrl(manga: SManga): String { override fun getMangaUrl(manga: SManga): String {
return "$baseUrl${manga.url}" return "$baseUrl${manga.url.removeSuffix("#")}"
} }
/** Manga Chapter List **/ /** Manga Chapter List **/
@ -288,6 +301,7 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
protected open val defaultPopularSort: Int = 0 protected open val defaultPopularSort: Int = 0
protected open val defaultLatestSort: Int = 4 protected open val defaultLatestSort: Int = 4
override fun getFilterList() = FilterList( override fun getFilterList() = FilterList(
getFilters(), getFilters(),
) )