fix(android): simplify gateway status copy · openclaw/openclaw@24ddd18
obviyus
·
2026-05-24
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -676,7 +676,7 @@ private fun GatewaySettingsScreen(
|
676 | 676 | SettingsMetric("Node", if (isNodeConnected) "Online" else "Not paired"), |
677 | 677 | SettingsMetric("Gateway", serverName?.takeIf { it.isNotBlank() } ?: "Home Gateway"), |
678 | 678 | SettingsMetric("Address", remoteAddress?.takeIf { it.isNotBlank() } ?: "Not available"), |
679 | | -SettingsMetric("Status", statusText), |
| 679 | +SettingsMetric("Status", gatewayStatusLabel(statusText = statusText, isConnected = isConnected)), |
680 | 680 | ), |
681 | 681 | ) |
682 | 682 | Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) { |
@@ -775,6 +775,23 @@ private fun AppearanceSettingsScreen(onBack: () -> Unit) {
|
775 | 775 | } |
776 | 776 | } |
777 | 777 | |
| 778 | +private fun gatewayStatusLabel( |
| 779 | +statusText: String, |
| 780 | +isConnected: Boolean, |
| 781 | +): String { |
| 782 | +if (isConnected) return "Ready" |
| 783 | +val status = statusText.trim().lowercase() |
| 784 | +return when { |
| 785 | + status.contains("connecting") || status.contains("reconnecting") -> "Connecting..." |
| 786 | + status.contains("pair") -> "Pairing needed" |
| 787 | + status.contains("auth") -> "Authentication needed" |
| 788 | + status.contains("certificate") || status.contains("tls") -> "Certificate review needed" |
| 789 | + status.contains("failed") || status.contains("error") || status.contains("offline") || status.contains("not connected") -> "Cannot reach gateway" |
| 790 | + status.isBlank() -> "Not connected" |
| 791 | +else -> "Not connected" |
| 792 | + } |
| 793 | +} |
| 794 | + |
778 | 795 | @Composable |
779 | 796 | private fun AboutSettingsScreen( |
780 | 797 | viewModel: MainViewModel, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。