@@ -9,6 +9,7 @@ import android.hardware.SensorManager
99import android.net.Uri
1010import android.os.Build
1111import android.provider.Settings
12+ import androidx.compose.foundation.BorderStroke
1213import androidx.activity.compose.rememberLauncherForActivityResult
1314import androidx.activity.result.contract.ActivityResultContracts
1415import androidx.compose.animation.AnimatedVisibility
@@ -60,6 +61,7 @@ import androidx.compose.material.icons.automirrored.filled.ArrowBack
6061import androidx.compose.material.icons.filled.ChatBubble
6162import androidx.compose.material.icons.filled.CheckCircle
6263import androidx.compose.material.icons.filled.Cloud
64+ import androidx.compose.material.icons.filled.ContentCopy
6365import androidx.compose.material.icons.filled.ExpandLess
6466import androidx.compose.material.icons.filled.ExpandMore
6567import androidx.compose.material.icons.filled.Link
@@ -1519,6 +1521,12 @@ private fun FinalStep(
15191521 enabledPermissions : String ,
15201522 methodLabel : String ,
15211523) {
1524+ val context = androidx.compose.ui.platform.LocalContext .current
1525+ val gatewayAddress = parsedGateway?.displayUrl ? : " Invalid gateway URL"
1526+ val statusLabel = gatewayStatusForDisplay(statusText)
1527+ val showDiagnostics = gatewayStatusHasDiagnostics(statusText)
1528+ val pairingRequired = gatewayStatusLooksLikePairing(statusText)
1529+
15221530 Column (verticalArrangement = Arrangement .spacedBy(10 .dp)) {
15231531 Text (" Review" , style = onboardingTitle1Style, color = onboardingText)
15241532
@@ -1531,7 +1539,7 @@ private fun FinalStep(
15311539 SummaryCard (
15321540 icon = Icons .Default .Cloud ,
15331541 label = " Gateway" ,
1534- value = parsedGateway?.displayUrl ? : " Invalid gateway URL " ,
1542+ value = gatewayAddress ,
15351543 accentColor = Color (0xFF7C5AC7 ),
15361544 )
15371545 SummaryCard (
@@ -1615,7 +1623,7 @@ private fun FinalStep(
16151623 modifier = Modifier .fillMaxWidth(),
16161624 shape = RoundedCornerShape (14 .dp),
16171625 color = onboardingWarningSoft,
1618- border = androidx.compose.foundation. BorderStroke (1 .dp, onboardingWarning.copy(alpha = 0.2f )),
1626+ border = BorderStroke (1 .dp, onboardingWarning.copy(alpha = 0.2f )),
16191627 ) {
16201628 Column (
16211629 modifier = Modifier .padding(14 .dp),
@@ -1640,13 +1648,66 @@ private fun FinalStep(
16401648 )
16411649 }
16421650 Column (verticalArrangement = Arrangement .spacedBy(2 .dp)) {
1643- Text (" Pairing Required" , style = onboardingHeadlineStyle, color = onboardingWarning)
1644- Text (" Run these on your gateway host:" , style = onboardingCalloutStyle, color = onboardingTextSecondary)
1651+ Text (
1652+ if (pairingRequired) " Pairing Required" else " Connection Failed" ,
1653+ style = onboardingHeadlineStyle,
1654+ color = onboardingWarning,
1655+ )
1656+ Text (
1657+ if (pairingRequired) {
1658+ " Approve this phone on the gateway host, or copy the report below."
1659+ } else {
1660+ " Copy this report and give it to your Claw."
1661+ },
1662+ style = onboardingCalloutStyle,
1663+ color = onboardingTextSecondary,
1664+ )
1665+ }
1666+ }
1667+ if (showDiagnostics) {
1668+ Text (" Error" , style = onboardingCaption1Style.copy(fontWeight = FontWeight .Bold ), color = onboardingTextSecondary)
1669+ Surface (
1670+ modifier = Modifier .fillMaxWidth(),
1671+ shape = RoundedCornerShape (12 .dp),
1672+ color = onboardingCommandBg,
1673+ border = BorderStroke (1 .dp, onboardingCommandBorder),
1674+ ) {
1675+ Text (
1676+ statusLabel,
1677+ modifier = Modifier .padding(horizontal = 14 .dp, vertical = 12 .dp),
1678+ style = onboardingCalloutStyle.copy(fontFamily = FontFamily .Monospace ),
1679+ color = onboardingCommandText,
1680+ )
16451681 }
1682+ Text (
1683+ " OpenClaw Android ${openClawAndroidVersionLabel()} " ,
1684+ style = onboardingCaption1Style,
1685+ color = onboardingTextSecondary,
1686+ )
1687+ Button (
1688+ onClick = {
1689+ copyGatewayDiagnosticsReport(
1690+ context = context,
1691+ screen = " onboarding final check" ,
1692+ gatewayAddress = gatewayAddress,
1693+ statusText = statusLabel,
1694+ )
1695+ },
1696+ modifier = Modifier .fillMaxWidth().height(48 .dp),
1697+ shape = RoundedCornerShape (12 .dp),
1698+ colors = ButtonDefaults .buttonColors(containerColor = onboardingSurface, contentColor = onboardingWarning),
1699+ border = BorderStroke (1 .dp, onboardingWarning.copy(alpha = 0.3f )),
1700+ ) {
1701+ Icon (Icons .Default .ContentCopy , contentDescription = null , modifier = Modifier .size(18 .dp))
1702+ Spacer (modifier = Modifier .width(8 .dp))
1703+ Text (" Copy Report for Claw" , style = onboardingCalloutStyle.copy(fontWeight = FontWeight .Bold ))
1704+ }
1705+ }
1706+ if (pairingRequired) {
1707+ CommandBlock (" openclaw devices list" )
1708+ CommandBlock (" openclaw devices approve <requestId>" )
1709+ Text (" Then tap Connect again." , style = onboardingCalloutStyle, color = onboardingTextSecondary)
16461710 }
1647- CommandBlock (" openclaw devices list" )
1648- CommandBlock (" openclaw devices approve <requestId>" )
1649- Text (" Then tap Connect again." , style = onboardingCalloutStyle, color = onboardingTextSecondary)
16501711 }
16511712 }
16521713 }
0 commit comments