From dc225dba188a1c5a12a654a48cd12c513766c516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartu=20=C3=96zen?= Date: Mon, 13 May 2024 18:17:59 +0300 Subject: [PATCH] Bato.to: Add deep link support for v3x (#2971) --- src/all/batoto/AndroidManifest.xml | 3 +++ src/all/batoto/build.gradle | 2 +- .../extension/all/batoto/BatoToUrlActivity.kt | 21 +++++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/all/batoto/AndroidManifest.xml b/src/all/batoto/AndroidManifest.xml index c4ca310dd..85cb5b64f 100644 --- a/src/all/batoto/AndroidManifest.xml +++ b/src/all/batoto/AndroidManifest.xml @@ -47,6 +47,9 @@ + diff --git a/src/all/batoto/build.gradle b/src/all/batoto/build.gradle index 796d6111e..20571170a 100644 --- a/src/all/batoto/build.gradle +++ b/src/all/batoto/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Bato.to' extClass = '.BatoToFactory' - extVersionCode = 35 + extVersionCode = 36 isNsfw = true } diff --git a/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoToUrlActivity.kt b/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoToUrlActivity.kt index 4f1bd140e..90b9718e4 100644 --- a/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoToUrlActivity.kt +++ b/src/all/batoto/src/eu/kanade/tachiyomi/extension/all/batoto/BatoToUrlActivity.kt @@ -42,8 +42,25 @@ class BatoToUrlActivity : Activity() { private fun fromBatoTo(pathSegments: MutableList): String? { return if (pathSegments.size >= 2) { - val id = pathSegments[1] - "ID:$id" + val path = pathSegments[1] as java.lang.String? + if (path != null) { + var index = -1 + for (i in path.indices) { + if (path[i] == '-') { + index = i + break + } + } + + val id = if (index == -1) { + path + } else { + path.substring(0, index) + } + "ID:$id" + } else { + null + } } else { null }