Brasil Hentail: Fix deep linking (#3144)

Fix deep linking
This commit is contained in:
Chopper 2024-05-20 07:55:40 -03:00 committed by GitHub
parent 669fa35cab
commit 440487fc8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 8 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Brasil Hentai'
extClass = '.BrasilHentai'
extVersionCode = 1
extVersionCode = 2
isNsfw = true
}

View File

@ -122,10 +122,16 @@ class BrasilHentai : ParsedHttpSource() {
}
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
return if (query.startsWith(PREFIX_SEARCH)) {
client.newCall(GET("$baseUrl/${query.substringAfter(PREFIX_SEARCH)}", headers))
return if (query.startsWith(SEARCH_PREFIX)) {
val url = "$baseUrl/${query.substringAfter(SEARCH_PREFIX)}/"
client.newCall(GET(url, headers))
.asObservableSuccess()
.map { MangasPage(listOf(searchMangaFromElement(it.asJsoup())), false) }
.map {
val manga = mangaDetailsParse(it).apply {
setUrlWithoutDomain(url)
}
MangasPage(listOf(manga), false)
}
} else {
super.fetchSearchManga(page, query, filters)
}
@ -168,6 +174,6 @@ class BrasilHentai : ParsedHttpSource() {
private fun categoriesRequest(): Request = GET(baseUrl, headers)
companion object {
val PREFIX_SEARCH: String = "slug:"
const val SEARCH_PREFIX: String = "slug:"
}
}

View File

@ -11,11 +11,12 @@ class BrasilHentaiUrlActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val segment = intent?.data?.lastPathSegment
if (segment != null) {
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size >= 1) {
val item = pathSegments[pathSegments.size - 1]
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", "${BrasilHentai.PREFIX_SEARCH}$segment")
putExtra("query", "${BrasilHentai.SEARCH_PREFIX}$item")
putExtra("filter", packageName)
}