-
-
Save Arunshaik2001/88804d81499b9dd655edcbd0cf0d0e2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Surface( | |
modifier = Modifier | |
.fillMaxSize() | |
.padding(10.dp), | |
color = MaterialTheme.colors.background | |
) { | |
val deviceScanningState by viewModel.viewState.observeAsState() | |
val deviceConnectionState by ChatServer.deviceConnection.observeAsState() | |
var isChatOpen by remember { | |
mutableStateOf(false) | |
} | |
Box( | |
contentAlignment = Alignment.TopCenter, | |
modifier = Modifier.fillMaxSize() | |
) { | |
if (deviceScanningState != null && !isChatOpen || deviceConnectionState == DeviceConnectionState.Disconnected) { | |
Column { | |
Text( | |
text = "Choose a device to chat with:", | |
fontSize = 20.sp, | |
fontWeight = FontWeight.Bold | |
) | |
Spacer(modifier = Modifier.height(10.dp)) | |
DeviceScanCompose.DeviceScan(deviceScanViewState = deviceScanningState!!) { | |
isChatOpen = true | |
} | |
} | |
} else { | |
ChatCompose.Chats() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment