Hide DMs send options in menu

This commit is contained in:
Eric Bailey
2025-07-16 10:11:59 -05:00
parent 8d0349a73c
commit 10d8a9c35a
3 changed files with 31 additions and 25 deletions
@@ -11,6 +11,7 @@ import {shareText, shareUrl} from '#/lib/sharing'
import {toShareUrl} from '#/lib/strings/url-helpers' import {toShareUrl} from '#/lib/strings/url-helpers'
import {logger} from '#/logger' import {logger} from '#/logger'
import {isIOS} from '#/platform/detection' import {isIOS} from '#/platform/detection'
import {useAgeAssurance} from '#/state/ageAssurance/useAgeAssurance'
import {useProfileShadow} from '#/state/cache/profile-shadow' import {useProfileShadow} from '#/state/cache/profile-shadow'
import {useSession} from '#/state/session' import {useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast' import * as Toast from '#/view/com/util/Toast'
@@ -36,6 +37,7 @@ let ShareMenuItems = ({
const navigation = useNavigation<NavigationProp>() const navigation = useNavigation<NavigationProp>()
const sendViaChatControl = useDialogControl() const sendViaChatControl = useDialogControl()
const [devModeEnabled] = useDevMode() const [devModeEnabled] = useDevMode()
const {isAgeRestricted} = useAgeAssurance()
const postUri = post.uri const postUri = post.uri
const postAuthor = useProfileShadow(post.author) const postAuthor = useProfileShadow(post.author)
@@ -89,7 +91,7 @@ let ShareMenuItems = ({
return ( return (
<> <>
<Menu.Outer> <Menu.Outer>
{hasSession && ( {hasSession && !isAgeRestricted && (
<Menu.Group> <Menu.Group>
<Menu.ContainerItem> <Menu.ContainerItem>
<RecentChats postUri={postUri} /> <RecentChats postUri={postUri} />
@@ -11,6 +11,7 @@ import {shareText, shareUrl} from '#/lib/sharing'
import {toShareUrl} from '#/lib/strings/url-helpers' import {toShareUrl} from '#/lib/strings/url-helpers'
import {logger} from '#/logger' import {logger} from '#/logger'
import {isWeb} from '#/platform/detection' import {isWeb} from '#/platform/detection'
import {useAgeAssurance} from '#/state/ageAssurance/useAgeAssurance'
import {useProfileShadow} from '#/state/cache/profile-shadow' import {useProfileShadow} from '#/state/cache/profile-shadow'
import {useSession} from '#/state/session' import {useSession} from '#/state/session'
import {useBreakpoints} from '#/alf' import {useBreakpoints} from '#/alf'
@@ -38,6 +39,7 @@ let ShareMenuItems = ({
const embedPostControl = useDialogControl() const embedPostControl = useDialogControl()
const sendViaChatControl = useDialogControl() const sendViaChatControl = useDialogControl()
const [devModeEnabled] = useDevMode() const [devModeEnabled] = useDevMode()
const {isAgeRestricted} = useAgeAssurance()
const postUri = post.uri const postUri = post.uri
const postCid = post.cid const postCid = post.cid
@@ -96,7 +98,7 @@ let ShareMenuItems = ({
<Menu.Outer> <Menu.Outer>
{!hideInPWI && copyLinkItem} {!hideInPWI && copyLinkItem}
{hasSession && ( {hasSession && !isAgeRestricted && (
<Menu.Item <Menu.Item
testID="postDropdownSendViaDMBtn" testID="postDropdownSendViaDMBtn"
label={_(msg`Send via direct message`)} label={_(msg`Send via direct message`)}
@@ -28,30 +28,32 @@ export function AgeAssuranceDismissibleNotice({style}: ViewStyleProp & {}) {
return ( return (
<View style={style}> <View style={style}>
<AgeAssuranceAdmonition>{copy.notice}</AgeAssuranceAdmonition> <View>
<AgeAssuranceAdmonition>{copy.notice}</AgeAssuranceAdmonition>
<Button <Button
label={_(msg`Don't show again`)} label={_(msg`Don't show again`)}
size="tiny" size="tiny"
variant="solid" variant="solid"
color="secondary_inverted" color="secondary_inverted"
shape="round" shape="round"
onPress={() => onPress={() =>
save({ save({
id: Nux.AgeAssuranceDismissibleNotice, id: Nux.AgeAssuranceDismissibleNotice,
completed: true, completed: true,
data: undefined, data: undefined,
}) })
} }
style={[ style={[
a.absolute, a.absolute,
{ {
top: 12, top: 12,
right: 12, right: 12,
}, },
]}> ]}>
<ButtonIcon icon={X} /> <ButtonIcon icon={X} />
</Button> </Button>
</View>
</View> </View>
) )
} }