Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
logError(
moduleName: ModulesNames,
pageName: string,
functionName: string,
error: any,
extra: { [key: string]: string } = {},
) {
const meta = {
device: `${DeviceInfo.getModel()}-${DeviceInfo.getSystemVersion()}`,
...extra,
};
const data = {
[`${functionName}_error`]: `${JSON.stringify(
meta,
)}-${this.serializeObject(error)}`,
};
if (__DEV__) {
// tslint:disable-next-line
console.log(`${moduleName}_${pageName}_${functionName}_error:`, error);
}
Analytics.trackEvent(`${moduleName}_${pageName}`, data);
}
}
// @flow
// An All Components Screen is a great way to dev and quick-test components
import React from 'react'
import { View, ScrollView, Text, Image, NetInfo } from 'react-native'
import DeviceInfo from 'react-native-device-info'
import { Metrics, Images } from '../Themes'
import styles from './Styles/DeviceInfoScreenStyles'
const HARDWARE_DATA = [
{title: 'Device Manufacturer', info: DeviceInfo.getManufacturer()},
{title: 'Device Name', info: DeviceInfo.getDeviceName()},
{title: 'Device Model', info: DeviceInfo.getModel()},
{title: 'Device Unique ID', info: DeviceInfo.getUniqueID()},
{title: 'Device Locale', info: DeviceInfo.getDeviceLocale()},
{title: 'Device Country', info: DeviceInfo.getDeviceCountry()},
{title: 'User Agent', info: DeviceInfo.getUserAgent()},
{title: 'Screen Width', info: Metrics.screenWidth},
{title: 'Screen Height', info: Metrics.screenHeight}
]
const OS_DATA = [
{title: 'Device System Name', info: DeviceInfo.getSystemName()},
{title: 'Device ID', info: DeviceInfo.getDeviceId()},
{title: 'Device Version', info: DeviceInfo.getSystemVersion()}
]
const APP_DATA = [
{title: 'Bundle Id', info: DeviceInfo.getBundleId()},
import { Platform } from 'react-native';
import DeviceInfo from 'react-native-device-info';
import { detectLocale } from 'iota-wallet-shared-modules/libs/locale';
const device = DeviceInfo.getModel();
export const locale = detectLocale(DeviceInfo.getDeviceLocale());
export const isAndroid = Platform.OS === 'android';
export const isIOS = Platform.OS === 'ios';
export const isIPhoneX = device.includes('iPhone X');
}
const savedProfileId = await AsyncStorage.getItem('ENGAGEMENT_PROFILE_ID');
if (savedProfileId && typeof savedProfileId === 'string' && !forceProfileSync) {
this.profileId = savedProfileId;
return Promise.resolve(savedProfileId);
}
return this.networkClient.post(`/App/${this.appId}/getProfile`, {
locale: DeviceInfo.getDeviceLocale(),
country: DeviceInfo.getDeviceCountry(),
timezone: DeviceInfo.getTimezone(),
deviceIdentifier: DeviceInfo.getUniqueID(),
accountId,
deviceInfo: JSON.stringify({
model: DeviceInfo.getModel(),
appName: DeviceInfo.getBundleId(),
appVersion: DeviceInfo.getReadableVersion(),
osName: DeviceInfo.getSystemName(),
osVersion: DeviceInfo.getSystemVersion()
})
})
.then((r: any) => r.data)
.then((data: any) => {
this.profileId = data.id;
this.profileData = data;
AsyncStorage.setItem('ENGAGEMENT_PROFILE_ID', data.id).catch();
return data.id;
})
.catch((e: any) => {
render() {
var paddingView;
if(Platform.OS === 'ios') {
if(DeviceInfo.getModel() == "iPhone X")
paddingView =
logDebug(
moduleName: ModulesNames,
pageName: string,
functionName: string,
info: any,
extra: { [key: string]: string } = {},
) {
const meta = {
device: `${DeviceInfo.getModel()}-${DeviceInfo.getSystemVersion()}`,
...extra,
};
const data = {
[`${functionName}_debug`]: `${JSON.stringify(
meta,
)}-${this.serializeObject(info)}`,
};
Analytics.trackEvent(`${moduleName}_${pageName}`, data);
}
FetchFeedback(feedback) {
const formData = new FormData()
formData.append('element_1', feedback.comment)
formData.append('element_2', feedback.name)
formData.append('element_3', feedback.email)
formData.append(
'element_4',
'Device Manufacturer: ' + Device.getManufacturer() + '\n' +
'Device Brand: ' + Device.getBrand() + '\n' +
'Device Model: ' + Device.getModel() + '\n' +
'Device ID: ' + Device.getDeviceId() + '\n' +
'System Name: ' + Device.getSystemName() + '\n' +
'System Version: ' + Device.getSystemVersion() + '\n' +
'Bundle ID: ' + Device.getBundleId() + '\n' +
'App Version: ' + Device.getVersion() + '\n' +
'Build Number: ' + Device.getBuildNumber() + '\n' +
'Device Name: ' + Device.getDeviceName() + '\n' +
'User Agent: ' + Device.getUserAgent() + '\n' +
'Device Locale: ' + Device.getDeviceLocale() + '\n' +
'Device Country: ' + Device.getDeviceCountry() + '\n' +
'Timezone: ' + Device.getTimezone()
)
formData.append('form_id','175631')
formData.append('submit_form','1')
formData.append('page_number','1')
formData.append('submit_form','Submit')
import { Platform } from 'react-native';
import DeviceInfo from 'react-native-device-info';
const NOTCH_DEVICES = ['iPhone X', 'iPhone XS', 'iPhone XS Max', 'iPhone XR'];
export const isNotch = NOTCH_DEVICES.includes(DeviceInfo.getModel());
export const isIOS = Platform.OS === 'ios';
export const isAndroid = !isIOS;
export const getReadableVersion = DeviceInfo.getReadableVersion();
export const getBundleId = DeviceInfo.getBundleId();
export const getDeviceModel = DeviceInfo.getModel();
getDeviceInfo(){
var deviceInfo = {
menufacturer: DeviceInfo.getManufacturer(),
model: DeviceInfo.getModel(),
osVersion: DeviceInfo.getSystemVersion(),
releaseVersion: DeviceInfo.getVersion(),
platform: Platform.OS
}
return deviceInfo;
}
};