Bluesky app fork with some witchin' additions 💫

Clean up AA gate (#8707)

authored by

Eric Bailey and committed by
GitHub
3ae3ed24 8fdcc3ee

+6 -14
-1
src/lib/statsig/gates.ts
··· 1 1 export type Gate = 2 2 // Keep this alphabetic please. 3 - | 'age_assurance' 4 3 | 'alt_share_icon' 5 4 | 'debug_show_feedcontext' 6 5 | 'debug_subscriptions'
+4 -8
src/state/ageAssurance/index.tsx
··· 4 4 5 5 import {networkRetry} from '#/lib/async/retry' 6 6 import {useGetAndRegisterPushToken} from '#/lib/notifications/notifications' 7 - import {useGate} from '#/lib/statsig/statsig' 8 7 import {isNetworkError} from '#/lib/strings/errors' 9 8 import { 10 9 type AgeAssuranceAPIContextType, ··· 41 40 * performance. 42 41 */ 43 42 export function Provider({children}: {children: React.ReactNode}) { 44 - const gate = useGate() 45 43 const agent = useAgent() 46 44 const {geolocation} = useGeolocation() 47 45 const isAgeAssuranceEnabled = useIsAgeAssuranceEnabled() ··· 78 76 account: agent.session?.did, 79 77 }) 80 78 81 - if (gate('age_assurance')) { 82 - await getAndRegisterPushToken({ 83 - isAgeRestricted: 84 - !!geolocation?.isAgeRestrictedGeo && data.status !== 'assured', 85 - }) 86 - } 79 + await getAndRegisterPushToken({ 80 + isAgeRestricted: 81 + !!geolocation?.isAgeRestrictedGeo && data.status !== 'assured', 82 + }) 87 83 88 84 return data 89 85 } catch (e) {
+2 -5
src/state/ageAssurance/useIsAgeAssuranceEnabled.ts
··· 1 1 import {useMemo} from 'react' 2 2 3 - import {useGate} from '#/lib/statsig/statsig' 4 3 import {useGeolocation} from '#/state/geolocation' 5 4 6 5 export function useIsAgeAssuranceEnabled() { 7 - const gate = useGate() 8 6 const {geolocation} = useGeolocation() 9 7 10 8 return useMemo(() => { 11 - const enabled = gate('age_assurance') 12 - return enabled && !!geolocation?.isAgeRestrictedGeo 13 - }, [geolocation, gate]) 9 + return !!geolocation?.isAgeRestrictedGeo 10 + }, [geolocation]) 14 11 }