PeachScan: Fix deeplink support (#3334)

* Adds support for any path in peachscan

* Deeplink: Ignore manga collection path

* Cleanup
This commit is contained in:
Chopper 2024-06-02 03:49:51 -03:00 committed by Draff
parent 4dba7261af
commit 9e8bbb7f0b
3 changed files with 5 additions and 15 deletions

View File

@ -2,7 +2,7 @@ plugins {
id("lib-multisrc")
}
baseVersionCode = 8
baseVersionCode = 9
dependencies {
compileOnly("com.github.tachiyomiorg:image-decoder:e08e9be535")

View File

@ -86,7 +86,7 @@ abstract class PeachScan(
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
if (query.startsWith(URL_SEARCH_PREFIX)) {
val manga = SManga.create().apply { url = "/${query.substringAfter(URL_SEARCH_PREFIX)}/" }
val manga = SManga.create().apply { url = query.substringAfter(URL_SEARCH_PREFIX) }
return client.newCall(mangaDetailsRequest(manga))
.asObservableSuccess()
.map {

View File

@ -10,12 +10,11 @@ import kotlin.system.exitProcess
class PeachScanUrlActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size >= 1) {
val path = intent?.data?.path
if (path != null) {
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", "${slug(pathSegments)}")
putExtra("query", "${PeachScan.URL_SEARCH_PREFIX}$path")
putExtra("filter", packageName)
}
try {
@ -30,13 +29,4 @@ class PeachScanUrlActivity : Activity() {
finish()
exitProcess(0)
}
private fun slug(pathSegments: MutableList<String>): String? {
return if (pathSegments.size >= 1) {
val slug = pathSegments[0]
"${PeachScan.URL_SEARCH_PREFIX}$slug"
} else {
null
}
}
}