Allow access to DM settings for age restricted users
This commit is contained in:
@@ -18,10 +18,12 @@ export function AgeRestrictedScreen({
|
|||||||
children,
|
children,
|
||||||
screenTitle,
|
screenTitle,
|
||||||
infoText,
|
infoText,
|
||||||
|
rightHeaderSlot,
|
||||||
}: {
|
}: {
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
screenTitle?: string
|
screenTitle?: string
|
||||||
infoText?: string
|
infoText?: string
|
||||||
|
rightHeaderSlot?: React.ReactNode
|
||||||
}) {
|
}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const copy = useAgeAssuranceCopy()
|
const copy = useAgeAssuranceCopy()
|
||||||
@@ -46,12 +48,12 @@ export function AgeRestrictedScreen({
|
|||||||
<Layout.Screen>
|
<Layout.Screen>
|
||||||
<Layout.Header.Outer>
|
<Layout.Header.Outer>
|
||||||
<Layout.Header.BackButton />
|
<Layout.Header.BackButton />
|
||||||
<Layout.Header.Content>
|
<Layout.Header.Content align="left">
|
||||||
<Layout.Header.TitleText>
|
<Layout.Header.TitleText>
|
||||||
{screenTitle ?? <Trans>Unavailable</Trans>}
|
{screenTitle ?? <Trans>Unavailable</Trans>}
|
||||||
</Layout.Header.TitleText>
|
</Layout.Header.TitleText>
|
||||||
</Layout.Header.Content>
|
</Layout.Header.Content>
|
||||||
<Layout.Header.Slot />
|
{rightHeaderSlot ?? <Layout.Header.Slot />}
|
||||||
</Layout.Header.Outer>
|
</Layout.Header.Outer>
|
||||||
<Layout.Content>
|
<Layout.Content>
|
||||||
<View style={[a.p_lg]}>
|
<View style={[a.p_lg]}>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {isNative} from '#/platform/detection'
|
|||||||
import {useAgeAssuranceContext} from '#/state/ageAssurance'
|
import {useAgeAssuranceContext} from '#/state/ageAssurance'
|
||||||
import {type SessionAccount, useAgent, useSession} from '#/state/session'
|
import {type SessionAccount, useAgent, useSession} from '#/state/session'
|
||||||
import BackgroundNotificationHandler from '#/../modules/expo-background-notification-handler'
|
import BackgroundNotificationHandler from '#/../modules/expo-background-notification-handler'
|
||||||
|
import {IS_DEV} from '#/env'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -129,7 +130,7 @@ export function useGetAndRegisterPushToken() {
|
|||||||
}: {
|
}: {
|
||||||
isAgeRestricted?: boolean
|
isAgeRestricted?: boolean
|
||||||
} = {}) => {
|
} = {}) => {
|
||||||
if (!isNative) return
|
if (!isNative || IS_DEV) return
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will also fire the listener added via `addPushTokenListener`. That
|
* This will also fire the listener added via `addPushTokenListener`. That
|
||||||
|
|||||||
@@ -74,7 +74,18 @@ export function MessagesScreen(props: Props) {
|
|||||||
return (
|
return (
|
||||||
<AgeRestrictedScreen
|
<AgeRestrictedScreen
|
||||||
screenTitle={_(msg`Chats`)}
|
screenTitle={_(msg`Chats`)}
|
||||||
infoText={aaCopy.chatsInfoText}>
|
infoText={aaCopy.chatsInfoText}
|
||||||
|
rightHeaderSlot={
|
||||||
|
<Link
|
||||||
|
to="/messages/settings"
|
||||||
|
label={_(msg`Chat settings`)}
|
||||||
|
size="small"
|
||||||
|
color="secondary">
|
||||||
|
<ButtonText>
|
||||||
|
<Trans>Chat settings</Trans>
|
||||||
|
</ButtonText>
|
||||||
|
</Link>
|
||||||
|
}>
|
||||||
<MessagesScreenInner {...props} />
|
<MessagesScreenInner {...props} />
|
||||||
</AgeRestrictedScreen>
|
</AgeRestrictedScreen>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import {useSession} from '#/state/session'
|
|||||||
import * as Toast from '#/view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
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'
|
||||||
@@ -25,16 +23,7 @@ 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) {
|
||||||
const {_} = useLingui()
|
return <MessagesSettingsScreenInner {...props} />
|
||||||
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