BlueWallet/class/camera.ts

34 lines
785 B
TypeScript
Raw Normal View History

2020-10-13 07:49:30 +02:00
import { Linking, Alert } from 'react-native';
import { getSystemName } from 'react-native-device-info';
import loc from '../loc';
2023-10-22 19:04:46 +02:00
const isDesktop: boolean = getSystemName() === 'Mac OS X';
2020-10-13 07:49:30 +02:00
export const openPrivacyDesktopSettings = () => {
if (isDesktop) {
Linking.openURL('x-apple.systempreferences:com.apple.preference.security?Privacy_Camera');
} else {
Linking.openSettings();
}
};
2023-10-22 19:04:46 +02:00
export const presentCameraNotAuthorizedAlert = (error: string) => {
2020-10-13 07:49:30 +02:00
Alert.alert(
loc.errors.error,
error,
[
{
text: loc.send.open_settings,
onPress: openPrivacyDesktopSettings,
style: 'default',
},
{
text: loc._.ok,
onPress: () => {},
style: 'cancel',
},
],
{ cancelable: true },
);
};