import { PermissionsAndroid, Platform } from 'react-native'; /** * Android: prompts for camera + microphone. `EnxChatWidget` calls this only when a video-call URL is * received (start video call), not on initial chat load. The meeting page may still trigger WebView prompts. * iOS: prompts when the page uses the mic/camera — ensure Info.plist has `NSCameraUsageDescription` and * `NSMicrophoneUsageDescription`. * * Geolocation: not requested here. Use `requestLocationForWebView()` only if you opted into * `proactiveLocationPermission` on the widget, or rely on the WebView when the page calls geolocation. */ export async function requestLocationForWebView(): Promise { if (Platform.OS !== 'android') return; try { await PermissionsAndroid.requestMultiple([ PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION, ]); } catch { // Denied or unavailable; page may still work without precise location. } } export async function requestCameraAndMicrophoneForMedia(): Promise { if (Platform.OS !== 'android') return; try { await PermissionsAndroid.requestMultiple([ PermissionsAndroid.PERMISSIONS.CAMERA, PermissionsAndroid.PERMISSIONS.RECORD_AUDIO, ]); } catch { // User denied or device error; WebView may still open and the site can show its own message. } }