Use appName from BuildMeta in the crash detection dialog.

This commit is contained in:
Benoit Marty 2024-02-05 16:31:43 +01:00 committed by Benoit Marty
parent fa17fdaa44
commit 0b3a0fd6a3
6 changed files with 27 additions and 9 deletions

View file

@ -20,6 +20,7 @@ import androidx.compose.runtime.Immutable
@Immutable
data class CrashDetectionState(
val appName: String,
val crashDetected: Boolean,
val eventSink: (CrashDetectionEvents) -> Unit
)

View file

@ -17,6 +17,7 @@
package io.element.android.features.rageshake.api.crash
fun aCrashDetectionState() = CrashDetectionState(
appName = "Element",
crashDetected = false,
eventSink = {}
)

View file

@ -41,6 +41,7 @@ fun CrashDetectionView(
if (state.crashDetected) {
CrashDetectionContent(
appName = state.appName,
onYesClicked = onOpenBugReport,
onNoClicked = ::onPopupDismissed,
onDismiss = ::onPopupDismissed,
@ -50,14 +51,14 @@ fun CrashDetectionView(
@Composable
private fun CrashDetectionContent(
appName: String,
onNoClicked: () -> Unit = { },
onYesClicked: () -> Unit = { },
onDismiss: () -> Unit = { },
) {
ConfirmationDialog(
title = stringResource(id = CommonStrings.action_report_bug),
// TODO Replace with app name
content = stringResource(id = R.string.crash_detection_dialog_content, "Element"),
content = stringResource(id = R.string.crash_detection_dialog_content, appName),
submitText = stringResource(id = CommonStrings.action_yes),
cancelText = stringResource(id = CommonStrings.action_no),
onCancelClicked = onNoClicked,