Update birthdate copy, add isAppPassword handling on NoAccessScreen
This commit is contained in:
@@ -9,11 +9,12 @@ import {
|
|||||||
useCreateSupportLink,
|
useCreateSupportLink,
|
||||||
} from '#/lib/hooks/useCreateSupportLink'
|
} from '#/lib/hooks/useCreateSupportLink'
|
||||||
import {dateDiff, useGetTimeAgo} from '#/lib/hooks/useTimeAgo'
|
import {dateDiff, useGetTimeAgo} from '#/lib/hooks/useTimeAgo'
|
||||||
|
import {isAppPassword} from '#/lib/jwt'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {isNative} from '#/platform/detection'
|
import {isNative} from '#/platform/detection'
|
||||||
import {useIsBirthdateUpdateAllowed} from '#/state/birthdate'
|
import {useIsBirthdateUpdateAllowed} from '#/state/birthdate'
|
||||||
import {useSessionApi} from '#/state/session'
|
import {useSession, useSessionApi} from '#/state/session'
|
||||||
import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
|
import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
|
||||||
import {Admonition} from '#/components/Admonition'
|
import {Admonition} from '#/components/Admonition'
|
||||||
import {AgeAssuranceAppealDialog} from '#/components/ageAssurance/AgeAssuranceAppealDialog'
|
import {AgeAssuranceAppealDialog} from '#/components/ageAssurance/AgeAssuranceAppealDialog'
|
||||||
@@ -29,7 +30,7 @@ import {ShieldCheck_Stroke2_Corner0_Rounded as ShieldIcon} from '#/components/ic
|
|||||||
import {createStaticClick, SimpleInlineLinkText} from '#/components/Link'
|
import {createStaticClick, SimpleInlineLinkText} from '#/components/Link'
|
||||||
import {Outlet as PortalOutlet} from '#/components/Portal'
|
import {Outlet as PortalOutlet} from '#/components/Portal'
|
||||||
import * as Toast from '#/components/Toast'
|
import * as Toast from '#/components/Toast'
|
||||||
import {Text} from '#/components/Typography'
|
import {Span, Text} from '#/components/Typography'
|
||||||
import {BottomSheetOutlet} from '#/../modules/bottom-sheet'
|
import {BottomSheetOutlet} from '#/../modules/bottom-sheet'
|
||||||
import {useAgeAssurance} from '#/ageAssurance'
|
import {useAgeAssurance} from '#/ageAssurance'
|
||||||
import {useAgeAssuranceDataContext} from '#/ageAssurance/data'
|
import {useAgeAssuranceDataContext} from '#/ageAssurance/data'
|
||||||
@@ -54,6 +55,9 @@ export function NoAccessScreen() {
|
|||||||
const {logoutCurrentAccount} = useSessionApi()
|
const {logoutCurrentAccount} = useSessionApi()
|
||||||
const createSupportLink = useCreateSupportLink()
|
const createSupportLink = useCreateSupportLink()
|
||||||
|
|
||||||
|
const {currentAccount} = useSession()
|
||||||
|
const isUsingAppPassword = isAppPassword(currentAccount?.accessJwt || '')
|
||||||
|
|
||||||
const aa = useAgeAssurance()
|
const aa = useAgeAssurance()
|
||||||
const isBlocked = aa.state.status === aa.Status.Blocked
|
const isBlocked = aa.state.status === aa.Status.Blocked
|
||||||
const isAARegion = !!region
|
const isAARegion = !!region
|
||||||
@@ -167,10 +171,20 @@ export function NoAccessScreen() {
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<View style={[a.gap_lg]}>
|
<View style={[a.gap_lg]}>
|
||||||
|
<Text style={[textStyles]}>
|
||||||
|
<Trans>Hi there!</Trans>
|
||||||
|
</Text>
|
||||||
<Text style={[textStyles]}>
|
<Text style={[textStyles]}>
|
||||||
<Trans>
|
<Trans>
|
||||||
It looks like you haven't added your birthdate. You must
|
In order to provide an age-appropriate experience, we need to
|
||||||
provide an accurate date of birth to use Bluesky.
|
know your age. This is a one-time thing, and your birthdate
|
||||||
|
will be kept private.
|
||||||
|
</Trans>
|
||||||
|
</Text>
|
||||||
|
<Text style={[textStyles]}>
|
||||||
|
<Trans>
|
||||||
|
Set your birthdate below and we'll get you back to posting and
|
||||||
|
exploring in no time!
|
||||||
</Trans>
|
</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
<Button
|
<Button
|
||||||
@@ -182,6 +196,17 @@ export function NoAccessScreen() {
|
|||||||
<Trans>Add your birthdate</Trans>
|
<Trans>Add your birthdate</Trans>
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
{isUsingAppPassword && (
|
||||||
|
<Admonition type="info">
|
||||||
|
<Trans>
|
||||||
|
Hmmm, looks like you're logged in with an{' '}
|
||||||
|
<Span style={[a.italic]}>App Password</Span>. To set a
|
||||||
|
birthdate, you'll need to log in with your main account
|
||||||
|
password, or ask whomever controls this account to do so.
|
||||||
|
</Trans>
|
||||||
|
</Admonition>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -21,3 +21,9 @@ export function isJwtExpired(token: string) {
|
|||||||
return true // invalid token or parse error
|
return true // invalid token or parse error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isAppPassword(token: string) {
|
||||||
|
const payload = jwtDecode(token)
|
||||||
|
// @ts-ignore
|
||||||
|
return payload.scope === 'com.atproto.appPass'
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user