From f461c71625ff05360487f99aeeda208bd2b76c1f Mon Sep 17 00:00:00 2001 From: nicki <72807749+curche@users.noreply.github.com> Date: Sun, 12 Jun 2022 19:54:39 +0530 Subject: [PATCH] Fix Links to Changelog/Readme/Commits for `multisrc` (#7252) * Fix Links to Changelog/Readme/Commits for `multisrc` working basic fix. Needs to be refactored into `createUrl()` * Refactor back into `createUrl` hopefully the logic is understandable there's three cases: - when multisrc, if `path` isn't mentioned, then we're trying to open commmit history - when multisrc, if `path` is mentioned, then its either a changelog or a readme to a multisrc extension, the files are stored in the `overrides` subfolder - when not multisrc, we're looking at a single source where the links are constructed in the same way regardless of it being changelog/readme/commit history (cherry picked from commit e7695aef78c92c10e5bae953b24a19e67ac156af) --- .../extension/details/ExtensionDetailsController.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt index 7d76967e1a..c80f1a9d42 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsController.kt @@ -247,9 +247,13 @@ class ExtensionDetailsController(bundle: Bundle? = null) : } private fun createUrl(url: String, pkgName: String, pkgFactory: String?, path: String = ""): String { - return when { - !pkgFactory.isNullOrEmpty() -> "$url/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/$pkgFactory$path" - else -> "$url/src/${pkgName.replace(".", "/")}$path" + return if (!pkgFactory.isNullOrEmpty()) { + when (path.isEmpty()) { + true -> "$url/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/$pkgFactory" + else -> "$url/multisrc/overrides/$pkgFactory/" + (pkgName.split(".").lastOrNull() ?: "") + path + } + } else { + url + "/src/" + pkgName.replace(".", "/") + path } }