Hi, I have a dialog composable that I want to inte...
# compose
n
Hi, I have a dialog composable that I want to integrate in this code:
Copy code
fun checkNotificationPolicyAccess(
    notificationManager: NotificationManager,
    context: Context
): Boolean {
    if (notificationManager.isNotificationPolicyAccessGranted) {
        Toast.makeText(context, "Notification policy access granted.", Toast.LENGTH_SHORT).show()
        return true
    } else {
// add dialog here
    }
    return false
}
How can I do that? The composable looks like this:
Copy code
@Composable
fun NotificationPolicyPermissionDialog() {

    val openDialog = remember { mutableStateOf(true) }

    Dialog(onDismissRequest = { openDialog.value = false }) {
        Box(Modifier.preferredSize(100.dp, 100.dp), backgroundColor = Color.White)
    }
}
b
Composable functions usually need to be called from other composable functions
n
@Brian Beale Thanks, all I had to do was add @Composable to my function... 👍
b
Awesome! I'm still learning all of this myself, so it's good to know I got that right
👍 1