From 6e0a312a316863de7507b543fc3e3cf1724375df Mon Sep 17 00:00:00 2001 From: lisonge Date: Thu, 16 Nov 2023 15:48:40 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=A2=9E=E5=8A=A0=E5=BC=80=E6=BA=90?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/li/songe/gkd/ui/AboutPage.kt | 26 +++++++++++++++++++ .../main/java/li/songe/gkd/util/Constants.kt | 4 ++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/li/songe/gkd/ui/AboutPage.kt b/app/src/main/java/li/songe/gkd/ui/AboutPage.kt index 922693a79..e4ad6e16a 100644 --- a/app/src/main/java/li/songe/gkd/ui/AboutPage.kt +++ b/app/src/main/java/li/songe/gkd/ui/AboutPage.kt @@ -1,29 +1,39 @@ package li.songe.gkd.ui +import android.content.Intent +import android.net.Uri +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material3.Icon import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootNavGraph import li.songe.gkd.BuildConfig +import li.songe.gkd.appScope import li.songe.gkd.util.LocalNavController import li.songe.gkd.util.ProfileTransitions +import li.songe.gkd.util.REPOSITORY_URL +import li.songe.gkd.util.launchTry @RootNavGraph @Destination(style = ProfileTransitions::class) @Composable fun AboutPage() { val navController = LocalNavController.current + val context = LocalContext.current Scaffold(topBar = { TopAppBar(navigationIcon = { IconButton(onClick = { @@ -42,6 +52,22 @@ fun AboutPage() { .padding(10.dp), verticalArrangement = Arrangement.spacedBy(10.dp) ) { + Row { + Text(text = "开源地址: ") + Text(text = REPOSITORY_URL, + color = MaterialTheme.colorScheme.primary, + modifier = Modifier.clickable { + appScope.launchTry { + // ActivityNotFoundException + // https://bugly.qq.com/v2/crash-reporting/crashes/d0ce46b353/117002?pid=1 + context.startActivity( + Intent( + Intent.ACTION_VIEW, Uri.parse(REPOSITORY_URL) + ) + ) + } + }) + } Text(text = "版本代码: " + BuildConfig.VERSION_CODE) Text(text = "版本名称: " + BuildConfig.VERSION_NAME) Text(text = "构建时间: " + BuildConfig.BUILD_DATE) diff --git a/app/src/main/java/li/songe/gkd/util/Constants.kt b/app/src/main/java/li/songe/gkd/util/Constants.kt index 352fa8516..b213d51b8 100644 --- a/app/src/main/java/li/songe/gkd/util/Constants.kt +++ b/app/src/main/java/li/songe/gkd/util/Constants.kt @@ -9,6 +9,8 @@ const val DEFAULT_SUBS_UPDATE_URL = "https://registry.npmmirror.com/@gkd-kit/subscription/latest/files" const val UPDATE_URL = "https://registry.npmmirror.com/@gkd-kit/app/latest/files/index.json" +const val REPOSITORY_URL = "https://github.com/gkd-kit/gkd" + val safeRemoteBaseUrls = arrayOf( "https://registry.npmmirror.com/@gkd-kit/", "https://cdn.jsdelivr.net/npm/@gkd-kit/", @@ -16,4 +18,4 @@ val safeRemoteBaseUrls = arrayOf( "https://unpkg.com/@gkd-kit/", "https://github.com/gkd-kit/", "https://raw.githubusercontent.com/gkd-kit/" -) \ No newline at end of file +)