mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-06 07:24:49 +00:00
if -> when
This commit is contained in:
committed by
Benoit Marty
parent
986fbcdce2
commit
9e00c60649
+7
-3
@@ -32,9 +32,11 @@ fun PermissionsView(
|
|||||||
) {
|
) {
|
||||||
if (state.showDialog.not()) return
|
if (state.showDialog.not()) return
|
||||||
|
|
||||||
if (state.permissionGranted) {
|
when {
|
||||||
|
state.permissionGranted -> {
|
||||||
// Notification Granted, nothing to do
|
// Notification Granted, nothing to do
|
||||||
} else if (state.permissionAlreadyDenied) {
|
}
|
||||||
|
state.permissionAlreadyDenied -> {
|
||||||
// In this case, tell the user to go to the settings
|
// In this case, tell the user to go to the settings
|
||||||
ConfirmationDialog(
|
ConfirmationDialog(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
@@ -47,7 +49,8 @@ fun PermissionsView(
|
|||||||
},
|
},
|
||||||
onDismiss = { state.eventSink.invoke(PermissionsEvents.CloseDialog) },
|
onDismiss = { state.eventSink.invoke(PermissionsEvents.CloseDialog) },
|
||||||
)
|
)
|
||||||
} else {
|
}
|
||||||
|
else -> {
|
||||||
val textToShow = if (state.shouldShowRationale) {
|
val textToShow = if (state.shouldShowRationale) {
|
||||||
// TODO Move to state
|
// TODO Move to state
|
||||||
// If the user has denied the permission but the rationale can be shown,
|
// If the user has denied the permission but the rationale can be shown,
|
||||||
@@ -75,6 +78,7 @@ fun PermissionsView(
|
|||||||
onDismiss = {}
|
onDismiss = {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
|
|||||||
Reference in New Issue
Block a user