From a398c3fb81090d27de578d960198ba7d7ba2e68f Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 11 Feb 2021 17:35:15 -0500 Subject: [PATCH] Handle link for multisource extension commits (closes #4432) --- .../java/eu/kanade/tachiyomi/extension/model/Extension.kt | 1 + .../eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt | 4 +++- .../extension/details/ExtensionDetailsController.kt | 8 +++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt index 480c3b0951..a08ed8480a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt @@ -18,6 +18,7 @@ sealed class Extension { override val versionCode: Int, override val lang: String, override val isNsfw: Boolean, + val pkgFactory: String?, val sources: List, val hasUpdate: Boolean = false, val isObsolete: Boolean = false, diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt index 78baabc5bf..c4d02cff7d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt @@ -31,6 +31,7 @@ internal object ExtensionLoader { private const val EXTENSION_FEATURE = "tachiyomi.extension" private const val METADATA_SOURCE_CLASS = "tachiyomi.extension.class" + private const val METADATA_SOURCE_FACTORY = "tachiyomi.extension.factory" private const val METADATA_NSFW = "tachiyomi.extension.nsfw" const val LIB_VERSION_MIN = 1.2 const val LIB_VERSION_MAX = 1.2 @@ -184,7 +185,8 @@ internal object ExtensionLoader { versionCode, lang, isNsfw, - sources, + sources = sources, + pkgFactory = appInfo.metaData.getString(METADATA_SOURCE_FACTORY), isUnofficial = signatureHash != officialSignature ) return LoadResult.Success(extension) 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 9d7043810f..67245bd62c 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 @@ -208,7 +208,11 @@ class ExtensionDetailsController(bundle: Bundle? = null) : private fun openCommitHistory() { val pkgName = presenter.extension!!.pkgName.substringAfter("eu.kanade.tachiyomi.extension.") - val url = "https://github.com/tachiyomiorg/tachiyomi-extensions/commits/master/src/${pkgName.replace(".", "/")}" + val pkgFactory = presenter.extension!!.pkgFactory + val url = when { + !pkgFactory.isNullOrEmpty() -> "$URL_EXTENSION_COMMITS/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/$pkgFactory" + else -> "$URL_EXTENSION_COMMITS/src/${pkgName.replace(".", "/")}" + } val intent = Intent(Intent.ACTION_VIEW, url.toUri()) startActivity(intent) } @@ -232,5 +236,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) : private companion object { const val PKGNAME_KEY = "pkg_name" + + private const val URL_EXTENSION_COMMITS = "https://github.com/tachiyomiorg/tachiyomi-extensions/commits/master" } }