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