From a55f380ac0d1c2851e345493184acd25f081e5ba Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 21 Jan 2026 17:39:13 -0600 Subject: [PATCH] Remove all other StatSig mentions --- eslint.config.mjs | 1 - eslint/index.js | 1 - eslint/use-typed-gates.js | 41 -------------------------- jest/jestSetup.js | 11 ------- package.json | 1 - src/env/common.ts | 2 +- src/lib/hooks/useOTAUpdates.ts | 5 ++-- src/screens/Settings/AboutSettings.tsx | 6 ++-- src/state/feed-feedback.tsx | 1 - src/state/service-config.tsx | 4 --- yarn.lock | 41 ++------------------------ 11 files changed, 8 insertions(+), 106 deletions(-) delete mode 100644 eslint/use-typed-gates.js diff --git a/eslint.config.mjs b/eslint.config.mjs index c3c36b4c4f..951d3442c5 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -119,7 +119,6 @@ export default defineConfig( }, ], 'bsky-internal/use-exact-imports': 'error', - 'bsky-internal/use-typed-gates': 'error', 'bsky-internal/use-prefixed-imports': 'error', /** diff --git a/eslint/index.js b/eslint/index.js index 3cd7e61344..4d59c8c1d0 100644 --- a/eslint/index.js +++ b/eslint/index.js @@ -8,7 +8,6 @@ const plugin = { rules: { 'avoid-unwrapped-text': require('./avoid-unwrapped-text'), 'use-exact-imports': require('./use-exact-imports'), - 'use-typed-gates': require('./use-typed-gates'), 'use-prefixed-imports': require('./use-prefixed-imports'), }, } diff --git a/eslint/use-typed-gates.js b/eslint/use-typed-gates.js deleted file mode 100644 index 37969951e7..0000000000 --- a/eslint/use-typed-gates.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict' - -module.exports = { - meta: { - type: 'suggestion', - docs: { - description: - 'Enforce using internal statsig wrapper instead of npm package', - }, - schema: [], - }, - create(context) { - return { - ImportSpecifier(node) { - if ( - !node.local || - node.local.type !== 'Identifier' || - node.local.name !== 'useGate' - ) { - return - } - if ( - node.parent.type !== 'ImportDeclaration' || - !node.parent.source || - node.parent.source.type !== 'Literal' - ) { - return - } - const source = node.parent.source.value - if (source.startsWith('statsig') || source.startsWith('@statsig')) { - context.report({ - node, - message: - "Use useGate() from '#/lib/statsig/statsig' instead of the one on npm.", - }) - } - // TODO: Verify gate() call results aren't stored in variables. - }, - } - }, -} diff --git a/jest/jestSetup.js b/jest/jestSetup.js index ec5d4a9361..fb45da7eeb 100644 --- a/jest/jestSetup.js +++ b/jest/jestSetup.js @@ -104,14 +104,3 @@ jest.mock('expo-modules-core', () => ({ jest.mock('expo-localization', () => ({ getLocales: () => [], })) - -jest.mock('statsig-react-native-expo', () => ({ - Statsig: { - initialize() {}, - initializeCalled() { - return false - }, - }, -})) - -jest.mock('../src/lib/statsig/statsig', () => ({})) diff --git a/package.json b/package.json index fc9d5ed714..2be25b505b 100644 --- a/package.json +++ b/package.json @@ -220,7 +220,6 @@ "react-textarea-autosize": "^8.5.3", "sonner": "^2.0.7", "sonner-native": "^0.21.0", - "statsig-react-native-expo": "^4.6.1", "tippy.js": "^6.3.7", "tlds": "^1.234.0", "tldts": "^6.1.46", diff --git a/src/env/common.ts b/src/env/common.ts index 5daec5e577..5070b35968 100644 --- a/src/env/common.ts +++ b/src/env/common.ts @@ -50,7 +50,7 @@ export const BUNDLE_IDENTIFIER: string = /** * This will always be in the format of YYMMDDHH, so that it always increases - * for each build. This should only be used for StatSig reporting and shouldn't + * for each build. This should only be used for analytics reporting and shouldn't * be used to identify a specific bundle. */ export const BUNDLE_DATE: number = diff --git a/src/lib/hooks/useOTAUpdates.ts b/src/lib/hooks/useOTAUpdates.ts index d5158f9db4..d1a987d0ba 100644 --- a/src/lib/hooks/useOTAUpdates.ts +++ b/src/lib/hooks/useOTAUpdates.ts @@ -12,8 +12,7 @@ import { import {isNetworkError} from '#/lib/strings/errors' import {logger} from '#/logger' -import {IS_ANDROID, IS_IOS} from '#/env' -import {IS_TESTFLIGHT} from '#/env' +import {IS_ANDROID, IS_IOS, IS_TESTFLIGHT} from '#/env' const MINIMUM_MINIMIZE_TIME = 15 * 60e3 @@ -170,7 +169,7 @@ export function useOTAUpdates() { return } - // We use this setTimeout to allow Statsig to initialize before we check for an update + // We use this setTimeout to allow analytics to initialize before we check for an update // For Testflight users, we can prompt the user to update immediately whenever there's an available update. This // is suspect however with the Apple App Store guidelines, so we don't want to prompt production users to update // immediately. diff --git a/src/screens/Settings/AboutSettings.tsx b/src/screens/Settings/AboutSettings.tsx index 3fea3f96c2..9ba067a2f5 100644 --- a/src/screens/Settings/AboutSettings.tsx +++ b/src/screens/Settings/AboutSettings.tsx @@ -1,4 +1,3 @@ -import {useMemo} from 'react' import {Platform} from 'react-native' import {setStringAsync} from 'expo-clipboard' import * as FileSystem from 'expo-file-system/legacy' @@ -7,7 +6,6 @@ import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {type NativeStackScreenProps} from '@react-navigation/native-stack' import {useMutation} from '@tanstack/react-query' -import {Statsig} from 'statsig-react-native-expo' import {STATUS_PAGE_URL} from '#/lib/constants' import {type CommonNavigatorParams} from '#/lib/routes/types' @@ -21,6 +19,7 @@ import {Newspaper_Stroke2_Corner2_Rounded as NewspaperIcon} from '#/components/i import {Wrench_Stroke2_Corner2_Rounded as WrenchIcon} from '#/components/icons/Wrench' import * as Layout from '#/components/Layout' import {Loader} from '#/components/Loader' +import {getDeviceId} from '#/analytics/identifiers' import {IS_ANDROID, IS_IOS, IS_NATIVE} from '#/env' import * as env from '#/env' import {useDemoMode} from '#/storage/hooks/demo-mode' @@ -32,7 +31,6 @@ export function AboutSettingsScreen({}: Props) { const {_, i18n} = useLingui() const [devModeEnabled, setDevModeEnabled] = useDevMode() const [demoModeEnabled, setDemoModeEnabled] = useDemoMode() - const stableID = useMemo(() => Statsig.getStableID(), []) const {mutate: onClearImageCache, isPending: isClearingImageCache} = useMutation({ @@ -146,7 +144,7 @@ export function AboutSettingsScreen({}: Props) { }} onPress={() => { setStringAsync( - `Build version: ${env.APP_VERSION}; Bundle info: ${env.APP_METADATA}; Bundle date: ${env.BUNDLE_DATE}; Platform: ${Platform.OS}; Platform version: ${Platform.Version}; Anonymous ID: ${stableID}`, + `Build version: ${env.APP_VERSION}; Bundle info: ${env.APP_METADATA}; Bundle date: ${env.BUNDLE_DATE}; Platform: ${Platform.OS}; Platform version: ${Platform.Version}; Device ID: ${getDeviceId() ?? 'N/A'}`, ) Toast.show(_(msg`Copied build version to clipboard`)) }}> diff --git a/src/state/feed-feedback.tsx b/src/state/feed-feedback.tsx index 8886264766..7d4ac284a6 100644 --- a/src/state/feed-feedback.tsx +++ b/src/state/feed-feedback.tsx @@ -163,7 +163,6 @@ export function useFeedFeedback( ) .catch(() => {}) // ignore upstream errors - // Send to Statsig if (aggregatedStats.current === null) { aggregatedStats.current = createAggregatedStats() } diff --git a/src/state/service-config.tsx b/src/state/service-config.tsx index 780cf3bba3..8713a05d77 100644 --- a/src/state/service-config.tsx +++ b/src/state/service-config.tsx @@ -52,10 +52,6 @@ export function Provider({children}: {children: React.ReactNode}) { return {enabled: Boolean(cachedEnabled)} } - /* - * Doing an extra check here to reduce hits to statsig. If it's disabled on - * the server, we can exit early. - */ const enabled = Boolean(config?.topicsEnabled) // update cache diff --git a/yarn.lock b/yarn.lock index 5179c42234..9ebe524304 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6276,7 +6276,7 @@ resolved "https://registry.yarnpkg.com/@radix-ui/rect/-/rect-1.1.1.tgz#78244efe12930c56fd255d7923865857c41ac8cb" integrity sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw== -"@react-native-async-storage/async-storage@2.2.0", "@react-native-async-storage/async-storage@^1.15.2": +"@react-native-async-storage/async-storage@2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@react-native-async-storage/async-storage/-/async-storage-2.2.0.tgz#a3aa565253e46286655560172f4e366e8969f5ad" integrity sha512-gvRvjR5JAaUZF8tv2Kcq/Gbt3JHwbKFYfmb445rhOj6NUMx3qPLixmDx5pZAyb9at1bYvJ4/eTUipU5aki45xw== @@ -11628,7 +11628,7 @@ expo-clipboard@~8.0.8: resolved "https://registry.yarnpkg.com/expo-clipboard/-/expo-clipboard-8.0.8.tgz#5e52054a4bbaebef090ec6fe5eaa200072ff94f7" integrity sha512-VKoBkHIpZZDJTB0jRO4/PZskHdMNOEz3P/41tmM6fDuODMpqhvyWK053X0ebspkxiawJX9lX33JXHBCvVsTTOA== -expo-constants@18.0.8, expo-constants@^13.0.2, expo-constants@~18.0.11: +expo-constants@18.0.8, expo-constants@~18.0.11: version "18.0.8" resolved "https://registry.yarnpkg.com/expo-constants/-/expo-constants-18.0.8.tgz#14f8388136de6e83d651bd68b326a675dfb7051c" integrity sha512-Tetphsx6RVImCTZeBAclRQMy0WOODY3y6qrUoc88YGUBVm8fAKkErCSWxLTCc6nFcJxdoOMYi62LgNIUFjZCLA== @@ -11673,7 +11673,7 @@ expo-dev-menu@7.0.18: dependencies: expo-dev-menu-interface "2.0.0" -expo-device@7.1.4, expo-device@~4.1.1: +expo-device@7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/expo-device/-/expo-device-7.1.4.tgz#84ae7c2520cc45f15a9cb0433ae1226c33f7a8ef" integrity sha512-HS04IiE1Fy0FRjBLurr9e5A6yj3kbmQB+2jCZvbSGpsjBnCLdSk/LCii4f5VFhPIBWJLyYuN5QqJyEAw6BcS4Q== @@ -17295,13 +17295,6 @@ react-native-gesture-handler@~2.28.0: hoist-non-react-statics "^3.3.0" invariant "^2.2.4" -react-native-get-random-values@^1.6.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/react-native-get-random-values/-/react-native-get-random-values-1.10.0.tgz#c2c5f12a4ef8b1175145347b4a4b9f9a40d9ffc8" - integrity sha512-gZ1zbXhbb8+Jy9qYTV8c4Nf45/VB4g1jmXuavY5rPfUn7x3ok9Vl3FTl0dnE92Z4FFtfbUNNwtSfcmomdtWg+A== - dependencies: - fast-base64-decode "^1.0.0" - react-native-get-random-values@~1.11.0: version "1.11.0" resolved "https://registry.yarnpkg.com/react-native-get-random-values/-/react-native-get-random-values-1.11.0.tgz#1ca70d1271f4b08af92958803b89dccbda78728d" @@ -18740,14 +18733,6 @@ standard-as-callback@^2.1.0: resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.1.0.tgz#8953fc05359868a77b5b9739a665c5977bb7df45" integrity sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A== -statsig-js@4.45.1: - version "4.45.1" - resolved "https://registry.yarnpkg.com/statsig-js/-/statsig-js-4.45.1.tgz#b1f5b9c52adc4a8aece376fb011416c89227932f" - integrity sha512-h94RzFQsJCQCNwQXpZ9OBXcvCxDnkXF6OrCekd81ySvY2l4JSowpxMWX3Iw6IDFzfTfKdER9JQzFLhMSQbT+YQ== - dependencies: - js-sha256 "^0.10.1" - uuid "^8.3.2" - statsig-node@^5.23.1: version "5.25.1" resolved "https://registry.yarnpkg.com/statsig-node/-/statsig-node-5.25.1.tgz#6d8ea9ecaad6c09250e5ff7d33eda9fd0f9c05f4" @@ -18758,26 +18743,6 @@ statsig-node@^5.23.1: ua-parser-js "^1.0.2" uuid "^8.3.2" -statsig-react-native-expo@^4.6.1: - version "4.6.1" - resolved "https://registry.yarnpkg.com/statsig-react-native-expo/-/statsig-react-native-expo-4.6.1.tgz#0bdf49fee7112f7f28bff2405f4ba0c1727bb3d6" - integrity sha512-rB60c+WSrQPmjW9j75d+acUtwSOe38PE2KTDHiOv1Mf+0TCcFtGYlJmKCibWvbeXR7ZAyjjGeroh23bCSEZauQ== - dependencies: - "@react-native-async-storage/async-storage" "^1.15.2" - expo-constants "^13.0.2" - expo-device "~4.1.1" - js-sha256 "^0.9.0" - react-native-get-random-values "^1.6.0" - statsig-react "^1.21.1" - uuid "^8.3.2" - -statsig-react@^1.21.1: - version "1.35.0" - resolved "https://registry.yarnpkg.com/statsig-react/-/statsig-react-1.35.0.tgz#ad5730b83f564c640623e954fcbcbe848e939946" - integrity sha512-KLN7dhq6FvAl25Z0QN6IINFBgM3yn0GMafoE698tYZqRf911xvevFaR7qUXiTz3W9vmFYrmFRouqVMfCv7DW0A== - dependencies: - statsig-js "4.45.1" - statuses@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63"