Rocket.Chat.ReactNative/app/lib/methods/helpers/deviceInfo.ts

19 lines
678 B
TypeScript
Raw Normal View History

2019-01-29 19:52:56 +00:00
import { Platform } from 'react-native';
import DeviceInfo from 'react-native-device-info';
export const hasNotch = DeviceInfo.hasNotch();
2019-01-29 19:52:56 +00:00
export const isIOS = Platform.OS === 'ios';
export const isAndroid = !isIOS;
export const getReadableVersion = DeviceInfo.getReadableVersion();
2019-02-07 15:48:10 +00:00
export const getBundleId = DeviceInfo.getBundleId();
export const getDeviceModel = DeviceInfo.getModel();
2019-11-25 20:01:17 +00:00
2019-12-04 16:39:53 +00:00
// Theme is supported by system on iOS 13+ or Android 10+
export const supportSystemTheme = (): boolean => {
2019-12-04 16:39:53 +00:00
const systemVersion = parseInt(DeviceInfo.getSystemVersion(), 10);
return systemVersion >= (isIOS ? 13 : 10);
};
2019-11-25 20:01:17 +00:00
// Tablet info
export const isTablet = DeviceInfo.isTablet();