if -> when
This commit is contained in:
parent
40660ca317
commit
68fb2bd2eb
1 changed files with 45 additions and 41 deletions
|
|
@ -32,9 +32,11 @@ fun PermissionsView(
|
|||
) {
|
||||
if (state.showDialog.not()) return
|
||||
|
||||
if (state.permissionGranted) {
|
||||
when {
|
||||
state.permissionGranted -> {
|
||||
// Notification Granted, nothing to do
|
||||
} else if (state.permissionAlreadyDenied) {
|
||||
}
|
||||
state.permissionAlreadyDenied -> {
|
||||
// In this case, tell the user to go to the settings
|
||||
ConfirmationDialog(
|
||||
modifier = modifier,
|
||||
|
|
@ -47,7 +49,8 @@ fun PermissionsView(
|
|||
},
|
||||
onDismiss = { state.eventSink.invoke(PermissionsEvents.CloseDialog) },
|
||||
)
|
||||
} else {
|
||||
}
|
||||
else -> {
|
||||
val textToShow = if (state.shouldShowRationale) {
|
||||
// TODO Move to state
|
||||
// If the user has denied the permission but the rationale can be shown,
|
||||
|
|
@ -75,6 +78,7 @@ fun PermissionsView(
|
|||
onDismiss = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue