forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import {Platform} from 'react-native'
2import {nativeBuildVersion} from 'expo-application'
3
4import {BUNDLE_IDENTIFIER, IS_TESTFLIGHT, RELEASE_VERSION} from '#/env/common'
5
6export * from '#/env/common'
7
8// for some reason Platform.OS === 'ios' AND Platform.Version is undefined in our CI unit tests -sfn
9const iOSMajorVersion =
10 Platform.OS === 'ios' && typeof Platform.Version === 'string'
11 ? parseInt(Platform.Version.split('.')[0], 10)
12 : 0
13const androidPlatformVersion =
14 Platform.OS === 'android' && typeof Platform.Version === 'number'
15 ? Platform.Version
16 : 0
17
18/**
19 * The semver version of the app, specified in our `package.json`.file. On
20 * iOs/Android, the native build version is appended to the semver version, so
21 * that it can be used to identify a specific build.
22 */
23export const APP_VERSION = `${RELEASE_VERSION}.${nativeBuildVersion}`
24
25/**
26 * The short commit hash and environment of the current bundle.
27 */
28export const APP_METADATA = `${BUNDLE_IDENTIFIER.slice(0, 7)} (${
29 __DEV__ ? 'dev' : IS_TESTFLIGHT ? 'tf' : 'prod'
30})`
31
32/**
33 * Platform detection
34 */
35export const IS_IOS: boolean = Platform.OS === 'ios'
36export const IS_ANDROID: boolean = Platform.OS === 'android'
37export const IS_NATIVE: boolean = true
38export const IS_WEB: boolean = false
39
40/**
41 * Web-specific platform detection
42 */
43export const IS_WEB_TOUCH_DEVICE: boolean = true
44export const IS_WEB_MOBILE: boolean = false
45export const IS_WEB_MOBILE_IOS: boolean = false
46export const IS_WEB_MOBILE_ANDROID: boolean = false
47export const IS_WEB_SAFARI: boolean = false
48export const IS_WEB_FIREFOX: boolean = false
49
50/**
51 * Misc
52 */
53export const IS_HIGH_DPI: boolean = true
54// ideally we'd use isLiquidGlassAvailable() from expo-glass-effect but checking iOS version is good enough for now
55export const IS_LIQUID_GLASS: boolean = iOSMajorVersion >= 26
56// So we can avoid attempting on-device translation when we know it's unsupported.
57export const IS_TRANSLATION_SUPPORTED: boolean =
58 (IS_IOS && iOSMajorVersion >= 18) ||
59 (IS_ANDROID && androidPlatformVersion > 22)