Remove flags

This commit is contained in:
Eric Bailey
2024-09-18 12:18:25 -05:00
parent ebb6f6e2c4
commit d7063c43d0
4 changed files with 12 additions and 21 deletions
+6 -13
View File
@@ -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<Device['fontScale'], undefined>) => 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<Alf>({
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<Alf['fonts']['scale']>(() =>
getFontScale(),
)
@@ -121,14 +117,11 @@ export function ThemeProvider({
setFontScale: setFontScaleAndPersist,
setFontFamily: setFontFamilyAndPersist,
},
flags: {
neue,
},
flags: {},
}),
[
themeName,
themes,
neue,
fontScale,
setFontScaleAndPersist,
fontFamily,
+2 -4
View File
@@ -39,12 +39,10 @@ export function normalizeTextStyles(
{
fontScale,
fontFamily,
flags,
}: {
fontScale: number
fontFamily: Alf['fonts']['family']
flags: {neue: boolean}
},
} & Pick<Alf, 'flags'>,
) {
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)
}
+1 -1
View File
@@ -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'
+3 -3
View File
@@ -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)
}