Skip to content

Commit

Permalink
Refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
umer0586 committed Jan 16, 2025
1 parent 9c4ce2e commit c10b4d3
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ fun ControlPadPlayScreen(
}



BackHandler {
viewModel.onEvent(ControlPadPlayScreenEvent.OnBackPress)
onBackPress?.invoke()
}

ControlPlayScreenContent(
uiState = uiState,
onUiEvent = {event->
Expand Down Expand Up @@ -152,6 +146,11 @@ fun ControlPlayScreenContent(
snackbarHostState.showSnackbar(uiState.connectionState.toString())
}

// When device back button is pressed
BackHandler {
onUiEvent(ControlPadPlayScreenEvent.OnBackPress)
}

Scaffold(
snackbarHost = { SnackbarHost(snackbarHostState) },
bottomBar = {
Expand Down Expand Up @@ -501,9 +500,9 @@ fun ControlPadPlayScreenContentPreview(modifier: Modifier = Modifier) {
var uiState by remember { mutableStateOf(
ControlPadPlayScreenState(
controlPadItems = controlPadItems,
connectionState = ConnectionState.BLUETOOTH_ADVERTISEMENT_SUCCESS,
connectionType = ConnectionType.TCP,
isConnecting = true,
connectionState = ConnectionState.WEBSOCKET_CONNECTED,
connectionType = ConnectionType.WEBSOCKET,
isConnecting = false,
isConnected = true,
hostAddress = "org.mosquitto.org:80807",
controlPadBackgroundColor = controlPad.backgroundColor
Expand Down

0 comments on commit c10b4d3

Please sign in to comment.