Fix permissions for SDK<33
This commit is contained in:
parent
064a510cbe
commit
13814133c8
|
@ -1,5 +1,6 @@
|
||||||
package org.unifiedpush.distributor.nextpush.activities.ui
|
package org.unifiedpush.distributor.nextpush.activities.ui
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
|
@ -15,6 +16,9 @@ import org.unifiedpush.distributor.nextpush.R
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
fun PermissionsUi(onDone: () -> Unit = {}) {
|
fun PermissionsUi(onDone: () -> Unit = {}) {
|
||||||
|
if (Build.VERSION.SDK_INT < 33) {
|
||||||
|
onDone()
|
||||||
|
}
|
||||||
val notificationsPermissionState =
|
val notificationsPermissionState =
|
||||||
rememberPermissionState(
|
rememberPermissionState(
|
||||||
android.Manifest.permission.POST_NOTIFICATIONS
|
android.Manifest.permission.POST_NOTIFICATIONS
|
||||||
|
@ -34,7 +38,7 @@ fun PermissionsUi(onDone: () -> Unit = {}) {
|
||||||
TextButton(
|
TextButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
notificationsPermissionState.launchPermissionRequest()
|
notificationsPermissionState.launchPermissionRequest()
|
||||||
onDone
|
onDone()
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Text(stringResource(android.R.string.ok))
|
Text(stringResource(android.R.string.ok))
|
||||||
|
|
Loading…
Reference in New Issue