BlueWallet/class/camera.ts
2024-05-21 11:56:10 +01:00

33 lines
725 B
TypeScript

import { Alert, Linking } from 'react-native';
import { isDesktop } from '../blue_modules/environment';
import loc from '../loc';
export const openPrivacyDesktopSettings = () => {
if (isDesktop) {
Linking.openURL('x-apple.systempreferences:com.apple.preference.security?Privacy_Camera');
} else {
Linking.openSettings();
}
};
export const presentCameraNotAuthorizedAlert = (error: string) => {
Alert.alert(
loc.errors.error,
error,
[
{
text: loc.send.open_settings,
onPress: openPrivacyDesktopSettings,
style: 'default',
},
{
text: loc._.ok,
onPress: () => {},
style: 'cancel',
},
],
{ cancelable: true },
);
};