Skip to content

Commit

Permalink
added a pop up that alerts about a possibility of an app crash
Browse files Browse the repository at this point in the history
  • Loading branch information
magda-woj committed Sep 10, 2024
1 parent e691739 commit 66a9df3
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package io.opentelemetry.android.demo.shop.ui.components

import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable

import androidx.compose.ui.tooling.preview.Preview


@Composable
fun ConfirmCrashPopup(
onConfirm: () -> Unit,
onDismiss: () -> Unit
) {

AlertDialog(
onDismissRequest = { onDismiss() },
title = {
Text(text = "Are you sure?")
},
text = {
Text(text = "This may crash the app.")
},
confirmButton = {
TextButton(onClick = { onConfirm() }) {
Text(text = "Yes, I'm sure")
}
},
dismissButton = {
TextButton(onClick = { onDismiss() }) {
Text(text = "No, go back")
}
}
)
}

0 comments on commit 66a9df3

Please sign in to comment.