Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
manufacturer: DeviceInfo.getManufacturer(),
maxMemory: DeviceInfo.getMaxMemory(),
model: DeviceInfo.getModel(),
phoneNumber: Platform.OS === 'ios' ? '' : DeviceInfo.getPhoneNumber(), // 权限http://t.cn/EP3kKhY
readableVersion: DeviceInfo.getReadableVersion(),
serialNumber: Platform.OS === 'ios' ? '' : DeviceInfo.getSerialNumber(),
systemName: DeviceInfo.getSystemName(),
systemVersion: DeviceInfo.getSystemVersion(),
timezone: DeviceInfo.getTimezone(),
storageSize: DeviceInfo.getTotalDiskCapacity(),
totalMemory: DeviceInfo.getTotalMemory(),
uniqueId: DeviceInfo.getUniqueID(),
userAgent: DeviceInfo.getUserAgent(),
version: DeviceInfo.getVersion(),
is24Hour: DeviceInfo.is24Hour(),
isEmulator: DeviceInfo.isEmulator(),
isTablet: DeviceInfo.isTablet(),
})
* The local file is ignored if RELEASE_MODE is set to true.
*/
/******************** APP ********************/
/**
* enabling Debug behaviour throughout the app.
*/
export let DEBUG = false;
/**
* Disable Native will automatically mock all BLE commands so the app can run in the simulator.
* Silence cloud will silently reject all cloud calls.
*/
export let DISABLE_NATIVE = DeviceInfo.isEmulator();
export let SILENCE_CLOUD = false;
/**
* IMPORTANT: ENCRYPTION_ENABLED determines how the app communicates with the crownstone
* IMPORTANT: AMOUNT_OF_CROWNSTONES_FOR_INDOOR_LOCALIZATION sets the limit before indoor localization is allowed.
*/
export let ENCRYPTION_ENABLED = true; // Enable encryption for the app and the libs
export const AMOUNT_OF_CROWNSTONES_FOR_INDOOR_LOCALIZATION = 4;
/**
* Point to the production cloud.
*/
export let CLOUD_ADDRESS = 'https://cloud.crownstone.rocks/api/';
const init = (pushManager) => {
// APNS doesn't work in the simulator
const isSimulator = DeviceInfo.isEmulator();
// if this native module is missing then the shell build is missing push notifications
const hasNativeModule = typeof NativeModules.PushNotificationManager !== 'undefined';
if (hasNativeModule && !isSimulator) {
return new APNSClient(pushManager);
}
return null;
};
* The local file is ignored if RELEASE_MODE is set to true.
*/
/******************** APP ********************/
/**
* enabling Debug behaviour throughout the app.
*/
export let DEBUG = false;
/**
* Disable Native will automatically mock all BLE commands so the app can run in the simulator.
* Silence cloud will silently reject all cloud calls.
*/
export let DISABLE_NATIVE = DeviceInfo.isEmulator();
export let SILENCE_CLOUD = false;
/**
* IMPORTANT: ENCRYPTION_ENABLED determines how the app communicates with the crownstone
* IMPORTANT: AMOUNT_OF_CROWNSTONES_FOR_INDOOR_LOCALIZATION sets the limit before indoor localization is allowed.
*/
export let ENCRYPTION_ENABLED = true; // Enable encryption for the app and the libs
export const AMOUNT_OF_CROWNSTONES_FOR_INDOOR_LOCALIZATION = 4;
/**
* Point to the production cloud.
*/
export let CLOUD_ADDRESS = 'https://cloud.crownstone.rocks/api/';
export function getDeviceInfo() {
const {height, width} = Dimensions.get('window');
return {
api_level: DeviceInfo.getAPILevel(),
build_number: DeviceInfo.getBuildNumber(),
bundle_id: DeviceInfo.getBundleId(),
brand: DeviceInfo.getBrand(),
country: DeviceInfo.getDeviceCountry(),
device_id: DeviceInfo.getDeviceId(),
device_locale: DeviceInfo.getDeviceLocale().split('-')[0],
device_type: DeviceInfo.getDeviceType(),
device_unique_id: DeviceInfo.getUniqueID(),
height: height ? Math.floor(height) : 0,
is_emulator: DeviceInfo.isEmulator(),
is_tablet: DeviceInfo.isTablet(),
manufacturer: DeviceInfo.getManufacturer(),
max_memory: DeviceInfo.getMaxMemory(),
model: DeviceInfo.getModel(),
system_name: DeviceInfo.getSystemName(),
system_version: DeviceInfo.getSystemVersion(),
timezone: DeviceInfo.getTimezone(),
app_version: DeviceInfo.getVersion(),
width: width ? Math.floor(width) : 0,
};
}
top: Header.height,
}}
enableCamera={isFocused}
enableScanning={enableScanning}
isCameraAuthorized={isCameraAuthorized}
onSuccess={onScanSuccess}
showCrosshairText={!!walletConnectorsCount}
/>
{DeviceInfo.isEmulator() && (
<button type="pill" style="{{" size="small" color="{colors.sendScreen.brightBlue}">
Paste session URI
</button>
)}
const showCrosshair = !error && !showErrorMessage;
return (
{this.renderCamera()}
{isCameraAuthorized && (
{showErrorMessage && (
)}
{showCrosshair && (
)}
)}
);
}
}
onPressReview: ({ onCloseModal }) => async () => {
const maxRequestCount = 2;
const count = await getAppStoreReviewCount();
const shouldDeeplinkToAppStore =
count >= maxRequestCount || !StoreReview.isAvailable;
if (shouldDeeplinkToAppStore && !DeviceInfo.isEmulator()) {
Linking.openURL(SettingsExternalURLs.review);
} else {
onCloseModal();
InteractionManager.runAfterInteractions(StoreReview.requestReview);
}
return saveAppStoreReviewCount(count + 1);
},
onPressTwitter: () => async () => {
return (
{this.renderCamera()}
{isCameraAuthorized && (
{showErrorMessage && (
)}
{showCrosshair && (
)}
)}
);
}
}
constructor(props) {
super(props);
switch (Platform.OS) {
case 'ios':
NotificationsIOS.addEventListener('remoteNotificationsRegistered', this.onPushRegistered);
NotificationsIOS.addEventListener(
'remoteNotificationsRegistrationFailed',
this.onPushRegistrationFailed,
);
if (!DeviceInfo.isEmulator()) {
NotificationsIOS.requestPermissions();
}
NotificationsIOS.addEventListener('notificationReceivedForeground', notification => {
this.onNotificationReceivedForeground(notification.getData());
});
NotificationsIOS.addEventListener('notificationReceivedBackground', notification => {
this.onNotificationReceivedBackground(notification.getData());
});
NotificationsIOS.addEventListener('notificationOpened', notification => {
this.onNotificationOpened(notification.getData());
});
break;
case 'android':
if (!LISTENERS_ADDED) {
LISTENERS_ADDED = true;