From d7063c43d0d341aa025a51734b55ec8b9e2e4029 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 18 Sep 2024 12:18:25 -0500 Subject: [PATCH] Remove flags --- src/alf/index.tsx | 19 ++++++------------- src/components/Typography.tsx | 6 ++---- src/lib/statsig/gates.ts | 2 +- src/view/com/util/text/Text.tsx | 6 +++--- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/alf/index.tsx b/src/alf/index.tsx index 20cd9c4583..f9d93d4ca8 100644 --- a/src/alf/index.tsx +++ b/src/alf/index.tsx @@ -1,7 +1,6 @@ import React from 'react' import {useMediaQuery} from 'react-responsive' -import {useGate} from '#/lib/statsig/statsig' import { computeFontScaleMultiplier, getFontFamily, @@ -33,9 +32,10 @@ export type Alf = { setFontScale: (fontScale: Exclude) => void setFontFamily: (fontFamily: Device['fontFamily']) => void } - flags: { - neue: boolean - } + /** + * Feature flags or other gated options + */ + flags: {} } /* @@ -58,17 +58,13 @@ export const Context = React.createContext({ setFontScale: () => {}, setFontFamily: () => {}, }, - flags: { - neue: false, - }, + flags: {}, }) export function ThemeProvider({ children, theme: themeName, }: React.PropsWithChildren<{theme: ThemeName}>) { - const gate = useGate() - const [neue] = React.useState(() => gate('typography_neue')) const [fontScale, setFontScale] = React.useState(() => getFontScale(), ) @@ -121,14 +117,11 @@ export function ThemeProvider({ setFontScale: setFontScaleAndPersist, setFontFamily: setFontFamilyAndPersist, }, - flags: { - neue, - }, + flags: {}, }), [ themeName, themes, - neue, fontScale, setFontScaleAndPersist, fontFamily, diff --git a/src/components/Typography.tsx b/src/components/Typography.tsx index f889edd00d..a5aaee486a 100644 --- a/src/components/Typography.tsx +++ b/src/components/Typography.tsx @@ -39,12 +39,10 @@ export function normalizeTextStyles( { fontScale, fontFamily, - flags, }: { fontScale: number fontFamily: Alf['fonts']['family'] - flags: {neue: boolean} - }, + } & Pick, ) { const s = flatten(styles) // should always be defined on these components @@ -58,7 +56,7 @@ export function normalizeTextStyles( s.lineHeight = s.fontSize } - if (flags.neue && fontFamily === 'theme') { + if (fontFamily === 'theme') { applyFonts(s) } diff --git a/src/lib/statsig/gates.ts b/src/lib/statsig/gates.ts index fa00b81e0e..7966767d1b 100644 --- a/src/lib/statsig/gates.ts +++ b/src/lib/statsig/gates.ts @@ -1,3 +1,3 @@ export type Gate = // Keep this alphabetic please. - 'debug_show_feedcontext' | 'typography_neue' | 'suggested_feeds_interstitial' + 'debug_show_feedcontext' | 'suggested_feeds_interstitial' diff --git a/src/view/com/util/text/Text.tsx b/src/view/com/util/text/Text.tsx index c06a7f7700..fe72fe40e6 100644 --- a/src/view/com/util/text/Text.tsx +++ b/src/view/com/util/text/Text.tsx @@ -33,7 +33,7 @@ export function Text({ const theme = useTheme() const typography = theme.typography[type] const lineHeightStyle = lineHeight ? lh(theme, type, lineHeight) : undefined - const {fonts, flags} = useAlf() + const {fonts} = useAlf() if (selectable && isIOS) { const flattened = StyleSheet.flatten([ @@ -43,7 +43,7 @@ export function Text({ style, ]) - if (flags.neue && fonts.family === 'theme') { + if (fonts.family === 'theme') { applyFonts(flattened) } @@ -73,7 +73,7 @@ export function Text({ style, ]) - if (flags.neue && fonts.family === 'theme') { + if (fonts.family === 'theme') { applyFonts(flattened) }