Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add back statsig gate testing (#7404)

authored by

Hailey and committed by
GitHub
d79c66af 02dbcc13

+79 -1
+2
src/lib/statsig/gates.ts
··· 4 4 | 'debug_subscriptions' 5 5 | 'new_postonboarding' 6 6 | 'remove_show_latest_button' 7 + | 'test_gate_1' 8 + | 'test_gate_2' 7 9 | 'trending_topics_beta'
+77 -1
src/view/screens/Profile.tsx
··· 1 - import React, {useCallback, useMemo} from 'react' 1 + import React, {useCallback, useEffect, useMemo} from 'react' 2 2 import {StyleSheet} from 'react-native' 3 3 import {SafeAreaView} from 'react-native-safe-area-context' 4 4 import { ··· 20 20 import {useSetTitle} from '#/lib/hooks/useSetTitle' 21 21 import {ComposeIcon2} from '#/lib/icons' 22 22 import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types' 23 + import {logEvent, useGate} from '#/lib/statsig/statsig' 23 24 import {combinedDisplayName} from '#/lib/strings/display-names' 24 25 import {cleanError} from '#/lib/strings/errors' 25 26 import {isInvalidHandle} from '#/lib/strings/handles' ··· 496 497 accessibilityHint="" 497 498 /> 498 499 )} 500 + <TestGates /> 499 501 </ScreenHider> 500 502 ) 501 503 } ··· 554 556 textAlign: 'center', 555 557 }, 556 558 }) 559 + 560 + const shouldExposeToGate2 = Math.random() < 0.2 561 + 562 + // --- Temporary: we're testing our Statsig setup --- 563 + let TestGates = React.memo(function TestGates() { 564 + const gate = useGate() 565 + 566 + useEffect(() => { 567 + logEvent('test:all:always', {}) 568 + if (Math.random() < 0.2) { 569 + logEvent('test:all:sometimes', {}) 570 + } 571 + if (Math.random() < 0.1) { 572 + logEvent('test:all:boosted_by_gate1', { 573 + reason: 'base', 574 + }) 575 + } 576 + if (Math.random() < 0.1) { 577 + logEvent('test:all:boosted_by_gate2', { 578 + reason: 'base', 579 + }) 580 + } 581 + if (Math.random() < 0.1) { 582 + logEvent('test:all:boosted_by_both', { 583 + reason: 'base', 584 + }) 585 + } 586 + }, []) 587 + 588 + return [ 589 + gate('test_gate_1') ? <TestGate1 /> : null, 590 + shouldExposeToGate2 && gate('test_gate_2') ? <TestGate2 /> : null, 591 + ] 592 + }) 593 + 594 + function TestGate1() { 595 + useEffect(() => { 596 + logEvent('test:gate1:always', {}) 597 + if (Math.random() < 0.2) { 598 + logEvent('test:gate1:sometimes', {}) 599 + } 600 + if (Math.random() < 0.5) { 601 + logEvent('test:all:boosted_by_gate1', { 602 + reason: 'gate1', 603 + }) 604 + } 605 + if (Math.random() < 0.5) { 606 + logEvent('test:all:boosted_by_both', { 607 + reason: 'gate1', 608 + }) 609 + } 610 + }, []) 611 + return null 612 + } 613 + 614 + function TestGate2() { 615 + useEffect(() => { 616 + logEvent('test:gate2:always', {}) 617 + if (Math.random() < 0.2) { 618 + logEvent('test:gate2:sometimes', {}) 619 + } 620 + if (Math.random() < 0.5) { 621 + logEvent('test:all:boosted_by_gate2', { 622 + reason: 'gate2', 623 + }) 624 + } 625 + if (Math.random() < 0.5) { 626 + logEvent('test:all:boosted_by_both', { 627 + reason: 'gate2', 628 + }) 629 + } 630 + }, []) 631 + return null 632 + }