[Statsig] Send locale info (#3621)

zio/stable
dan 2024-04-19 15:51:41 +01:00 committed by GitHub
parent 55aea348c2
commit c42a557417
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import {Statsig, StatsigProvider} from 'statsig-react-native-expo'
import {logger} from '#/logger'
import {isWeb} from '#/platform/detection'
import * as persisted from '#/state/persisted'
import {IS_TESTFLIGHT} from 'lib/app-info'
import {useSession} from '../../state/session'
import {timeout} from '../async/timeout'
@ -23,6 +24,8 @@ type StatsigUser = {
platform: 'ios' | 'android' | 'web'
refSrc: string
refUrl: string
appLanguage: string
contentLanguages: string[]
}
}
@ -132,6 +135,7 @@ function toStatsigUser(did: string | undefined): StatsigUser {
if (did) {
userID = sha256(did)
}
const languagePrefs = persisted.get('languagePrefs')
return {
userID,
platform: Platform.OS as 'ios' | 'android' | 'web',
@ -139,6 +143,8 @@ function toStatsigUser(did: string | undefined): StatsigUser {
refSrc,
refUrl,
platform: Platform.OS as 'ios' | 'android' | 'web',
appLanguage: languagePrefs.appLanguage,
contentLanguages: languagePrefs.contentLanguages,
},
}
}