BlueWallet/class/camera.ts

33 lines
725 B
TypeScript
Raw Normal View History

2024-05-20 11:54:13 +02:00
import { Alert, Linking } from 'react-native';
2024-03-17 18:03:39 +01:00
import { isDesktop } from '../blue_modules/environment';
2024-05-20 11:54:13 +02:00
import loc from '../loc';
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 },
);
};