Add profile QR code for sharing and inviting friends (#10659)
This commit is contained in:
@@ -28,6 +28,7 @@ import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
import {DebugFieldDisplay} from '#/components/DebugFieldDisplay'
|
||||
import {useDialogControl} from '#/components/Dialog'
|
||||
import {MessageProfileButton} from '#/components/dms/MessageProfileButton'
|
||||
import {ArrowShareRight_Stroke2_Corner2_Rounded as ArrowShareRight} from '#/components/icons/ArrowShareRight'
|
||||
import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
|
||||
import {
|
||||
KnownFollowers,
|
||||
@@ -38,7 +39,9 @@ import * as Prompt from '#/components/Prompt'
|
||||
import {RichText} from '#/components/RichText'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {IS_IOS} from '#/env'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {IS_IOS, IS_NATIVE} from '#/env'
|
||||
import {InviteFriendsDialog} from '#/features/inviteFriends'
|
||||
import {useActorStatus} from '#/features/liveNow'
|
||||
import {GermButton} from '../components/GermButton'
|
||||
import {EditProfileDialog} from './EditProfileDialog'
|
||||
@@ -238,6 +241,7 @@ export function HeaderStandardButtons({
|
||||
minimal?: boolean
|
||||
}) {
|
||||
const {_} = useLingui()
|
||||
const ax = useAnalytics()
|
||||
const {hasSession, currentAccount} = useSession()
|
||||
const playHaptic = useHaptics()
|
||||
const requireAuth = useRequireAuth()
|
||||
@@ -247,6 +251,7 @@ export function HeaderStandardButtons({
|
||||
)
|
||||
const [, queueUnblock] = useProfileBlockMutationQueue(profile)
|
||||
const editProfileControl = useDialogControl()
|
||||
const inviteFriendsControl = useDialogControl()
|
||||
const unblockPromptControl = Prompt.usePromptControl()
|
||||
|
||||
const isMe = currentAccount?.did === profile.did
|
||||
@@ -347,7 +352,25 @@ export function HeaderStandardButtons({
|
||||
<Trans>Edit Profile</Trans>
|
||||
</ButtonText>
|
||||
</Button>
|
||||
{/* Invite friends is a native-only share sheet (the dialog is a
|
||||
no-op on web), so gate the entry point to avoid a dead button. */}
|
||||
{IS_NATIVE && (
|
||||
<Button
|
||||
testID="profileHeaderShareButton"
|
||||
size="small"
|
||||
color="secondary"
|
||||
shape="round"
|
||||
onPress={() => {
|
||||
playHaptic('Light')
|
||||
ax.metric('invite:dialog:open', {logContext: 'ProfileHeader'})
|
||||
inviteFriendsControl.open()
|
||||
}}
|
||||
label={_(msg`Invite friends`)}>
|
||||
<ButtonIcon icon={ArrowShareRight} />
|
||||
</Button>
|
||||
)}
|
||||
<EditProfileDialog profile={profile} control={editProfileControl} />
|
||||
{IS_NATIVE && <InviteFriendsDialog control={inviteFriendsControl} />}
|
||||
</>
|
||||
) : profile.viewer?.blocking ? (
|
||||
profile.viewer?.blockingByList ? null : (
|
||||
|
||||
@@ -39,6 +39,7 @@ import {atoms as a, tokens, useGutters, useTheme} from '#/alf'
|
||||
import {Admonition} from '#/components/Admonition'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
import {ContactsHeroImage} from '#/components/contacts/components/HeroImage'
|
||||
import {useDialogControl} from '#/components/Dialog'
|
||||
import {ArrowRotateClockwise_Stroke2_Corner0_Rounded as ResyncIcon} from '#/components/icons/ArrowRotate'
|
||||
import {TimesLarge_Stroke2_Corner0_Rounded as XIcon} from '#/components/icons/Times'
|
||||
import {Trash_Stroke2_Corner0_Rounded as TrashIcon} from '#/components/icons/Trash'
|
||||
@@ -50,6 +51,7 @@ import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {IS_NATIVE} from '#/env'
|
||||
import {InviteFriendsDialog} from '#/features/inviteFriends'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
import {bulkWriteFollows} from '../Onboarding/util'
|
||||
|
||||
@@ -76,7 +78,7 @@ export function FindContactsSettingsScreen({}: Props) {
|
||||
<Layout.Header.BackButton />
|
||||
<Layout.Header.Content>
|
||||
<Layout.Header.TitleText>
|
||||
<Trans>Find Friends</Trans>
|
||||
<Trans>Find and invite friends</Trans>
|
||||
</Layout.Header.TitleText>
|
||||
</Layout.Header.Content>
|
||||
<Layout.Header.Slot />
|
||||
@@ -113,6 +115,8 @@ function Intro() {
|
||||
const gutter = useGutters(['base'])
|
||||
const t = useTheme()
|
||||
const {_} = useLingui()
|
||||
const ax = useAnalytics()
|
||||
const inviteFriendsControl = useDialogControl()
|
||||
|
||||
const {data: isAvailable, isSuccess} = useQuery({
|
||||
queryKey: ['contacts-available'],
|
||||
@@ -122,6 +126,9 @@ function Intro() {
|
||||
return (
|
||||
<Layout.Content contentContainerStyle={[gutter, a.gap_lg]}>
|
||||
<ContactsHeroImage />
|
||||
<Text style={[a.text_xl, a.font_bold]}>
|
||||
<Trans>Find people you know</Trans>
|
||||
</Text>
|
||||
<Text style={[a.text_md, a.leading_snug, t.atoms.text_contrast_medium]}>
|
||||
<Trans>
|
||||
Find your friends on Bluesky by verifying your phone number and
|
||||
@@ -161,6 +168,20 @@ function Intro() {
|
||||
</Admonition>
|
||||
)
|
||||
)}
|
||||
<Button
|
||||
label={_(msg`Share my profile`)}
|
||||
size="large"
|
||||
color="secondary"
|
||||
onPress={() => {
|
||||
ax.metric('invite:dialog:open', {logContext: 'FindContactsSettings'})
|
||||
inviteFriendsControl.open()
|
||||
}}
|
||||
style={[a.flex_1, a.justify_center]}>
|
||||
<ButtonText>
|
||||
<Trans>Share my profile</Trans>
|
||||
</ButtonText>
|
||||
</Button>
|
||||
<InviteFriendsDialog control={inviteFriendsControl} />
|
||||
</Layout.Content>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -213,10 +213,10 @@ export function SettingsScreen({}: Props) {
|
||||
!ax.features.enabled(ax.features.ImportContactsSettingsDisable) && (
|
||||
<SettingsList.LinkItem
|
||||
to="/settings/find-contacts"
|
||||
label={l`Find friends from contacts`}>
|
||||
label={l`Find and invite friends`}>
|
||||
<SettingsList.ItemIcon icon={ContactsIcon} />
|
||||
<SettingsList.ItemText>
|
||||
<Trans>Find friends from contacts</Trans>
|
||||
<Trans>Find and invite friends</Trans>
|
||||
</SettingsList.ItemText>
|
||||
</SettingsList.LinkItem>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user