IMPORTANT: The file content has been truncated. Status: Showing lines 101-300 of 328 total lines. Action: To read more of the file, you can use the 'start_line' and 'end_line' parameters in a subsequent 'read_file' call. For example, to read the next section of the file, use start_line: 301. --- FILE CONTENT (truncated) --- context.startActivity(intent) } catch (_: Exception) { snackbarHostState.showSnackbar(noEmailAppMessage) } } } } } Scaffold( snackbarHost = { SnackbarHost(snackbarHostState) }, topBar = { TopAppBar( title = { Text( text = stringResource(R.string.report_bug_title), modifier = Modifier.testTag(TestTags.SCREEN_TITLE), ) }, navigationIcon = { IconButton(onClick = { backStack.removeLastOrNull() }, enabled = !state.isSubmitting) { Icon( Icons.AutoMirrored.Outlined.ArrowBack, contentDescription = stringResource(R.string.action_back), ) } }, actions = { if (state.isSubmitting) { CircularProgressIndicator( modifier = Modifier.size(24.dp).padding(end = 16.dp).testTag(TestTags.REPORT_BUG_LOADING), strokeWidth = 2.dp, ) } else { TextButton( onClick = { viewModel.onEvent(ReportBugEvent.Submit) }, enabled = state.canSubmit, modifier = Modifier.testTag(TestTags.REPORT_BUG_SUBMIT_BUTTON), ) { Text(stringResource(R.string.report_bug_submit)) } } }, colors = appTopAppBarColors(), ) }, ) { padding -> Column( modifier = Modifier .fillMaxSize() .padding(padding) .imePadding() .verticalScroll(scrollState) .padding(horizontal = 16.dp, vertical = 12.dp), verticalArrangement = Arrangement.spacedBy(12.dp), ) { if (state.isSubmitting) { LinearProgressIndicator( modifier = Modifier.fillMaxWidth(), ) } // Type Text( text = stringResource(R.string.report_bug_type_section), style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, ) SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) { SegmentedButton( selected = state.type == ReportType.BUG, onClick = { viewModel.onEvent(ReportBugEvent.TypeChanged(ReportType.BUG)) }, shape = SegmentedButtonDefaults.itemShape(index = 0, count = 2), enabled = !state.isSubmitting, label = { Text(stringResource(R.string.report_bug_type_bug)) }, modifier = Modifier.testTag(TestTags.REPORT_BUG_TYPE_BUG), ) SegmentedButton( selected = state.type == ReportType.SUGGESTION, onClick = { viewModel.onEvent(ReportBugEvent.TypeChanged(ReportType.SUGGESTION)) }, shape = SegmentedButtonDefaults.itemShape(index = 1, count = 2), enabled = !state.isSubmitting, label = { Text(stringResource(R.string.report_bug_type_suggestion)) }, modifier = Modifier.testTag(TestTags.REPORT_BUG_TYPE_SUGGESTION), ) } OutlinedTextField( value = state.summary, onValueChange = { viewModel.onEvent(ReportBugEvent.SummaryChanged(it)) }, label = { Text(stringResource(R.string.report_bug_summary)) }, modifier = Modifier.fillMaxWidth().testTag(TestTags.REPORT_BUG_SUMMARY_FIELD), singleLine = true, enabled = !state.isSubmitting, supportingText = { Text( "${state.summary.length}/${ReportBugViewModel.MAX_SUMMARY_LENGTH}", modifier = Modifier.fillMaxWidth(), ) }, ) OutlinedTextField( value = state.description, onValueChange = { viewModel.onEvent(ReportBugEvent.DescriptionChanged(it)) }, label = { Text(stringResource(R.string.report_bug_description)) }, modifier = Modifier .fillMaxWidth() .height(160.dp) .testTag(TestTags.REPORT_BUG_DESCRIPTION_FIELD), enabled = !state.isSubmitting, supportingText = { Text( "${state.description.length}/${ReportBugViewModel.MAX_DESCRIPTION_LENGTH}", modifier = Modifier.fillMaxWidth(), ) }, ) OutlinedTextField( value = state.contactEmail, onValueChange = { viewModel.onEvent(ReportBugEvent.ContactEmailChanged(it)) }, label = { Text(stringResource(R.string.report_bug_contact_email)) }, modifier = Modifier.fillMaxWidth().testTag(TestTags.REPORT_BUG_EMAIL_FIELD), singleLine = true, enabled = !state.isSubmitting, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email), isError = state.isEmailInvalid, supportingText = if (state.isEmailInvalid) { { Text(stringResource(R.string.report_bug_contact_email_invalid)) } } else { null }, ) Card( modifier = Modifier.fillMaxWidth(), colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerLow), ) { Column(modifier = Modifier.animateContentSize()) { Row( modifier = Modifier .fillMaxWidth() .clickable( enabled = !state.isSubmitting, onClickLabel = stringResource( if (state.showDeviceInfo) R.string.action_show_less else R.string.action_show_more, ), ) { viewModel.onEvent(ReportBugEvent.ToggleDeviceInfo) } .padding(16.dp) .testTag(TestTags.REPORT_BUG_DEVICE_INFO_CARD) .semantics { stateDescription = if (state.showDeviceInfo) { expandedDescription } else { collapsedDescription } role = Role.Button }, verticalAlignment = Alignment.CenterVertically, ) { Text( stringResource(R.string.report_bug_device_info_payload), style = MaterialTheme.typography.titleSmall, modifier = Modifier.weight(1f), ) Icon( if (state.showDeviceInfo) Icons.Default.ExpandLess else Icons.Default.ExpandMore, contentDescription = null, ) } AnimatedVisibility(visible = state.showDeviceInfo) { Column(modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp)) { Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(bottom = 8.dp)) { Text( stringResource(R.string.report_bug_include_device_info), style = MaterialTheme.typography.bodyMedium, modifier = Modifier.weight(1f), ) Switch( checked = state.includeDeviceInfo, onCheckedChange = { viewModel.onEvent(ReportBugEvent.IncludeDeviceInfoChanged(it)) }, modifier = Modifier.testTag(TestTags.REPORT_BUG_DEVICE_INFO_TOGGLE), enabled = !state.isSubmitting, ) } DeviceInfoItem(stringResource(R.string.report_bug_app_version), state.appVersion) DeviceInfoItem(stringResource(R.string.report_bug_android_version), state.androidVersion) DeviceInfoItem(stringResource(R.string.report_bug_locale), state.locale) DeviceInfoItem(stringResource(R.string.report_bug_device_model), state.deviceModel) DeviceInfoItem(stringResource(R.string.report_bug_vault_configured), state.vaultConfigured.toString())