@OptIn(ExperimentalPermissionsApi::class) @Composable override fun pickerTabContent(attachments: List<AttachmentPickerItemState>,onAttachmentsChanged: (List<AttachmentPickerItemState>) -> Unit,onAttachmentItemSelected: (AttachmentPickerItemState) -> Unit,onAttachmentsSubmitted: (List<AttachmentMetaData>) -> Unit,) {val context = LocalContext.current val requiresCameraPermission = isCameraPermissionDeclared(context) val cameraPermissionState = if (requiresCameraPermission) rememberPermissionState(permission = Manifest.permission.CAMERA) else null val mediaCaptureResultLauncher = rememberLauncherForActivityResult(contract = CaptureMediaContract()) { file: File? -> val attachments = if (file == null) {emptyList()} else {listOf(AttachmentMetaData(context, file))} onAttachmentsSubmitted(attachments) }  if (cameraPermissionState == null || cameraPermissionState.status == PermissionStatus.Granted) { Box(modifier = Modifier.fillMaxSize()) { LaunchedEffect(Unit) { mediaCaptureResultLauncher.launch(Unit) } } } else if (cameraPermissionState.status is PermissionStatus.Denied) { MissingPermissionContent(cameraPermissionState) } }
Emits content that allows users to start media capture.