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