forked from msgbyte/tailchat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mobile): add webrtc permission grant and allow webrtc service wo…
…rk correct
- Loading branch information
1 parent
5d39f92
commit 3de7fe2
Showing
8 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { request, check, PERMISSIONS } from 'react-native-permissions'; | ||
import { Platform } from 'react-native'; | ||
|
||
export async function ensureWebRTCPermission() { | ||
const cameraPermission = | ||
Platform.OS === 'ios' ? PERMISSIONS.IOS.CAMERA : PERMISSIONS.ANDROID.CAMERA; | ||
const microphonePermission = | ||
Platform.OS === 'ios' | ||
? PERMISSIONS.IOS.MICROPHONE | ||
: PERMISSIONS.ANDROID.RECORD_AUDIO; | ||
|
||
const [cameraPermissionStatus, microphonePermissionStatus] = | ||
await Promise.all([check(cameraPermission), check(microphonePermission)]); | ||
|
||
if (microphonePermissionStatus !== 'granted') { | ||
await request(microphonePermission); | ||
} | ||
|
||
if (cameraPermissionStatus !== 'granted') { | ||
await request(cameraPermission); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from '../../../packages/types/index'; | ||
export * from '../../../packages/types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters