diff --git a/.env.example b/.env.example
index 979589f58b..a4d21ac332 100644
--- a/.env.example
+++ b/.env.example
@@ -2,7 +2,6 @@
BITDRIFT_API_KEY=
SENTRY_AUTH_TOKEN=
-EXPO_PUBLIC_ENV=development
EXPO_PUBLIC_LOG_LEVEL=debug
EXPO_PUBLIC_LOG_DEBUG=
EXPO_PUBLIC_BUNDLE_IDENTIFIER=
diff --git a/app.config.js b/app.config.js
index bc283152bd..d47481e620 100644
--- a/app.config.js
+++ b/app.config.js
@@ -15,9 +15,9 @@ module.exports = function (config) {
*/
const PLATFORM = process.env.EAS_BUILD_PLATFORM
- const IS_DEV = process.env.EXPO_PUBLIC_ENV === 'development'
const IS_TESTFLIGHT = process.env.EXPO_PUBLIC_ENV === 'testflight'
const IS_PRODUCTION = process.env.EXPO_PUBLIC_ENV === 'production'
+ const IS_DEV = !IS_TESTFLIGHT || !IS_PRODUCTION
const ASSOCIATED_DOMAINS = [
'applinks:bsky.app',
diff --git a/src/components/Typography.tsx b/src/components/Typography.tsx
index 3e202cb8f2..4ed7f83719 100644
--- a/src/components/Typography.tsx
+++ b/src/components/Typography.tsx
@@ -8,7 +8,6 @@ import {
renderChildrenWithEmoji,
TextProps,
} from '#/alf/typography'
-import {IS_DEV} from '#/env'
export type {TextProps}
/**
@@ -31,7 +30,7 @@ export function Text({
flags,
})
- if (IS_DEV) {
+ if (__DEV__) {
if (!emoji && childHasEmoji(children)) {
logger.warn(
`Text: emoji detected but emoji not enabled: "${children}"\n\nPlease add '`,
diff --git a/src/components/dialogs/nuxs/index.tsx b/src/components/dialogs/nuxs/index.tsx
index 11d622a4dc..10cae887ba 100644
--- a/src/components/dialogs/nuxs/index.tsx
+++ b/src/components/dialogs/nuxs/index.tsx
@@ -15,7 +15,6 @@ import {useOnboardingState} from '#/state/shell'
* NUXs
*/
import {isSnoozed, snooze, unsnooze} from '#/components/dialogs/nuxs/snoozing'
-import {IS_DEV} from '#/env'
type Context = {
activeNux: Nux | undefined
@@ -93,10 +92,10 @@ function Inner({
setActiveNux(undefined)
}, [activeNux, setActiveNux])
- if (IS_DEV && typeof window !== 'undefined') {
+ if (__DEV__ && typeof window !== 'undefined') {
// @ts-ignore
window.clearNuxDialog = (id: Nux) => {
- if (!IS_DEV || !id) return
+ if (!__DEV__ || !id) return
resetNuxs([id])
unsnooze()
}
diff --git a/src/env.ts b/src/env.ts
index 4d1b55a4ee..32ce70670b 100644
--- a/src/env.ts
+++ b/src/env.ts
@@ -1,5 +1,3 @@
-export const IS_DEV = __DEV__
-export const IS_PROD = !IS_DEV
export const LOG_DEBUG = process.env.EXPO_PUBLIC_LOG_DEBUG || ''
export const LOG_LEVEL = (process.env.EXPO_PUBLIC_LOG_LEVEL || 'info') as
| 'debug'
diff --git a/src/lib/app-info.ts b/src/lib/app-info.ts
index 4da70d75d8..0749087eae 100644
--- a/src/lib/app-info.ts
+++ b/src/lib/app-info.ts
@@ -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'
})`
diff --git a/src/lib/app-info.web.ts b/src/lib/app-info.web.ts
index 742ccfe975..94c787cbcf 100644
--- a/src/lib/app-info.web.ts
+++ b/src/lib/app-info.web.ts
@@ -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'})`
diff --git a/src/lib/hooks/useEnableKeyboardController.tsx b/src/lib/hooks/useEnableKeyboardController.tsx
index c7205d0160..366791c0c4 100644
--- a/src/lib/hooks/useEnableKeyboardController.tsx
+++ b/src/lib/hooks/useEnableKeyboardController.tsx
@@ -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')
}
},
diff --git a/src/lib/sentry.ts b/src/lib/sentry.ts
index 2c390d7de9..b2695694dd 100644
--- a/src/lib/sentry.ts
+++ b/src/lib/sentry.ts
@@ -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,
})
diff --git a/src/logger/README.md b/src/logger/README.md
index 17dd61cb39..8da7deb14e 100644
--- a/src/logger/README.md
+++ b/src/logger/README.md
@@ -17,8 +17,8 @@ logger.error(error[, metadata])
#### Modes
-The "modes" referred to here are inferred from the values exported from `#/env`.
-Basically, the booleans `IS_DEV` and `IS_PROD`.
+The "modes" referred to here are inferred from `process.env.NODE_ENV`,
+which matches how React Native sets the `__DEV__` global.
#### Log Levels
diff --git a/src/logger/__tests__/logger.test.ts b/src/logger/__tests__/logger.test.ts
index 02039d26e9..be2391e126 100644
--- a/src/logger/__tests__/logger.test.ts
+++ b/src/logger/__tests__/logger.test.ts
@@ -5,8 +5,6 @@ import {nanoid} from 'nanoid/non-secure'
import {Logger, LogLevel, sentryTransport} from '#/logger'
jest.mock('#/env', () => ({
- IS_DEV: false,
- IS_PROD: false,
/*
* Forces debug mode for tests using the default logger. Most tests create
* their own logger instance.
diff --git a/src/logger/index.ts b/src/logger/index.ts
index d99bfeb131..102bccef7a 100644
--- a/src/logger/index.ts
+++ b/src/logger/index.ts
@@ -270,13 +270,14 @@ if (process.env.NODE_ENV !== 'test') {
logger.addTransport(createBitdriftTransport())
}
-if (env.IS_DEV && process.env.NODE_ENV !== 'test') {
- logger.addTransport(consoleTransport)
-
- /*
- * Comment this out to disable Sentry transport in dev
- */
- // logger.addTransport(sentryTransport)
-} else if (env.IS_PROD) {
- logger.addTransport(sentryTransport)
+if (process.env.NODE_ENV !== 'test') {
+ if (__DEV__) {
+ logger.addTransport(consoleTransport)
+ /*
+ * Comment this out to enable Sentry transport in dev
+ */
+ // logger.addTransport(sentryTransport)
+ } else {
+ logger.addTransport(sentryTransport)
+ }
}
diff --git a/src/screens/Onboarding/Layout.tsx b/src/screens/Onboarding/Layout.tsx
index 059cdfd5cd..bdc1664f61 100644
--- a/src/screens/Onboarding/Layout.tsx
+++ b/src/screens/Onboarding/Layout.tsx
@@ -21,7 +21,6 @@ import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import {ChevronLeft_Stroke2_Corner0_Rounded as ChevronLeft} from '#/components/icons/Chevron'
import {createPortalGroup} from '#/components/Portal'
import {P, Text} from '#/components/Typography'
-import {IS_DEV} from '#/env'
const COL_WIDTH = 420
@@ -64,7 +63,7 @@ export function Layout({children}: React.PropsWithChildren<{}>) {
a.flex_1,
t.atoms.bg,
]}>
- {IS_DEV && (
+ {__DEV__ && (