Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getDeviceInfo = () => ({
apiLevel: Platform.OS === 'ios' ? '' : DeviceInfo.getAPILevel(),
appName: DeviceInfo.getApplicationName(),
brand: DeviceInfo.getBrand(),
buildNumber: DeviceInfo.getBuildNumber(),
bundleId: DeviceInfo.getBundleId(),
deviceCountry: DeviceInfo.getDeviceCountry(),
deviceId: DeviceInfo.getDeviceId(),
deviceLocale: DeviceInfo.getDeviceLocale(),
deviceName: DeviceInfo.getDeviceName(),
firstInstallTime: Platform.OS === 'ios' ? '' : DeviceInfo.getFirstInstallTime(),
freeDiskStorage: DeviceInfo.getFreeDiskStorage(),
referrer: Platform.OS === 'ios' ? '' : DeviceInfo.getInstallReferrer(),
instanceId: Platform.OS === 'ios' ? '' : DeviceInfo.getInstanceID(),
lastUpdateTime: Platform.OS === 'ios' ? '' : DeviceInfo.getLastUpdateTime(),
manufacturer: DeviceInfo.getManufacturer(),
maxMemory: DeviceInfo.getMaxMemory(),
model: DeviceInfo.getModel(),
phoneNumber: Platform.OS === 'ios' ? '' : DeviceInfo.getPhoneNumber(), // 权限http://t.cn/EP3kKhY
async function getDeviceInfo() {
return {
AppName: DeviceInfo.getApplicationName(),
Brand: DeviceInfo.getBrand(),
BuildNumber: DeviceInfo.getBuildNumber(),
BundleId: DeviceInfo.getBundleId(),
Carrier: await DeviceInfo.getCarrier(),
DeviceId: DeviceInfo.getDeviceId(),
DeviceName: await DeviceInfo.getDeviceName(), // NOTE(nitya) this might contain PII, monitor
FirstInstallTime: await DeviceInfo.getFirstInstallTime(),
FontScale: await DeviceInfo.getFontScale(),
FreeDiskStorage: await DeviceInfo.getFreeDiskStorage(),
InstallReferrer: await DeviceInfo.getInstallReferrer(),
InstanceID: await DeviceInfo.getInstanceId(),
LastUpdateTime: await DeviceInfo.getLastUpdateTime(),
Manufacturer: await DeviceInfo.getManufacturer(),
MaxMemory: await DeviceInfo.getMaxMemory(),
Model: DeviceInfo.getModel(),
ReadableVersion: DeviceInfo.getReadableVersion(),
getAppInfo = () => {
const appName = getApplicationName();
const appVersion = getVersion();
const buildNumber = getBuildNumber();
return `${appName} v${appVersion} (${buildNumber})`;
};
componentDidMount() {
this.deviceInfo = {
applicationName: DeviceInfo.getApplicationName(),
buildNumber: DeviceInfo.getBuildNumber(),
bundleId: DeviceInfo.getBundleId(),
deviceId: DeviceInfo.getDeviceId(),
readableVersion: DeviceInfo.getReadableVersion(),
version: DeviceInfo.getVersion()
};
}
} from '@brandingbrand/fsengage';
import { env as projectEnv } from '@brandingbrand/fsapp';
import { CommerceTypes } from '@brandingbrand/fscommerce';
import { Platform } from 'react-native';
import DeviceInfo from 'react-native-device-info';
const { version } = projectEnv;
const commonConfiguration = {
userAgent: DeviceInfo.getUserAgent(),
osType: Platform.OS,
osVersion: (Platform.Version && Platform.Version.toString()) || '',
appName: DeviceInfo.getApplicationName(),
appId: DeviceInfo.getBundleId(),
appVersion: version
};
const googleAnalyticsConfiguration = {
trackerId: projectEnv.googleAnalytics[Platform.OS],
clientId: DeviceInfo.getUniqueID()
};
const providers = [
new GoogleAnalyticsProvider(
commonConfiguration,
googleAnalyticsConfiguration
)
];
style={styles.optionButton}
value={this.state.pinProtection}
onValueChange={this.onPinProtectionSwitch}
/>
);
}
}
permissionRequest = await Permissions.request('photo');
if (permissionRequest !== PermissionTypes.AUTHORIZED) {
return;
}
break;
case PermissionTypes.DENIED: {
const canOpenSettings = await Permissions.canOpenSettings();
let grantOption = null;
if (canOpenSettings) {
grantOption = {
text: formatMessage({id: 'mobile.permission_denied_retry', defaultMessage: 'Settings'}),
onPress: () => Permissions.openSettings(),
};
}
const applicationName = DeviceInfo.getApplicationName();
Alert.alert(
formatMessage({
id: 'mobile.photo_library_permission_denied_title',
defaultMessage: '{applicationName} would like to access your photo library',
}, {applicationName}),
formatMessage({
id: 'mobile.photo_library_permission_denied_description',
defaultMessage: 'To save images and videos to your library, please change your permission settings.',
}),
[
grantOption,
{text: formatMessage({id: 'mobile.permission_denied_dismiss', defaultMessage: 'Don\'t Allow'})},
]
);
return;
}
getPermissionDeniedMessage = (mediaType = '') => {
const {formatMessage} = this.context.intl;
const applicationName = DeviceInfo.getApplicationName();
if (mediaType === 'video') {
return {
title: formatMessage({
id: 'mobile.camera_video_permission_denied_title',
defaultMessage: '{applicationName} would like to access your camera',
}, {applicationName}),
text: formatMessage({
id: 'mobile.camera_video_permission_denied_description',
defaultMessage: 'Take videos and upload them to your Mattermost instance or save them to your device. Open Settings to grant Mattermost Read and Write access to your camera.',
}),
};
}
return {
title: formatMessage({
id: 'mobile.camera_photo_permission_denied_title',
componentDidMount() {
this.deviceInfo = {
applicationName: DeviceInfo.getApplicationName(),
buildNumber: DeviceInfo.getBuildNumber(),
bundleId: DeviceInfo.getBundleId(),
deviceId: DeviceInfo.getDeviceId(),
readableVersion: DeviceInfo.getReadableVersion(),
version: DeviceInfo.getVersion()
};
}
getPermissionDeniedMessage = (source, mediaType = '') => {
const {formatMessage} = this.context.intl;
const applicationName = DeviceInfo.getApplicationName();
switch (source) {
case 'camera': {
if (mediaType === 'video') {
return {
title: formatMessage({
id: 'mobile.camera_video_permission_denied_title',
defaultMessage: '{applicationName} would like to access your camera',
}, {applicationName}),
text: formatMessage({
id: 'mobile.camera_video_permission_denied_description',
defaultMessage: 'Take videos and upload them to your Mattermost instance or save them to your device. Open Settings to grant Mattermost Read and Write access to your camera.',
}),
};
}
return {