Skip to content

Commit

Permalink
Merge pull request #191 from GetStream/refactor/permissions
Browse files Browse the repository at this point in the history
Refactor EnsureVideoCallPermissions
  • Loading branch information
skydoves authored Mar 15, 2024
2 parents cf78fa2 + 5d92f4e commit 2f2d43d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fun WhatsAppVideoCall(
) {
val uiState by viewModel.videoUiSate.collectAsStateWithLifecycle()

EnsureAudioPermission {
EnsureVideoCallPermissions {
viewModel.joinCall(type = "default", id = id.replace(":", ""))
}

Expand Down Expand Up @@ -217,12 +217,13 @@ private fun WhatsAppVideoCallContentPreview() {

@OptIn(ExperimentalPermissionsApi::class)
@Composable
fun EnsureAudioPermission(onPermissionsGranted: () -> Unit) {
fun EnsureVideoCallPermissions(onPermissionsGranted: () -> Unit) {
// While the SDK will handle the microphone permission,
// its not a bad idea to do it prior to entering any call UIs
val permissionsState = rememberMultiplePermissionsState(
permissions = buildList {
// Access to microphone
add(Manifest.permission.CAMERA)
add(Manifest.permission.RECORD_AUDIO)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// Allow for foreground service for notification on API 26+
Expand Down

0 comments on commit 2f2d43d

Please sign in to comment.