From b71c793fad46b91309da5d505ff49f99847b4f68 Mon Sep 17 00:00:00 2001 From: MajorTanya <39014446+MajorTanya@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:57:23 +0100 Subject: [PATCH] Add click-to-copy extension debug info (#271) * Add click-to-copy extension debug info Adds some debug info about an extension to the user's clipboard when tapping the logo/name/package name area at the top of the details screen. Modeled after the debug info from the About screen. Closes #168. * Fix linting failure * Slight cleanup * Address detekt --------- Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> --- .../browse/ExtensionDetailsScreen.kt | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt index e55576db8..807b68b20 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt @@ -53,6 +53,7 @@ import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsScreenModel import eu.kanade.tachiyomi.util.system.LocaleHelper +import eu.kanade.tachiyomi.util.system.copyToClipboard import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf import tachiyomi.i18n.MR @@ -224,7 +225,31 @@ private fun DetailsHeader( end = MaterialTheme.padding.medium, top = MaterialTheme.padding.medium, bottom = MaterialTheme.padding.small, - ), + ) + .clickable { + val extDebugInfo = buildString { + append( + """ + Extension name: ${extension.name} (lang: ${extension.lang}; package: ${extension.pkgName}) + Extension version: ${extension.versionName} (lib: ${extension.libVersion}; version code: ${extension.versionCode}) + NSFW: ${extension.isNsfw} + """.trimIndent() + ) + + if (extension is Extension.Installed) { + append("\n\n") + append( + """ + Update available: ${extension.hasUpdate} + Obsolete: ${extension.isObsolete} + Shared: ${extension.isShared} + Repository: ${extension.repoUrl} + """.trimIndent() + ) + } + } + context.copyToClipboard("Extension Debug information", extDebugInfo) + }, horizontalAlignment = Alignment.CenterHorizontally, ) { ExtensionIcon(