Skip to content

Commit

Permalink
Temporarily remove Bitdrift
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Dec 19, 2024
1 parent 9ebd362 commit 72de203
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
},
"dependencies": {
"@atproto/api": "^0.13.21",
"@bitdrift/react-native": "0.4.0",
"@braintree/sanitize-url": "^6.0.2",
"@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet",
"@emoji-mart/react": "^1.1.1",
Expand Down
42 changes: 24 additions & 18 deletions src/lib/bitdrift.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import {init} from '@bitdrift/react-native'
import {Statsig} from 'statsig-react-native-expo'
export {debug, error, info, warn} from '@bitdrift/react-native'
// import {init} 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'
// import {initPromise} from './statsig/statsig'

const BITDRIFT_API_KEY = process.env.BITDRIFT_API_KEY
// const BITDRIFT_API_KEY = process.env.BITDRIFT_API_KEY

initPromise.then(() => {
let isEnabled = false
try {
if (Statsig.checkGate('enable_bitdrift')) {
isEnabled = true
}
} catch (e) {
// Statsig may complain about it being called too early.
}
if (isEnabled && BITDRIFT_API_KEY) {
init(BITDRIFT_API_KEY, {url: 'https://api-bsky.bitdrift.io'})
}
})
// initPromise.then(() => {
// let isEnabled = false
// try {
// if (Statsig.checkGate('enable_bitdrift')) {
// isEnabled = true
// }
// } catch (e) {
// // Statsig may complain about it being called too early.
// }
// if (isEnabled && BITDRIFT_API_KEY) {
// init(BITDRIFT_API_KEY, {url: 'https://api-bsky.bitdrift.io'})
// }
// })

// TODO: Reenable when the build issue is fixed.
export function debug(_message: string) {}
export function error(_message: string) {}
export function info(_message: string) {}
export function warn(_message: string) {}
6 changes: 4 additions & 2 deletions src/lib/statsig/statsig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {sha256} from 'js-sha256'
import {Statsig, StatsigProvider} from 'statsig-react-native-expo'

import {BUNDLE_DATE, BUNDLE_IDENTIFIER, IS_TESTFLIGHT} from '#/lib/app-info'
import * as bitdrift from '#/lib/bitdrift'
// TODO: Reenable when the build issue is fixed.
// import * as bitdrift from '#/lib/bitdrift'
import {logger} from '#/logger'
import {isWeb} from '#/platform/detection'
import * as persisted from '#/state/persisted'
Expand Down Expand Up @@ -107,7 +108,8 @@ export function logEvent<E extends keyof LogEvents>(
console.groupCollapsed(eventName)
console.log(fullMetadata)
console.groupEnd()
bitdrift.info(eventName, fullMetadata)
// TODO: Reenable when the build issue is fixed.
// bitdrift.info(eventName, fullMetadata)
} catch (e) {
// A log should never interrupt the calling code, whatever happens.
logger.error('Failed to log an event', {message: e})
Expand Down

0 comments on commit 72de203

Please sign in to comment.