From 9e8bbb7f0ba388fb03a56fd91768e4e2f2d8ccfe Mon Sep 17 00:00:00 2001 From: Chopper <156493704+ttony2chopper@users.noreply.github.com> Date: Sun, 2 Jun 2024 03:49:51 -0300 Subject: [PATCH] PeachScan: Fix deeplink support (#3334) * Adds support for any path in peachscan * Deeplink: Ignore manga collection path * Cleanup --- lib-multisrc/peachscan/build.gradle.kts | 2 +- .../tachiyomi/multisrc/peachscan/PeachScan.kt | 2 +- .../multisrc/peachscan/PeachScanUrlActivity.kt | 16 +++------------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/lib-multisrc/peachscan/build.gradle.kts b/lib-multisrc/peachscan/build.gradle.kts index bbd402a53..0e5d1ac9a 100644 --- a/lib-multisrc/peachscan/build.gradle.kts +++ b/lib-multisrc/peachscan/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("lib-multisrc") } -baseVersionCode = 8 +baseVersionCode = 9 dependencies { compileOnly("com.github.tachiyomiorg:image-decoder:e08e9be535") diff --git a/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt index 30d93ef66..ed8f115a4 100644 --- a/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt +++ b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt @@ -86,7 +86,7 @@ abstract class PeachScan( override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable { 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 { diff --git a/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScanUrlActivity.kt b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScanUrlActivity.kt index 6278c81c1..13436c3a1 100644 --- a/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScanUrlActivity.kt +++ b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScanUrlActivity.kt @@ -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? { - return if (pathSegments.size >= 1) { - val slug = pathSegments[0] - "${PeachScan.URL_SEARCH_PREFIX}$slug" - } else { - null - } - } }