Lucas Villa Verde
10/10/2025, 9:53 AMval cameraPermissionLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.RequestPermission(),
// Define the callback that sends the result back as an Action to the ViewModel
onResult = { isGranted ->
viewModel.onAction(MyScreenAction.PermissionResult(isGranted))
}
)
// ... +10 rememberLauncherForActivityResult (but it could be another screen handler as well non android specific)
LaunchedEffect(key1 = Unit) {
viewModel.events.collect { event ->
when (event) {
is MyScreenEvent.ShowToast -> {
snackbarHostState.showSnackbar(event.message)
}
MyScreenEvent.NavigateToNextScreen -> {
onNavigate()
}
// ... +20 other eventsWinson Chiu
10/10/2025, 5:59 PM