export enum Platform { IOS = 'iOS', PWA = 'PWA', ANDROID = 'Android', } export enum AppAgent { PWA = 'PWA', IOS = 'iPhoneApp', ANDROID = 'AndroidApp', H_PWA = 'pwa', H_IOS = 'ios', H_ANDROID = 'android', H_UNKNOWN = 'unrecognised', } import { getDimensions, getOS, getOSVersion } from './native-info'; export const getPlatform = (): Platform => { const platform = getOS(); switch (platform) { case 'ios': { return Platform.IOS; } case 'android': { return Platform.ANDROID; } default: { return Platform.PWA; } } }; export const getAppAgent = (): string => { const platform = getPlatform(); switch (platform) { case Platform.IOS: { return AppAgent.IOS; } case Platform.ANDROID: { return AppAgent.ANDROID; } default: { return AppAgent.PWA; } } }; export const getJSVersion = (): string => 'N/A'; export const getDeviceWidth = (): number => { return getDimensions().width; }; export const getDeviceHeight = (): number => { return getDimensions().height; }; export const isMobile = () => true; export const isIOS = (): boolean => getPlatform() === Platform.IOS; export const isAndroid = (): boolean => getPlatform() === Platform.ANDROID; export const isAndroid_15 = (): boolean => getOSVersion() >= 35 && getPlatform() === Platform.ANDROID; export const isJSVersionUpdated = (compareVersion: number): boolean => parseInt(getJSVersion()) >= compareVersion; export const isPwa = (): boolean => getPlatform().toUpperCase() !== Platform.ANDROID.toUpperCase() && getPlatform().toUpperCase() !== Platform.IOS.toUpperCase(); export * from './native-info';