Skip to content

Commit

Permalink
sample implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham7109 committed Feb 5, 2025
1 parent 7ee8c68 commit 20d562b
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 243 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.tooling.preview.Preview
import androidx.lifecycle.ViewModel
import com.arcgismaps.exceptions.ArcGISException
import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme

/**
Expand All @@ -39,14 +41,15 @@ import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme
fun MessageDialog(
title: String,
description: String = "",
icon: ImageVector = Icons.Filled.Info,
onDismissRequest: () -> Unit
) {
Log.e("SampleAlertMessage", "$title: $description")
// display a dialog with a description text
if (description.isNotEmpty()) {
AlertDialog(
onDismissRequest = { onDismissRequest() },
icon = { Icon(Icons.Filled.Info, contentDescription = null) },
icon = { Icon(imageVector = icon, contentDescription = null) },
title = { Text(title) },
text = { Text(description) },
confirmButton = {
Expand Down Expand Up @@ -103,6 +106,18 @@ class MessageDialogViewModel : ViewModel() {
dialogStatus = true
}

fun showMessageDialog(throwable: Throwable) {
messageTitle = throwable.message.toString()
messageDescription = throwable.cause.toString()
dialogStatus = true
}

fun showMessageDialog(exception: ArcGISException) {
messageTitle = exception.message
messageDescription = exception.additionalMessage.toString() + "\n" + exception.cause
dialogStatus = true
}

/**
* Dismiss the message dialog
*/
Expand Down
Loading

0 comments on commit 20d562b

Please sign in to comment.