Код: Выделить всё
Код: Выделить всё
PermissionUtils.requestForPermission(
context = context,
permission = if (Build.VERSION.SDK_INT Unit,
onDenied: () -> Unit,
): PermissionLauncher {
return PermissionLauncher(
rememberLauncherForActivityResult(
ActivityResultContracts.RequestPermission()
) { isGranted: Boolean ->
if (isGranted) {
onGranted()
} else {
onDenied()
}
}
)
}
class PermissionLauncher(
val launcher: ManagedActivityResultLauncher
)
Крис
Подробнее здесь: https://stackoverflow.com/questions/782 ... ccompanist
Мобильная версия