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
|
||||
|
||||
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))
|
||||
|
|
Loading…
Reference in New Issue