move the certificate screen changes to the experimental branch

This commit is contained in:
Seb3thehacker committed 2026-10-08 15:27:36 -07:00
1 parent a549077c13
commit ddaf3e5657
3 files changed
+17 -27

No files matched your search

-7
View File
@@ -31,10 +31,3 @@ CLAUDE.md
archive/ archive/
.wrangler/ .wrangler/
stats-worker/ stats-worker/
# Certificates and keys never go in the repo; the app downloads or imports them on the phone.
*.p12
*.pfx
*.pem
*.crt
*.key
@@ -60,6 +60,7 @@ fun CertSetupScreen(onDone: () -> Unit) {
val scope = rememberCoroutineScope() val scope = rememberCoroutineScope()
var downloadState by remember { mutableStateOf<DownloadState>(DownloadState.Idle) } var downloadState by remember { mutableStateOf<DownloadState>(DownloadState.Idle) }
var showImport by remember { mutableStateOf(false) }
var pendingUri by remember { mutableStateOf<Uri?>(null) } var pendingUri by remember { mutableStateOf<Uri?>(null) }
var manualProgress by remember { mutableStateOf(false) } var manualProgress by remember { mutableStateOf(false) }
@@ -90,7 +91,7 @@ fun CertSetupScreen(onDone: () -> Unit) {
if (installed) { if (installed) {
"Cars accept only Google-issued certificates, and you have one loaded." "Cars accept only Google-issued certificates, and you have one loaded."
} else { } else {
"Cars accept only Google-issued certificates. Gearslip doesn't include one, so choose where yours comes from." "Cars accept only Google-issued certificates. Download one to connect."
}, },
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
@@ -130,11 +131,10 @@ fun CertSetupScreen(onDone: () -> Unit) {
}, },
modifier = Modifier.fillMaxWidth().height(56.dp), modifier = Modifier.fillMaxWidth().height(56.dp),
) { ) {
Text("Download from aasdk") Text("Download certificate")
} }
Text( Text(
"The open-source aasdk project publishes this certificate at github.com/opencardev/aasdk. " + "Works with most cars built before 2020. Newer cars reject it.",
"Most cars accept it; some from around 2020 on don't.",
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
@@ -177,18 +177,16 @@ fun CertSetupScreen(onDone: () -> Unit) {
Spacer(Modifier.height(16.dp)) Spacer(Modifier.height(16.dp))
OutlinedButton( if (showImport) {
onClick = { importLauncher.launch(arrayOf("*/*")) }, OutlinedButton(
modifier = Modifier.fillMaxWidth().height(52.dp), onClick = { importLauncher.launch(arrayOf("*/*")) },
) { Text("Import my own file") } modifier = Modifier.fillMaxWidth().height(52.dp),
Text( ) { Text("Import your own .p12 cert") }
"A .p12 file with its private key, from wherever you choose.", Spacer(Modifier.height(16.dp))
style = MaterialTheme.typography.bodySmall, } else {
textAlign = TextAlign.Center, TextButton(onClick = { showImport = true }) { Text("Import your own certificate instead") }
color = MaterialTheme.colorScheme.onSurfaceVariant, Spacer(Modifier.height(8.dp))
modifier = Modifier.padding(top = 8.dp), }
)
Spacer(Modifier.height(16.dp))
OutlinedButton( OutlinedButton(
onClick = { onClick = {
@@ -208,7 +208,7 @@ private fun CertificateSection() {
} }
SettingsDivider() SettingsDivider()
SettingsRow( SettingsRow(
if (downloading) "Downloading…" else "Download from aasdk", if (downloading) "Downloading…" else "Download certificate",
Modifier.clickable(enabled = !downloading) { Modifier.clickable(enabled = !downloading) {
downloading = true downloading = true
scope.launch { scope.launch {
@@ -222,14 +222,13 @@ private fun CertificateSection() {
} }
} }
}, },
subtitle = "The certificate the open-source aasdk project publishes on GitHub. Gearslip doesn't include one",
icon = Icons.Filled.Refresh, icon = Icons.Filled.Refresh,
) )
SettingsDivider() SettingsDivider()
SettingsRow( SettingsRow(
"Import my own file", "Import a certificate",
Modifier.clickable { picker.launch(arrayOf("*/*")) }, Modifier.clickable { picker.launch(arrayOf("*/*")) },
subtitle = "A .p12 file with its private key, from wherever you choose", subtitle = "A .p12 file with its private key",
icon = Icons.Filled.Add, icon = Icons.Filled.Add,
) )
val removable = when (s?.kind) { val removable = when (s?.kind) {