Remove the environment indirections (#7089)
* Use raw underlying globals for environment * Set dev EXPO_PUBLIC_ENV by exclusion
This commit is contained in:
+3
-5
@@ -1,9 +1,7 @@
|
||||
import {nativeApplicationVersion, nativeBuildVersion} from 'expo-application'
|
||||
|
||||
export const BUILD_ENV = process.env.EXPO_PUBLIC_ENV
|
||||
export const IS_DEV = process.env.EXPO_PUBLIC_ENV === 'development'
|
||||
export const IS_TESTFLIGHT = process.env.EXPO_PUBLIC_ENV === 'testflight'
|
||||
export const IS_INTERNAL = IS_DEV || IS_TESTFLIGHT
|
||||
export const IS_INTERNAL = __DEV__ || IS_TESTFLIGHT
|
||||
|
||||
// This is the commit hash that the current bundle was made from. The user can see the commit hash in the app's settings
|
||||
// along with the other version info. Useful for debugging/reporting.
|
||||
@@ -12,9 +10,9 @@ export const BUNDLE_IDENTIFIER = process.env.EXPO_PUBLIC_BUNDLE_IDENTIFIER ?? ''
|
||||
// This will always be in the format of YYMMDD, so that it always increases for each build. This should only be used
|
||||
// for Statsig reporting and shouldn't be used to identify a specific bundle.
|
||||
export const BUNDLE_DATE =
|
||||
IS_TESTFLIGHT || IS_DEV ? 0 : Number(process.env.EXPO_PUBLIC_BUNDLE_DATE)
|
||||
IS_TESTFLIGHT || __DEV__ ? 0 : Number(process.env.EXPO_PUBLIC_BUNDLE_DATE)
|
||||
|
||||
export const appVersion = `${nativeApplicationVersion}.${nativeBuildVersion}`
|
||||
export const bundleInfo = `${BUNDLE_IDENTIFIER} (${
|
||||
IS_DEV ? 'dev' : IS_TESTFLIGHT ? 'tf' : 'prod'
|
||||
__DEV__ ? 'dev' : IS_TESTFLIGHT ? 'tf' : 'prod'
|
||||
})`
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import {version} from '../../package.json'
|
||||
|
||||
export const BUILD_ENV = process.env.EXPO_PUBLIC_ENV
|
||||
export const IS_DEV = process.env.EXPO_PUBLIC_ENV === 'development'
|
||||
export const IS_TESTFLIGHT = false
|
||||
export const IS_INTERNAL = IS_DEV
|
||||
export const IS_INTERNAL = __DEV__
|
||||
|
||||
// This is the commit hash that the current bundle was made from. The user can see the commit hash in the app's settings
|
||||
// along with the other version info. Useful for debugging/reporting.
|
||||
@@ -12,9 +10,9 @@ export const BUNDLE_IDENTIFIER =
|
||||
|
||||
// This will always be in the format of YYMMDD, so that it always increases for each build. This should only be used
|
||||
// for Statsig reporting and shouldn't be used to identify a specific bundle.
|
||||
export const BUNDLE_DATE = IS_DEV
|
||||
export const BUNDLE_DATE = __DEV__
|
||||
? 0
|
||||
: Number(process.env.EXPO_PUBLIC_BUNDLE_DATE)
|
||||
|
||||
export const appVersion = version
|
||||
export const bundleInfo = `${BUNDLE_IDENTIFIER} (${IS_DEV ? 'dev' : 'prod'})`
|
||||
export const bundleInfo = `${BUNDLE_IDENTIFIER} (${__DEV__ ? 'dev' : 'prod'})`
|
||||
|
||||
@@ -12,8 +12,6 @@ import {
|
||||
} from 'react-native-keyboard-controller'
|
||||
import {useFocusEffect} from '@react-navigation/native'
|
||||
|
||||
import {IS_DEV} from '#/env'
|
||||
|
||||
const KeyboardControllerRefCountContext = createContext<{
|
||||
incrementRefCount: () => void
|
||||
decrementRefCount: () => void
|
||||
@@ -57,7 +55,7 @@ function KeyboardControllerProviderInner({
|
||||
refCount.current--
|
||||
setEnabled(refCount.current > 0)
|
||||
|
||||
if (IS_DEV && refCount.current < 0) {
|
||||
if (__DEV__ && refCount.current < 0) {
|
||||
console.error('KeyboardController ref count < 0')
|
||||
}
|
||||
},
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ import {Platform} from 'react-native'
|
||||
import {nativeApplicationVersion, nativeBuildVersion} from 'expo-application'
|
||||
import {init} from '@sentry/react-native'
|
||||
|
||||
import {BUILD_ENV, IS_DEV, IS_TESTFLIGHT} from '#/lib/app-info'
|
||||
import {IS_TESTFLIGHT} from '#/lib/app-info'
|
||||
|
||||
/**
|
||||
* Examples:
|
||||
@@ -27,14 +27,14 @@ const release = nativeApplicationVersion ?? 'dev'
|
||||
*/
|
||||
const dist = `${Platform.OS}.${nativeBuildVersion}.${
|
||||
IS_TESTFLIGHT ? 'tf' : ''
|
||||
}${IS_DEV ? 'dev' : ''}`
|
||||
}${__DEV__ ? 'dev' : ''}`
|
||||
|
||||
init({
|
||||
enabled: !__DEV__,
|
||||
autoSessionTracking: false,
|
||||
dsn: 'https://05bc3789bf994b81bd7ce20c86ccd3ae@o4505071687041024.ingest.sentry.io/4505071690514432',
|
||||
debug: false, // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production
|
||||
environment: BUILD_ENV ?? 'development',
|
||||
environment: process.env.NODE_ENV,
|
||||
dist,
|
||||
release,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user