diff --git a/.skills/compose-ui/strings-index.txt b/.skills/compose-ui/strings-index.txt
index f0191541a..924d89b38 100644
--- a/.skills/compose-ui/strings-index.txt
+++ b/.skills/compose-ui/strings-index.txt
@@ -1390,6 +1390,7 @@ state_broadcast_seconds
status_message
status_message_config
stay_connected_anywhere
+stop_connecting
store_forward
store_forward_config
store_forward_enabled
diff --git a/core/resources/src/commonMain/composeResources/values/strings.xml b/core/resources/src/commonMain/composeResources/values/strings.xml
index c8465f5f0..d1caff2d3 100644
--- a/core/resources/src/commonMain/composeResources/values/strings.xml
+++ b/core/resources/src/commonMain/composeResources/values/strings.xml
@@ -1432,6 +1432,7 @@
Status Message
Status Message Config
Stay Connected Anywhere
+ Stop Connecting
Store & Forward
Store & Forward Config
Store & Forward enabled
diff --git a/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/ConnectingDeviceInfo.kt b/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/ConnectingDeviceInfo.kt
index a3aff424b..b266ac5fb 100644
--- a/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/ConnectingDeviceInfo.kt
+++ b/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/ConnectingDeviceInfo.kt
@@ -37,9 +37,11 @@ import org.meshtastic.core.resources.Res
import org.meshtastic.core.resources.connected
import org.meshtastic.core.resources.connected_sleeping
import org.meshtastic.core.resources.connecting
+import org.meshtastic.core.resources.disconnect
import org.meshtastic.core.resources.must_set_region
import org.meshtastic.core.resources.not_connected
import org.meshtastic.core.resources.reconnecting
+import org.meshtastic.core.resources.stop_connecting
import org.meshtastic.core.ui.viewmodel.ConnectionStatus
/**
@@ -65,6 +67,21 @@ fun ConnectingDeviceInfo(
ConnectionStatus.NOT_CONNECTED -> stringResource(Res.string.not_connected)
}
+ // This card also renders when the transport is already CONNECTED but node info hasn't arrived yet
+ // (or the region needs setting), so only the not-yet-established states get "Stop Connecting".
+ val disconnectLabel =
+ when (connectionStatus) {
+ ConnectionStatus.CONNECTED,
+ ConnectionStatus.CONNECTED_SLEEPING,
+ ConnectionStatus.MUST_SET_REGION,
+ -> stringResource(Res.string.disconnect)
+
+ ConnectionStatus.CONNECTING,
+ ConnectionStatus.RECONNECTING,
+ ConnectionStatus.NOT_CONNECTED,
+ -> stringResource(Res.string.stop_connecting)
+ }
+
Column(modifier = modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {
Row(
modifier = Modifier.fillMaxWidth(),
@@ -84,6 +101,6 @@ fun ConnectingDeviceInfo(
}
}
- DisconnectButton(onClick = onClickDisconnect)
+ DisconnectButton(onClick = onClickDisconnect, label = disconnectLabel)
}
}
diff --git a/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/DisconnectButton.kt b/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/DisconnectButton.kt
index f077d4b45..a86d54b83 100644
--- a/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/DisconnectButton.kt
+++ b/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/DisconnectButton.kt
@@ -32,13 +32,18 @@ import org.meshtastic.core.resources.disconnect
* Centralises the color/label so every call site stays in lock-step.
*/
@Composable
-fun DisconnectButton(onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true) {
+fun DisconnectButton(
+ onClick: () -> Unit,
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+ label: String = stringResource(Res.string.disconnect),
+) {
OutlinedButton(
modifier = modifier.fillMaxWidth(),
colors = ButtonDefaults.outlinedButtonColors(contentColor = MaterialTheme.colorScheme.error),
enabled = enabled,
onClick = onClick,
) {
- Text(stringResource(Res.string.disconnect))
+ Text(label)
}
}
diff --git a/screenshot-tests/src/screenshotTestDebug/reference/org/meshtastic/screenshots/feature/ConnectionsScreenshotTestsKt/ScreenshotConnectingDeviceInfo_Dark_d19fbf1f_0.png b/screenshot-tests/src/screenshotTestDebug/reference/org/meshtastic/screenshots/feature/ConnectionsScreenshotTestsKt/ScreenshotConnectingDeviceInfo_Dark_d19fbf1f_0.png
index d563d182d..231fe7ea1 100644
Binary files a/screenshot-tests/src/screenshotTestDebug/reference/org/meshtastic/screenshots/feature/ConnectionsScreenshotTestsKt/ScreenshotConnectingDeviceInfo_Dark_d19fbf1f_0.png and b/screenshot-tests/src/screenshotTestDebug/reference/org/meshtastic/screenshots/feature/ConnectionsScreenshotTestsKt/ScreenshotConnectingDeviceInfo_Dark_d19fbf1f_0.png differ
diff --git a/screenshot-tests/src/screenshotTestDebug/reference/org/meshtastic/screenshots/feature/ConnectionsScreenshotTestsKt/ScreenshotConnectingDeviceInfo_Light_b29dc7a7_0.png b/screenshot-tests/src/screenshotTestDebug/reference/org/meshtastic/screenshots/feature/ConnectionsScreenshotTestsKt/ScreenshotConnectingDeviceInfo_Light_b29dc7a7_0.png
index 573d8b84d..d727fb0a5 100644
Binary files a/screenshot-tests/src/screenshotTestDebug/reference/org/meshtastic/screenshots/feature/ConnectionsScreenshotTestsKt/ScreenshotConnectingDeviceInfo_Light_b29dc7a7_0.png and b/screenshot-tests/src/screenshotTestDebug/reference/org/meshtastic/screenshots/feature/ConnectionsScreenshotTestsKt/ScreenshotConnectingDeviceInfo_Light_b29dc7a7_0.png differ