fix permissions
This commit is contained in:
parent
1fb060a982
commit
7a1aa58925
|
@ -1,5 +1,6 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { Q } from '@nozbe/watermelondb';
|
||||
import { Camera } from 'expo-camera';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { useActionSheet } from '../../containers/ActionSheet';
|
||||
import StartACallActionSheet from '../../containers/UIKit/VideoConferenceBlock/components/StartACallActionSheet';
|
||||
|
@ -10,7 +11,7 @@ import database from '../database';
|
|||
import { getSubscriptionByRoomId } from '../database/services/Subscription';
|
||||
import { callJitsi } from '../methods';
|
||||
import { compareServerVersion, showErrorAlert } from '../methods/helpers';
|
||||
import { handleCallPermissions, videoConfStartAndJoin } from '../methods/videoConf';
|
||||
import { handleAndroidBltPermission, videoConfStartAndJoin } from '../methods/videoConf';
|
||||
import { Services } from '../services';
|
||||
import { useAppSelector } from './useAppSelector';
|
||||
import { useSnaps } from './useSnaps';
|
||||
|
@ -35,6 +36,8 @@ export const useVideoConf = (rid: string): { showInitCallActionSheet: () => Prom
|
|||
const jitsiEnableChannels = useAppSelector(state => state.settings.Jitsi_Enable_Channels);
|
||||
const user = useAppSelector(state => getUserSelector(state));
|
||||
|
||||
const [permission, requestPermission] = Camera.useCameraPermissions();
|
||||
|
||||
const isServer5OrNewer = compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '5.0.0');
|
||||
|
||||
const { showActionSheet } = useActionSheet();
|
||||
|
@ -87,7 +90,10 @@ export const useVideoConf = (rid: string): { showInitCallActionSheet: () => Prom
|
|||
children: <StartACallActionSheet rid={rid} initCall={initCall} />,
|
||||
snaps
|
||||
});
|
||||
handleCallPermissions();
|
||||
if (!permission?.granted) {
|
||||
requestPermission();
|
||||
handleAndroidBltPermission();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -19,14 +19,10 @@ const handleBltPermission = async (): Promise<Permission[]> => {
|
|||
return [PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION];
|
||||
};
|
||||
|
||||
export const handleCallPermissions = async (): Promise<void> => {
|
||||
export const handleAndroidBltPermission = async (): Promise<void> => {
|
||||
if (isAndroid) {
|
||||
const bltPermission = await handleBltPermission();
|
||||
await PermissionsAndroid.requestMultiple([
|
||||
PermissionsAndroid.PERMISSIONS.CAMERA,
|
||||
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
|
||||
...bltPermission
|
||||
]);
|
||||
await PermissionsAndroid.requestMultiple(bltPermission);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue