Fix crash during onboarding (#3338)

* Fix crash during onboarding

* Fix other usage
zio/stable
Eric Bailey 2024-03-22 11:32:49 -05:00 committed by GitHub
parent b27a0b8c97
commit f04932140a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 34 deletions

View File

@ -1,18 +1,18 @@
import React from 'react' import React from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {useLingui} from '@lingui/react'
import {msg, Trans} from '@lingui/macro' import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {UseMutateFunction} from '@tanstack/react-query' import {UseMutateFunction} from '@tanstack/react-query'
import {logger} from '#/logger'
import {isIOS} from '#/platform/detection'
import {usePreferencesQuery} from '#/state/queries/preferences'
import * as Toast from '#/view/com/util/Toast' import * as Toast from '#/view/com/util/Toast'
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme} from '#/alf'
import {usePreferencesQuery} from '#/state/queries/preferences'
import {logger} from '#/logger'
import {Text} from '#/components/Typography'
import * as Toggle from '#/components/forms/Toggle' import * as Toggle from '#/components/forms/Toggle'
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
import * as Prompt from '#/components/Prompt' import * as Prompt from '#/components/Prompt'
import {isIOS} from '#/platform/detection' import {Text} from '#/components/Typography'
function Card({children}: React.PropsWithChildren<{}>) { function Card({children}: React.PropsWithChildren<{}>) {
const t = useTheme() const t = useTheme()
@ -123,9 +123,7 @@ export function AdultContentEnabledPref({
</Trans> </Trans>
</Prompt.Description> </Prompt.Description>
<Prompt.Actions> <Prompt.Actions>
<Prompt.Action onPress={() => prompt.close()}> <Prompt.Action onPress={() => prompt.close()} cta={_(msg`OK`)} />
<Trans>OK</Trans>
</Prompt.Action>
</Prompt.Actions> </Prompt.Actions>
</Prompt.Outer> </Prompt.Outer>
</> </>

View File

@ -3,43 +3,42 @@ import {View} from 'react-native'
import { import {
AppBskyActorDefs, AppBskyActorDefs,
AppBskyLabelerDefs, AppBskyLabelerDefs,
ModerationOpts,
moderateProfile, moderateProfile,
ModerationOpts,
RichText as RichTextAPI, RichText as RichTextAPI,
} from '@atproto/api' } from '@atproto/api'
import {Trans, msg} from '@lingui/macro' import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {RichText} from '#/components/RichText' import {Haptics} from '#/lib/haptics'
import {useModalControls} from '#/state/modals' import {isAppLabeler} from '#/lib/moderation'
import {usePreferencesQuery} from '#/state/queries/preferences' import {pluralize} from '#/lib/strings/helpers'
import {useAnalytics} from 'lib/analytics/analytics' import {logger} from '#/logger'
import {useSession} from '#/state/session'
import {Shadow} from '#/state/cache/types' import {Shadow} from '#/state/cache/types'
import {useProfileShadow} from 'state/cache/profile-shadow' import {useModalControls} from '#/state/modals'
import {useLabelerSubscriptionMutation} from '#/state/queries/labeler' import {useLabelerSubscriptionMutation} from '#/state/queries/labeler'
import {useLikeMutation, useUnlikeMutation} from '#/state/queries/like' import {useLikeMutation, useUnlikeMutation} from '#/state/queries/like'
import {logger} from '#/logger' import {usePreferencesQuery} from '#/state/queries/preferences'
import {Haptics} from '#/lib/haptics' import {useSession} from '#/state/session'
import {pluralize} from '#/lib/strings/helpers' import {useAnalytics} from 'lib/analytics/analytics'
import {isAppLabeler} from '#/lib/moderation' import {useProfileShadow} from 'state/cache/profile-shadow'
import {atoms as a, useTheme, tokens} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
import {Text} from '#/components/Typography'
import * as Toast from '#/view/com/util/Toast'
import {ProfileHeaderShell} from './Shell'
import {ProfileMenu} from '#/view/com/profile/ProfileMenu' import {ProfileMenu} from '#/view/com/profile/ProfileMenu'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a, tokens, useTheme} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
import {DialogOuterProps} from '#/components/Dialog'
import {
Heart2_Filled_Stroke2_Corner0_Rounded as HeartFilled,
Heart2_Stroke2_Corner0_Rounded as Heart,
} from '#/components/icons/Heart2'
import {Link} from '#/components/Link'
import * as Prompt from '#/components/Prompt'
import {RichText} from '#/components/RichText'
import {Text} from '#/components/Typography'
import {ProfileHeaderDisplayName} from './DisplayName' import {ProfileHeaderDisplayName} from './DisplayName'
import {ProfileHeaderHandle} from './Handle' import {ProfileHeaderHandle} from './Handle'
import {ProfileHeaderMetrics} from './Metrics' import {ProfileHeaderMetrics} from './Metrics'
import { import {ProfileHeaderShell} from './Shell'
Heart2_Stroke2_Corner0_Rounded as Heart,
Heart2_Filled_Stroke2_Corner0_Rounded as HeartFilled,
} from '#/components/icons/Heart2'
import {DialogOuterProps} from '#/components/Dialog'
import * as Prompt from '#/components/Prompt'
import {Link} from '#/components/Link'
interface Props { interface Props {
profile: AppBskyActorDefs.ProfileViewDetailed profile: AppBskyActorDefs.ProfileViewDetailed
@ -312,6 +311,7 @@ function CantSubscribePrompt({
}: { }: {
control: DialogOuterProps['control'] control: DialogOuterProps['control']
}) { }) {
const {_} = useLingui()
return ( return (
<Prompt.Outer control={control}> <Prompt.Outer control={control}>
<Prompt.Title>Unable to subscribe</Prompt.Title> <Prompt.Title>Unable to subscribe</Prompt.Title>
@ -322,7 +322,7 @@ function CantSubscribePrompt({
</Trans> </Trans>
</Prompt.Description> </Prompt.Description>
<Prompt.Actions> <Prompt.Actions>
<Prompt.Action onPress={control.close}>OK</Prompt.Action> <Prompt.Action onPress={control.close} cta={_(msg`OK`)} />
</Prompt.Actions> </Prompt.Actions>
</Prompt.Outer> </Prompt.Outer>
) )