Skip to content

Commit

Permalink
Implement onPermissionResult callback for launching camera & micropho…
Browse files Browse the repository at this point in the history
…ne permissions (#1057)
  • Loading branch information
skydoves authored Apr 5, 2024
1 parent 00cd036 commit ff0bd1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public abstract interface class io/getstream/video/android/compose/permission/La
}

public final class io/getstream/video/android/compose/permission/SinglePermissionKt {
public static final fun LaunchCameraPermissions (Lio/getstream/video/android/core/Call;Landroidx/compose/runtime/Composer;I)V
public static final fun LaunchMicrophonePermissions (Lio/getstream/video/android/core/Call;Landroidx/compose/runtime/Composer;I)V
public static final fun LaunchCameraPermissions (Lio/getstream/video/android/core/Call;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;I)V
public static final fun LaunchMicrophonePermissions (Lio/getstream/video/android/core/Call;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;I)V
public static final fun rememberBluetoothPermissionState (Lio/getstream/video/android/core/Call;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;I)Lio/getstream/video/android/compose/permission/VideoPermissionsState;
public static final fun rememberCameraPermissionState (Lio/getstream/video/android/core/Call;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)Lio/getstream/video/android/compose/permission/VideoPermissionsState;
public static final fun rememberMicrophonePermissionState (Lio/getstream/video/android/core/Call;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)Lio/getstream/video/android/compose/permission/VideoPermissionsState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ public fun rememberCameraPermissionState(
* - android.Manifest.permission.CAMERA
*/
@Composable
public fun LaunchCameraPermissions(call: Call) {
val callPermissionsState = rememberCameraPermissionState(call = call)
public fun LaunchCameraPermissions(
call: Call,
onPermissionsResult: (Boolean) -> Unit,
) {
val callPermissionsState =
rememberCameraPermissionState(call = call, onPermissionsResult = onPermissionsResult)
LaunchedEffect(key1 = call) { callPermissionsState.launchPermissionRequest() }
}

Expand Down Expand Up @@ -87,8 +91,12 @@ public fun rememberMicrophonePermissionState(
* - android.Manifest.permission.RECORD_AUDIO
*/
@Composable
public fun LaunchMicrophonePermissions(call: Call) {
val callPermissionsState = rememberMicrophonePermissionState(call = call)
public fun LaunchMicrophonePermissions(
call: Call,
onPermissionsResult: (Boolean) -> Unit,
) {
val callPermissionsState =
rememberMicrophonePermissionState(call = call, onPermissionsResult = onPermissionsResult)
LaunchedEffect(key1 = call) { callPermissionsState.launchPermissionRequest() }
}

Expand Down

0 comments on commit ff0bd1f

Please sign in to comment.