diff --git a/src/components/ageAssurance/AgeAssurancePrompt.tsx b/src/components/ageAssurance/AgeAssurancePrompt.tsx index 87216fe270..d7baa4c746 100644 --- a/src/components/ageAssurance/AgeAssurancePrompt.tsx +++ b/src/components/ageAssurance/AgeAssurancePrompt.tsx @@ -11,27 +11,32 @@ import { } from '#/components/ageAssurance/AgeAssuranceInitDialog' import {IsAgeRestricted} from '#/components/ageAssurance/IsAgeRestricted' import {Button, ButtonText} from '#/components/Button' +import type * as Dialog from '#/components/Dialog' import {Divider} from '#/components/Divider' import {Text} from '#/components/Typography' export function AgeAssurancePrompt({style}: ViewStyleProp & {}) { + const control = useDialogControl() + const {hasInitiated} = useAgeAssuranceContext() return ( - - - + <> + + {!hasInitiated && } + + + ) } -function Inner({style}: ViewStyleProp & {}) { +function Inner({ + style, + control, +}: ViewStyleProp & {control: Dialog.DialogControlProps}) { const t = useTheme() const {_} = useLingui() - const {hasInitiated} = useAgeAssuranceContext() - const control = useDialogControl() - return hasInitiated ? null : ( + return ( <> - - true, - async () => { - if (!agent.session) return - if (unmounted.current) return + wait( + 3e3, + retry( + 5, + () => true, + async () => { + if (!agent.session) return + if (unmounted.current) return - const {data} = await agent.app.bsky.unspecced.getAgeAssuranceState() + const {data} = await agent.app.bsky.unspecced.getAgeAssuranceState() - if (data.status !== 'assured') { - throw new Error( - `Polling for age assurance state did not receive assured status`, - ) - } + if (data.status !== 'assured') { + throw new Error( + `Polling for age assurance state did not receive assured status`, + ) + } - return data - }, - 1e3, + return data + }, + 1e3, + ), ) .then(data => { if (!data) return diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 853325047f..3f2ba9b25b 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -207,4 +207,4 @@ export const PUBLIC_APPVIEW_DID = 'did:web:api.bsky.app' export const PUBLIC_STAGING_APPVIEW_DID = 'did:web:api.staging.bsky.dev' export const DEV_ENV_APPVIEW = `http://localhost:2584` // always the same -export const DEV_ENV_APPVIEW_DID = `did:plc:lmynpbfp7bbyc4pz2xjdtzsh` // get this from `localhost:2581` +export const DEV_ENV_APPVIEW_DID = `did:plc:zkrndrc5vqjfn32cr4qya7c5` // get this from `localhost:2581` diff --git a/src/lib/hooks/useIntentHandler.ts b/src/lib/hooks/useIntentHandler.ts index 69254e7f64..9c2014a8e7 100644 --- a/src/lib/hooks/useIntentHandler.ts +++ b/src/lib/hooks/useIntentHandler.ts @@ -74,8 +74,8 @@ export function useIntentHandler() { } case 'age-assurance': { const state = parseAgeAssuranceRedirectDialogState({ - status: params.get('status') ?? undefined, - did: params.get('did') ?? undefined, + result: params.get('result') ?? undefined, + actorDid: params.get('actorDid') ?? undefined, }) // TODO maybe handle invalid DID here