From 0e6369d420e18b94d3b5e9296f5b793b4ee9010e Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Thu, 26 Feb 2026 16:07:10 +0100 Subject: [PATCH 1/3] bump web-client --- packages/web-client-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web-client-sdk b/packages/web-client-sdk index 2b23a8f..f3014ba 160000 --- a/packages/web-client-sdk +++ b/packages/web-client-sdk @@ -1 +1 @@ -Subproject commit 2b23a8fa8f8da3ccee29eb2093031fa6a2943286 +Subproject commit f3014ba8c7e37f905c1c16946b576d4a02ab7903 From 8f8fe14a11133bf412805dd4e04dd3dc093f56f2 Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Thu, 26 Feb 2026 16:34:40 +0100 Subject: [PATCH 2/3] update docs about new hooks --- docs/how-to/client/installation.mdx | 6 ++-- docs/how-to/client/managing-devices.mdx | 45 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/docs/how-to/client/installation.mdx b/docs/how-to/client/installation.mdx index 9bfb5e9..fbbd5bc 100644 --- a/docs/how-to/client/installation.mdx +++ b/docs/how-to/client/installation.mdx @@ -221,12 +221,10 @@ export default function App() { ## Camera and Microphone Permissions :::info -You don't need to explicitly request permissions as they're automatically asked for when your app needs them. +You don't need to explicitly request permissions — they're automatically requested when your app calls `initializeDevices()`. ::: -The SDK automatically requests camera and microphone permissions when you call `initializeDevices()`. The system permission dialog will be shown to the user if permissions haven't been granted yet. - -If you need manual control over permissions, you can use the [expo-permissions](https://docs.expo.dev/versions/latest/sdk/permissions/) or [react-native-permissions](https://github.com/zoontek/react-native-permissions) libraries. +If you need manual control over when permissions are requested, see [Managing Permissions](./managing-devices#managing-permissions-mobile-only). diff --git a/docs/how-to/client/managing-devices.mdx b/docs/how-to/client/managing-devices.mdx index a5559cb..0478833 100644 --- a/docs/how-to/client/managing-devices.mdx +++ b/docs/how-to/client/managing-devices.mdx @@ -252,3 +252,48 @@ export function MicrophoneControl() { ); } ``` + +## Managing Permissions (Mobile only) + +The SDK provides built-in hooks for querying and requesting device permissions: `useCameraPermissions` and `useMicrophonePermissions` from `@fishjam-cloud/react-native-client`. + +Both hooks return a `[query, request]` tuple: + +- **`query()`** — checks the current permission status without prompting the user +- **`request()`** — triggers the native permission dialog and returns the resulting status + +The returned `PermissionStatus` is one of: `'granted'`, `'denied'`, or `'prompt'`. + +#### Usage Example + +```tsx +// @noErrors: 2305 +import React, { useEffect } from "react"; +import { + useCameraPermissions, + useMicrophonePermissions, + useInitializeDevices, +} from "@fishjam-cloud/react-native-client"; + +function RoomScreen() { + const [queryCamera, requestCamera] = useCameraPermissions(); // [!code highlight] + const [queryMicrophone, requestMicrophone] = useMicrophonePermissions(); // [!code highlight] + const { initializeDevices } = useInitializeDevices(); // [!code highlight] + + const setup = async () => { + let cam = await queryCamera(); + let mic = await queryMicrophone(); + + if (cam !== "granted") cam = await requestCamera(); + if (mic !== "granted") mic = await requestMicrophone(); + + if (cam === "granted" && mic === "granted") { + await initializeDevices(); // [!code highlight] + } + }; + + useEffect(() => { + setup(); + }, []); +} +``` From 16f9cb32836ea02d4a1d3e30a73fa5403176ebb2 Mon Sep 17 00:00:00 2001 From: Milosz Filimowski Date: Fri, 27 Feb 2026 10:40:40 +0100 Subject: [PATCH 3/3] add missing deps --- docs/how-to/client/managing-devices.mdx | 29 +++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/how-to/client/managing-devices.mdx b/docs/how-to/client/managing-devices.mdx index 0478833..f261e36 100644 --- a/docs/how-to/client/managing-devices.mdx +++ b/docs/how-to/client/managing-devices.mdx @@ -280,20 +280,25 @@ function RoomScreen() { const [queryMicrophone, requestMicrophone] = useMicrophonePermissions(); // [!code highlight] const { initializeDevices } = useInitializeDevices(); // [!code highlight] - const setup = async () => { - let cam = await queryCamera(); - let mic = await queryMicrophone(); - - if (cam !== "granted") cam = await requestCamera(); - if (mic !== "granted") mic = await requestMicrophone(); + useEffect(() => { + const setup = async () => { + let cam = await queryCamera(); + let mic = await queryMicrophone(); - if (cam === "granted" && mic === "granted") { - await initializeDevices(); // [!code highlight] - } - }; + if (cam !== "granted") cam = await requestCamera(); + if (mic !== "granted") mic = await requestMicrophone(); - useEffect(() => { + if (cam === "granted" && mic === "granted") { + await initializeDevices(); // [!code highlight] + } + }; setup(); - }, []); + }, [ + queryCamera, + requestCamera, + queryMicrophone, + requestMicrophone, + initializeDevices, + ]); } ```