Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getConstantDeviceInfo() {
let deviceJSON = {};
deviceJSON.uniqueId = DeviceInfo.getUniqueId();
deviceJSON.deviceId = DeviceInfo.getDeviceId();
deviceJSON.bundleId = DeviceInfo.getBundleId();
deviceJSON.systemName = DeviceInfo.getSystemName();
deviceJSON.systemVersion = DeviceInfo.getSystemVersion();
deviceJSON.version = DeviceInfo.getVersion();
deviceJSON.readableVersion = DeviceInfo.getReadableVersion();
deviceJSON.buildNumber = DeviceInfo.getBuildNumber();
deviceJSON.isTablet = DeviceInfo.isTablet();
deviceJSON.appName = DeviceInfo.getApplicationName();
deviceJSON.brand = DeviceInfo.getBrand();
deviceJSON.model = DeviceInfo.getModel();
deviceJSON.deviceType = DeviceInfo.getDeviceType();
return deviceJSON;
}
InstanceID: await DeviceInfo.getInstanceId(),
LastUpdateTime: await DeviceInfo.getLastUpdateTime(),
Manufacturer: await DeviceInfo.getManufacturer(),
MaxMemory: await DeviceInfo.getMaxMemory(),
Model: DeviceInfo.getModel(),
ReadableVersion: DeviceInfo.getReadableVersion(),
SerialNumber: await DeviceInfo.getSerialNumber(),
SystemName: DeviceInfo.getSystemName(),
SystemVersion: DeviceInfo.getSystemVersion(),
TotalDiskCapacity: await DeviceInfo.getTotalDiskCapacity(),
TotalMemory: await DeviceInfo.getTotalMemory(),
UniqueID: DeviceInfo.getUniqueId(),
UserAgent: await DeviceInfo.getUserAgent(),
Version: DeviceInfo.getVersion(),
isEmulator: await DeviceInfo.isEmulator(),
isTablet: DeviceInfo.isTablet(),
}
}
export const imageForScreenSize = async (): Promise => {
const persisted = await AsyncStorage.getItem(IMAGE_SIZE_KEY)
const persistedSize = imageSizes.find(_ => _ == persisted)
if (persistedSize != undefined) {
return persistedSize
}
const isTablet = DeviceInfo.isTablet()
const screenSize = isTablet ? maxScreenSize() : minScreenSize()
const size = convertImageSizeToImageDescription(
screenSizeToImageSize(screenSize),
)
await AsyncStorage.setItem(IMAGE_SIZE_KEY, size)
return size
}
onOrientationChange = (dimensions) => {
if (this.store) {
const {dispatch} = this.store;
if (DeviceInfo.isTablet()) {
dispatch(setDeviceAsTablet());
}
const {height, width} = dimensions.window;
const orientation = height > width ? 'PORTRAIT' : 'LANDSCAPE';
dispatch(setDeviceOrientation(orientation));
dispatch(setDeviceDimensions(height, width));
}
};
return ramda.mapObjIndexed((item) => DeviceInfo.isTablet() && item.tablet && ramda.mergeDeepRight(item.tablet, item.phone) || item.phone, routes) as Record
}
} = this.props;
if ((card.hidden || backFirst) && (card.hidden || card.spoiler) && !this.state.showBack && card.code !== RANDOM_BASIC_WEAKNESS) {
return (
import keyMirror from 'mattermost-redux/utils/key_mirror';
const deviceTypes = keyMirror({
CONNECTION_CHANGED: null,
DEVICE_DIMENSIONS_CHANGED: null,
DEVICE_TYPE_CHANGED: null,
DEVICE_ORIENTATION_CHANGED: null,
STATUSBAR_HEIGHT_CHANGED: null,
});
export default {
...deviceTypes,
DOCUMENTS_PATH: `${RNFetchBlobFS.dirs.CacheDir}/Documents`,
IMAGES_PATH: `${RNFetchBlobFS.dirs.CacheDir}/Images`,
IS_IPHONE_WITH_INSETS: DeviceInfo.getModel().includes('iPhone X') || DeviceInfo.getModel().includes('iPhone 11'),
IS_TABLET: DeviceInfo.isTablet(),
VIDEOS_PATH: `${RNFetchBlobFS.dirs.CacheDir}/Videos`,
PERMANENT_SIDEBAR_SETTINGS: '@PERMANENT_SIDEBAR_SETTINGS',
};