IMPORTANT: The file content has been truncated. Status: Showing lines 120-196 of 207 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: 197. --- FILE CONTENT (truncated) --- } private fun submitReport() { if (!state.value.canSubmit) return viewModelScope.launch { _state.update { it.copy(isSubmitting = true) } performSubmission() } } private suspend fun performSubmission() { try { val s = _state.value val comments = "${s.summary}\n\n${s.description}" val email = s.contactEmail.ifBlank { null } val tags = mutableMapOf( "type" to s.type.name.lowercase(), "app_version" to s.appVersion, "android_version" to s.androidVersion, "locale" to s.locale, "device_model" to s.deviceModel, "vault_configured" to s.vaultConfigured.toString(), ) val submissionTags = if (s.includeDeviceInfo) tags else emptyMap() if (sentryWrapper.isEnabled()) { sentryWrapper.captureFeedback(comments, email, submissionTags) } else { sentryWrapper.lazyInitAndSendFeedback( app, BuildConfig.SENTRY_DSN, comments, email, submissionTags, ) } _effects.send(ReportBugEffect.ShowSnackbar(app.getString(R.string.report_bug_success))) _effects.send(ReportBugEffect.NavigateBack) } catch ( @Suppress("TooGenericExceptionCaught") e: Exception, ) { Log.e("ReportBugViewModel", "Failed to submit report", e) if (retryCount < MAX_RETRY_COUNT) { retryCount++ _effects.send(ReportBugEffect.ShowSnackbar(app.getString(R.string.report_bug_retrying, retryCount))) performSubmission() } else { _state.update { it.copy(isSubmitting = false) } _effects.send(ReportBugEffect.ShowSnackbar(app.getString(R.string.report_bug_error_failed))) fallbackToEmail() } } } private fun fallbackToEmail() { val s = _state.value val subject = "[${s.type.name}] ${s.summary}" val body = buildString { appendLine(s.description) if (s.includeDeviceInfo) { appendLine() appendLine("--- Device Info ---") appendLine("App Version: ${s.appVersion}") appendLine("Android Version: ${s.androidVersion}") appendLine("Locale: ${s.locale}") appendLine("Device Model: ${s.deviceModel}") appendLine("Vault Configured: ${s.vaultConfigured}") } } viewModelScope.launch { _effects.send(ReportBugEffect.FallbackToEmail(SUPPORT_EMAIL, subject, body))