Add PACKAGE_VERSION and replace in statsig to fix conflict

This commit is contained in:
Eric Bailey
2025-07-23 18:30:23 -05:00
parent 2a0c57efd0
commit 9d68335ad9
2 changed files with 16 additions and 12 deletions
+7
View File
@@ -1,5 +1,12 @@
import {type Did} from '@atproto/api' import {type Did} from '@atproto/api'
import packageJson from '#/../package.json'
/**
* The semver version of the app, as defined in `package.json.`
*/
export const PACKAGE_VERSION: string = packageJson.version
/** /**
* The env the app is running in e.g. development, testflight, production * The env the app is running in e.g. development, testflight, production
*/ */
+9 -12
View File
@@ -7,9 +7,7 @@ import {logger} from '#/logger'
import {type MetricEvents} from '#/logger/metrics' import {type MetricEvents} from '#/logger/metrics'
import {isWeb} from '#/platform/detection' import {isWeb} from '#/platform/detection'
import * as persisted from '#/state/persisted' import * as persisted from '#/state/persisted'
import packageDotJson from '../../../package.json' import * as env from '#/env'
import {BUNDLE_DATE, BUNDLE_IDENTIFIER, IS_TESTFLIGHT} from '#/env'
import {ENV} from '#/env'
import {useSession} from '../../state/session' import {useSession} from '../../state/session'
import {timeout} from '../async/timeout' import {timeout} from '../async/timeout'
import {useNonReactiveCallback} from '../hooks/useNonReactiveCallback' import {useNonReactiveCallback} from '../hooks/useNonReactiveCallback'
@@ -50,12 +48,11 @@ export type {MetricEvents as LogEvents}
function createStatsigOptions(prefetchUsers: StatsigUser[]) { function createStatsigOptions(prefetchUsers: StatsigUser[]) {
return { return {
environment: { environment: {
tier: tier: env.IS_DEV
ENV === 'development' ? 'development'
? 'development' : env.IS_TESTFLIGHT
: IS_TESTFLIGHT ? 'staging'
? 'staging' : 'production',
: 'production',
}, },
// Don't block on waiting for network. The fetched config will kick in on next load. // Don't block on waiting for network. The fetched config will kick in on next load.
// This ensures the UI is always consistent and doesn't update mid-session. // This ensures the UI is always consistent and doesn't update mid-session.
@@ -213,9 +210,9 @@ function toStatsigUser(did: string | undefined): StatsigUser {
refSrc, refSrc,
refUrl, refUrl,
platform: Platform.OS as 'ios' | 'android' | 'web', platform: Platform.OS as 'ios' | 'android' | 'web',
appVersion: packageDotJson.version, appVersion: env.PACKAGE_VERSION,
bundleIdentifier: BUNDLE_IDENTIFIER, bundleIdentifier: env.BUNDLE_IDENTIFIER,
bundleDate: BUNDLE_DATE, bundleDate: env.BUNDLE_DATE,
appLanguage: languagePrefs.appLanguage, appLanguage: languagePrefs.appLanguage,
contentLanguages: languagePrefs.contentLanguages, contentLanguages: languagePrefs.contentLanguages,
}, },