Fix permissions for SDK<33

This commit is contained in:
sim 2024-11-28 14:57:58 +00:00
parent 064a510cbe
commit 13814133c8
1 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package org.unifiedpush.distributor.nextpush.activities.ui
import android.os.Build
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
@ -15,6 +16,9 @@ import org.unifiedpush.distributor.nextpush.R
@Preview
@Composable
fun PermissionsUi(onDone: () -> Unit = {}) {
if (Build.VERSION.SDK_INT < 33) {
onDone()
}
val notificationsPermissionState =
rememberPermissionState(
android.Manifest.permission.POST_NOTIFICATIONS
@ -34,7 +38,7 @@ fun PermissionsUi(onDone: () -> Unit = {}) {
TextButton(
onClick = {
notificationsPermissionState.launchPermissionRequest()
onDone
onDone()
}
) {
Text(stringResource(android.R.string.ok))