Remove test gates (#7477)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, {useCallback, useEffect, useMemo} from 'react'
|
import React, {useCallback, useMemo} from 'react'
|
||||||
import {StyleSheet} from 'react-native'
|
import {StyleSheet} from 'react-native'
|
||||||
import {SafeAreaView} from 'react-native-safe-area-context'
|
import {SafeAreaView} from 'react-native-safe-area-context'
|
||||||
import {
|
import {
|
||||||
@@ -20,7 +20,6 @@ import {
|
|||||||
import {useSetTitle} from '#/lib/hooks/useSetTitle'
|
import {useSetTitle} from '#/lib/hooks/useSetTitle'
|
||||||
import {ComposeIcon2} from '#/lib/icons'
|
import {ComposeIcon2} from '#/lib/icons'
|
||||||
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
||||||
import {logEvent, useGate} from '#/lib/statsig/statsig'
|
|
||||||
import {combinedDisplayName} from '#/lib/strings/display-names'
|
import {combinedDisplayName} from '#/lib/strings/display-names'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
import {isInvalidHandle} from '#/lib/strings/handles'
|
import {isInvalidHandle} from '#/lib/strings/handles'
|
||||||
@@ -497,7 +496,6 @@ function ProfileScreenLoaded({
|
|||||||
accessibilityHint=""
|
accessibilityHint=""
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<TestGates />
|
|
||||||
</ScreenHider>
|
</ScreenHider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -556,77 +554,3 @@ const styles = StyleSheet.create({
|
|||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const shouldExposeToGate2 = Math.random() < 0.2
|
|
||||||
|
|
||||||
// --- Temporary: we're testing our Statsig setup ---
|
|
||||||
let TestGates = React.memo(function TestGates() {
|
|
||||||
const gate = useGate()
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
logEvent('test:all:always', {})
|
|
||||||
if (Math.random() < 0.2) {
|
|
||||||
logEvent('test:all:sometimes', {})
|
|
||||||
}
|
|
||||||
if (Math.random() < 0.1) {
|
|
||||||
logEvent('test:all:boosted_by_gate1', {
|
|
||||||
reason: 'base',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (Math.random() < 0.1) {
|
|
||||||
logEvent('test:all:boosted_by_gate2', {
|
|
||||||
reason: 'base',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (Math.random() < 0.1) {
|
|
||||||
logEvent('test:all:boosted_by_both', {
|
|
||||||
reason: 'base',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
return [
|
|
||||||
gate('test_gate_1') ? <TestGate1 /> : null,
|
|
||||||
shouldExposeToGate2 && gate('test_gate_2') ? <TestGate2 /> : null,
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
function TestGate1() {
|
|
||||||
useEffect(() => {
|
|
||||||
logEvent('test:gate1:always', {})
|
|
||||||
if (Math.random() < 0.2) {
|
|
||||||
logEvent('test:gate1:sometimes', {})
|
|
||||||
}
|
|
||||||
if (Math.random() < 0.5) {
|
|
||||||
logEvent('test:all:boosted_by_gate1', {
|
|
||||||
reason: 'gate1',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (Math.random() < 0.5) {
|
|
||||||
logEvent('test:all:boosted_by_both', {
|
|
||||||
reason: 'gate1',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
function TestGate2() {
|
|
||||||
useEffect(() => {
|
|
||||||
logEvent('test:gate2:always', {})
|
|
||||||
if (Math.random() < 0.2) {
|
|
||||||
logEvent('test:gate2:sometimes', {})
|
|
||||||
}
|
|
||||||
if (Math.random() < 0.5) {
|
|
||||||
logEvent('test:all:boosted_by_gate2', {
|
|
||||||
reason: 'gate2',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (Math.random() < 0.5) {
|
|
||||||
logEvent('test:all:boosted_by_both', {
|
|
||||||
reason: 'gate2',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user