···5454 run: yarn intl:build
5555 - name: Run tests
5656 run: |
5757- NODE_ENV=test EXPO_PUBLIC_ENV=test yarn test --forceExit
5757+ NODE_ENV=test yarn test --forceExit
+1-1
Makefile
···20202121.PHONY: test
2222test: ## Run all tests
2323- NODE_ENV=test EXPO_PUBLIC_ENV=test yarn test
2323+ NODE_ENV=test yarn test
24242525.PHONY: lint
2626lint: ## Run style checks and verify syntax
+1-2
index.js
···55import {registerRootComponent} from 'expo'
6677import App from '#/App'
88-import {IS_TEST} from '#/env'
981010-if (IS_TEST) {
99+if (process.env.NODE_ENV === 'test') {
1110 LogBox.ignoreAllLogs() // suppress all logs in tests
1211} else {
1312 LogBox.ignoreLogs(['Require cycle:']) // suppress require-cycle warnings, it's fine
+1-6
src/App.native.tsx
···17171818import {KeyboardControllerProvider} from '#/lib/hooks/useEnableKeyboardController'
1919import {QueryProvider} from '#/lib/react-query'
2020-import {
2121- initialize,
2222- Provider as StatsigProvider,
2323- tryFetchGates,
2424-} from '#/lib/statsig/statsig'
2020+import {Provider as StatsigProvider, tryFetchGates} from '#/lib/statsig/statsig'
2521import {s} from '#/lib/styles'
2622import {ThemeProvider} from '#/lib/ThemeContext'
2723import I18nProvider from '#/locale/i18nProvider'
···10197 if (account) {
10298 await resumeSession(account)
10399 } else {
104104- await initialize()
105100 await tryFetchGates(undefined, 'prefer-fresh-gates')
106101 }
107102 } catch (e) {
···11import {init} from '@bitdrift/react-native'
22+import {Statsig} from 'statsig-react-native-expo'
33+44+import {initPromise} from './statsig/statsig'
2536const BITDRIFT_API_KEY = process.env.BITDRIFT_API_KEY
4755-if (BITDRIFT_API_KEY) {
66- init(BITDRIFT_API_KEY, {url: 'https://api-bsky.bitdrift.io'})
77-}
88+initPromise.then(() => {
99+ let isEnabled = false
1010+ try {
1111+ if (Statsig.checkGate('enable_bitdrift')) {
1212+ isEnabled = true
1313+ }
1414+ } catch (e) {
1515+ // Statsig may complain about it being called too early.
1616+ }
1717+ if (isEnabled && BITDRIFT_API_KEY) {
1818+ init(BITDRIFT_API_KEY, {url: 'https://api-bsky.bitdrift.io'})
1919+ }
2020+})
+2-3
src/lib/statsig/statsig.tsx
···16161717const SDK_KEY = 'client-SXJakO39w9vIhl3D44u8UupyzFl4oZ2qPIkjwcvuPsV'
18181919+export const initPromise = initialize()
2020+1921type StatsigUser = {
2022 userID: string | undefined
2123 // TODO: Remove when enough users have custom.platform:
···219221 // Use this for less common operations where the user would be OK with a delay.
220222 timeoutMs = 1500
221223 }
222222- // Note: This condition is currently false the very first render because
223223- // Statsig has not initialized yet. In the future, we can fix this by
224224- // doing the initialization ourselves instead of relying on the provider.
225224 if (Statsig.initializeCalled()) {
226225 await Promise.race([
227226 timeout(timeoutMs),
+1-1
src/logger/README.md
···1818#### Modes
19192020The "modes" referred to here are inferred from the values exported from `#/env`.
2121-Basically, the booleans `IS_DEV`, `IS_TEST`, and `IS_PROD`.
2121+Basically, the booleans `IS_DEV` and `IS_PROD`.
22222323#### Log Levels
2424