Require age assurance to access chat settings (#10053)
This commit is contained in:
@@ -38,6 +38,7 @@ import * as Layout from '#/components/Layout'
|
||||
import {Link} from '#/components/Link'
|
||||
import {ListFooter} from '#/components/Lists'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {useAgeAssurance} from '#/ageAssurance'
|
||||
import {IS_NATIVE} from '#/env'
|
||||
import {ChatListItem} from './components/ChatListItem'
|
||||
import {InboxPreview} from './components/InboxPreview'
|
||||
@@ -71,21 +72,24 @@ type Props = NativeStackScreenProps<MessagesTabNavigatorParams, 'Messages'>
|
||||
export function MessagesScreen(props: Props) {
|
||||
const {_} = useLingui()
|
||||
const aaCopy = useAgeAssuranceCopy()
|
||||
const aa = useAgeAssurance()
|
||||
|
||||
return (
|
||||
<AgeRestrictedScreen
|
||||
screenTitle={_(msg`Chats`)}
|
||||
infoText={aaCopy.chatsInfoText}
|
||||
rightHeaderSlot={
|
||||
<Link
|
||||
to="/messages/settings"
|
||||
label={_(msg`Chat settings`)}
|
||||
size="small"
|
||||
color="secondary">
|
||||
<ButtonText>
|
||||
<Trans>Chat settings</Trans>
|
||||
</ButtonText>
|
||||
</Link>
|
||||
aa.flags.chatDisabled ? null : (
|
||||
<Link
|
||||
to="/messages/settings"
|
||||
label={_(msg`Chat settings`)}
|
||||
size="small"
|
||||
color="secondary">
|
||||
<ButtonText>
|
||||
<Trans>Chat settings</Trans>
|
||||
</ButtonText>
|
||||
</Link>
|
||||
)
|
||||
}>
|
||||
<MessagesScreenInner {...props} />
|
||||
</AgeRestrictedScreen>
|
||||
|
||||
@@ -11,6 +11,8 @@ import {useProfileQuery} from '#/state/queries/profile'
|
||||
import {useSession} from '#/state/session'
|
||||
import {atoms as a} from '#/alf'
|
||||
import {Admonition} from '#/components/Admonition'
|
||||
import {AgeRestrictedScreen} from '#/components/ageAssurance/AgeRestrictedScreen'
|
||||
import {useAgeAssuranceCopy} from '#/components/ageAssurance/useAgeAssuranceCopy'
|
||||
import {Divider} from '#/components/Divider'
|
||||
import * as Toggle from '#/components/forms/Toggle'
|
||||
import * as Layout from '#/components/Layout'
|
||||
@@ -24,7 +26,16 @@ type AllowIncoming = 'all' | 'none' | 'following'
|
||||
type Props = NativeStackScreenProps<CommonNavigatorParams, 'MessagesSettings'>
|
||||
|
||||
export function MessagesSettingsScreen(props: Props) {
|
||||
return <MessagesSettingsScreenInner {...props} />
|
||||
const {_} = useLingui()
|
||||
const aaCopy = useAgeAssuranceCopy()
|
||||
|
||||
return (
|
||||
<AgeRestrictedScreen
|
||||
screenTitle={_(msg`Chat settings`)}
|
||||
infoText={aaCopy.chatsInfoText}>
|
||||
<MessagesSettingsScreenInner {...props} />
|
||||
</AgeRestrictedScreen>
|
||||
)
|
||||
}
|
||||
|
||||
export function MessagesSettingsScreenInner({}: Props) {
|
||||
|
||||
Reference in New Issue
Block a user