about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2025-02-13 15:59:30 -0600
committerGitHub <noreply@github.com>2025-02-13 15:59:30 -0600
commit22a902e0de1872f7d8ba8297c315b24461c8d9ed (patch)
tree61ed6b8cb7d9a5c927eb874ff0ce2065f8b15e67 /src
parent99051f0ab134715847abb16acd852f11216b93b9 (diff)
downloadvoidsky-22a902e0de1872f7d8ba8297c315b24461c8d9ed.tar.zst
Bitdrift integration (#7728)
* update bitdrift to 0.6.7 and enable iOS network integration (#7575)

* update bitdrift to 0.6.5 and enable iOS network integration

* Update src/lib/bitdrift.ts

Co-authored-by: Mark <40143016+Maker-Mark@users.noreply.github.com>

* update to 0.6.7

---------

Co-authored-by: Mark <40143016+Maker-Mark@users.noreply.github.com>

* deps: Bump bitdrift to 0.6.8, fixes iOS network instrumentation bug (#7725)

Co-authored-by: Eric Bailey <git@esb.lol>

* Add stable ID copy, add todo

* Nits

* Temp enable

* Temp debug

* Revert some debug

* Revert unnecessary change

* Use new gates

* Add anon ID to version string

---------

Co-authored-by: Snow Pettersen <snowp@lyft.com>
Co-authored-by: Mark <40143016+Maker-Mark@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/bitdrift.ts11
-rw-r--r--src/screens/Settings/AboutSettings.tsx5
2 files changed, 13 insertions, 3 deletions
diff --git a/src/lib/bitdrift.ts b/src/lib/bitdrift.ts
index 71493d0bc..98f2dd11e 100644
--- a/src/lib/bitdrift.ts
+++ b/src/lib/bitdrift.ts
@@ -1,23 +1,30 @@
 import {init, SessionStrategy} from '@bitdrift/react-native'
 import {Statsig} from 'statsig-react-native-expo'
-export {debug, error, info, warn} from '@bitdrift/react-native'
 
 import {initPromise} from './statsig/statsig'
 
+export {debug, error, info, warn} from '@bitdrift/react-native'
+
 const BITDRIFT_API_KEY = process.env.BITDRIFT_API_KEY
 
 initPromise.then(() => {
   let isEnabled = false
+  let isNetworkEnabled = false
   try {
-    if (Statsig.checkGate('enable_bitdrift')) {
+    if (Statsig.checkGate('enable_bitdrift_v2')) {
       isEnabled = true
     }
+    if (Statsig.checkGate('enable_bitdrift_v2_networking')) {
+      isNetworkEnabled = true
+    }
   } catch (e) {
     // Statsig may complain about it being called too early.
   }
   if (isEnabled && BITDRIFT_API_KEY) {
     init(BITDRIFT_API_KEY, SessionStrategy.Activity, {
       url: 'https://api-bsky.bitdrift.io',
+      // Only effects iOS, Android instrumentation is set via Gradle Plugin
+      enableNetworkInstrumentation: isNetworkEnabled,
     })
   }
 })
diff --git a/src/screens/Settings/AboutSettings.tsx b/src/screens/Settings/AboutSettings.tsx
index 4d009281d..8b1b1f76d 100644
--- a/src/screens/Settings/AboutSettings.tsx
+++ b/src/screens/Settings/AboutSettings.tsx
@@ -1,8 +1,10 @@
+import {useMemo} from 'react'
 import {Platform} from 'react-native'
 import {setStringAsync} from 'expo-clipboard'
 import {msg, Trans} from '@lingui/macro'
 import {useLingui} from '@lingui/react'
 import {NativeStackScreenProps} from '@react-navigation/native-stack'
+import {Statsig} from 'statsig-react-native-expo'
 
 import {appVersion, BUNDLE_DATE, bundleInfo} from '#/lib/app-info'
 import {STATUS_PAGE_URL} from '#/lib/constants'
@@ -20,6 +22,7 @@ type Props = NativeStackScreenProps<CommonNavigatorParams, 'AboutSettings'>
 export function AboutSettingsScreen({}: Props) {
   const {_} = useLingui()
   const [devModeEnabled, setDevModeEnabled] = useDevModeEnabled()
+  const stableID = useMemo(() => Statsig.getStableID(), [])
 
   return (
     <Layout.Screen>
@@ -79,7 +82,7 @@ export function AboutSettingsScreen({}: Props) {
             }}
             onPress={() => {
               setStringAsync(
-                `Build version: ${appVersion}; Bundle info: ${bundleInfo}; Bundle date: ${BUNDLE_DATE}; Platform: ${Platform.OS}; Platform version: ${Platform.Version}`,
+                `Build version: ${appVersion}; Bundle info: ${bundleInfo}; Bundle date: ${BUNDLE_DATE}; Platform: ${Platform.OS}; Platform version: ${Platform.Version}; Anonymous ID: ${stableID}`,
               )
               Toast.show(_(msg`Copied build version to clipboard`))
             }}>