feat(mobile): set op user agent in analytics init
This commit is contained in:
parent
ed86426728
commit
d2af10f366
|
|
@ -1,10 +1,11 @@
|
|||
import { identifyUserOpenPanel, setOpenPanelTracker } from "@follow/tracker"
|
||||
import { nativeApplicationVersion, nativeBuildVersion } from "expo-application"
|
||||
|
||||
import { getUserAgent } from "../lib/native/user-agent"
|
||||
import { op } from "../lib/op"
|
||||
import { whoami } from "../store/user/getters"
|
||||
|
||||
export const initAnalytics = () => {
|
||||
export const initAnalytics = async () => {
|
||||
setOpenPanelTracker(op.track.bind(op))
|
||||
const user = whoami()
|
||||
if (user) {
|
||||
|
|
@ -16,4 +17,8 @@ export const initAnalytics = () => {
|
|||
version: nativeApplicationVersion,
|
||||
buildId: nativeBuildVersion,
|
||||
})
|
||||
|
||||
op.setHeaders({
|
||||
"User-Agent": await getUserAgent(),
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export const initializeApp = async () => {
|
|||
|
||||
const now = Date.now()
|
||||
initializeDb()
|
||||
initAnalytics()
|
||||
await initAnalytics()
|
||||
|
||||
await apm("migrateDatabase", migrateDatabase)
|
||||
initializeDayjs()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { OpenPanel } from "@follow/tracker/src/op"
|
||||
|
||||
import { getUserAgent } from "./native/user-agent"
|
||||
import { proxyEnv } from "./proxy-env"
|
||||
|
||||
export const op = new OpenPanel({
|
||||
|
|
@ -12,9 +11,3 @@ export const op = new OpenPanel({
|
|||
sdk: "react-native",
|
||||
sdkVersion: "1.0.0",
|
||||
})
|
||||
|
||||
getUserAgent().then((userAgent) => {
|
||||
op.setHeaders({
|
||||
"User-Agent": userAgent,
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue