Regression: Add bluetooth permissions for Jitsi (#4796)

* add blt permissions

* Update AndroidManifest.xml

* add blt permissions

* remove wrong permission
This commit is contained in:
Gleidson Daniel Silva 2023-01-16 10:17:52 -03:00 committed by Diego Mello
parent 8f6e5c9508
commit 501d0a4ee2
2 changed files with 25 additions and 2 deletions

View File

@ -11,6 +11,15 @@
<uses-permission android:name="android.permission.VIDEO_CAPTURE" />
<uses-permission android:name="android.permission.AUDIO_CAPTURE" />
<!-- permissions related to jitsi call -->
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" android:usesPermissionFlags="neverForLocation" tools:targetApi="s" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="28"/>
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" tools:targetApi="Q"/>
<application
android:name="chat.rocket.reactnative.MainApplication"
android:allowBackup="false"

View File

@ -1,4 +1,5 @@
import { PermissionsAndroid } from 'react-native';
import { PermissionsAndroid, Permission } from 'react-native';
import DeviceInfo from 'react-native-device-info';
import i18n from '../../i18n';
import navigation from '../navigation/appNavigation';
@ -7,14 +8,27 @@ import { isAndroid, showErrorAlert } from './helpers';
import log from './helpers/log';
import openLink from './helpers/openLink';
const handleBltPermission = async (): Promise<Permission[]> => {
const systemVersion = await DeviceInfo.getApiLevel();
if (systemVersion <= 28) {
return [PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT, PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN];
}
if (systemVersion === 29) {
return [PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION];
}
return [PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION];
};
export const videoConfJoin = async (callId: string, cam: boolean) => {
try {
const result = await Services.videoConferenceJoin(callId, cam);
if (result.success) {
if (isAndroid) {
const bltPermission = await handleBltPermission();
await PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.CAMERA,
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
...bltPermission
]);
}
const { url, providerName } = result;