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 GitHub
parent 41b54d6d87
commit fbb05fa0d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.VIDEO_CAPTURE" />
<uses-permission android:name="android.permission.AUDIO_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 <application
android:name="chat.rocket.reactnative.MainApplication" android:name="chat.rocket.reactnative.MainApplication"
android:allowBackup="false" 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 i18n from '../../i18n';
import navigation from '../navigation/appNavigation'; import navigation from '../navigation/appNavigation';
@ -7,14 +8,27 @@ import { isAndroid, showErrorAlert } from './helpers';
import log from './helpers/log'; import log from './helpers/log';
import openLink from './helpers/openLink'; 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) => { export const videoConfJoin = async (callId: string, cam: boolean) => {
try { try {
const result = await Services.videoConferenceJoin(callId, cam); const result = await Services.videoConferenceJoin(callId, cam);
if (result.success) { if (result.success) {
if (isAndroid) { if (isAndroid) {
const bltPermission = await handleBltPermission();
await PermissionsAndroid.requestMultiple([ await PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.CAMERA, PermissionsAndroid.PERMISSIONS.CAMERA,
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
...bltPermission
]); ]);
} }
const { url, providerName } = result; const { url, providerName } = result;