diff --git a/apps/mobile/app/+native-intent.tsx b/apps/mobile/app/+native-intent.tsx index f0d4c837ff..d1c799434e 100644 --- a/apps/mobile/app/+native-intent.tsx +++ b/apps/mobile/app/+native-intent.tsx @@ -9,6 +9,8 @@ import { isSharePath } from '../src/ui/share/share-path'; export async function redirectSystemPath({ path }: { path: string; initial: boolean }) { if (isConnectOAuthCallback(path)) return null; if (isSharePath(path)) return '/share'; + const team = /^(?:deepseekbot:\/\/|\/)team\?(?:.*&)?i=([A-Za-z0-9_-]+)/u.exec(path); + if (team !== null) return `/pair/team?i=${team[1]}`; const call = callLinkRedirect( path, __DEV__ && Application.applicationId?.endsWith('.dev') === true, diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx index f262b8815d..832f28c2af 100644 --- a/apps/mobile/app/_layout.tsx +++ b/apps/mobile/app/_layout.tsx @@ -314,6 +314,10 @@ function RootNavigator() { name="sign-in" options={{ ...sheetScreenOptions(design, true), title: t.emailSignIn.title }} /> + + {host?.member ? ( + + + + router.push({ pathname: '/member-pairing', params: { hostId: host.hostId } }) + } + /> + + ) : null} {host && client ? ( {busy === 'preference' ? ( diff --git a/apps/mobile/app/member-pairing.tsx b/apps/mobile/app/member-pairing.tsx new file mode 100644 index 0000000000..584b9ea1e0 --- /dev/null +++ b/apps/mobile/app/member-pairing.tsx @@ -0,0 +1,103 @@ +import { useLocalSearchParams, useRouter } from 'expo-router'; +import { useState } from 'react'; +import { View } from 'react-native'; +import Svg, { Path } from 'react-native-svg'; + +import { useHostSession } from '../src/host/host-session'; +import { memberPairingOffer, type MemberPairingOffer } from '../src/host/team-client'; +import { qrCode, radius, space } from '../src/ui/design/tokens'; +import { useMounted } from '../src/ui/mounted'; +import { Button } from '../src/ui/primitives/button'; +import { SheetHeader } from '../src/ui/primitives/sheet-header'; +import { SettingsForm, SettingsFormItem } from '../src/ui/primitives/settings-form'; +import { SheetScreen } from '../src/ui/primitives/sheet-screen'; +import { Text } from '../src/ui/primitives/text'; +import { useStrings } from '../src/ui/strings'; + +const QR_SIZE = 220; + +export default function MemberPairingScreen() { + const t = useStrings(); + const copy = t.memberPairing; + const router = useRouter(); + const { hostId } = useLocalSearchParams<{ hostId?: string }>(); + const session = useHostSession(hostId); + const [offer, setOffer] = useState(); + const [failed, setFailed] = useState(false); + const [busy, setBusy] = useState(false); + const load = async (): Promise => { + const client = session.client; + if (!client) return setFailed(true); + setBusy(true); + setFailed(false); + const result = await memberPairingOffer(client); + setBusy(false); + if (result.ok) setOffer(result.value); + else setFailed(true); + }; + const mount = useMounted(() => { + void load(); + return () => {}; + }, [session.client]); + const expires = + offer === undefined + ? '' + : new Date(offer.expiresAt).toLocaleTimeString(undefined, { + hour: '2-digit', + minute: '2-digit', + }); + return ( + + router.back()} />} + testID="member-pairing" + > + + + + {copy.hint} + + {offer ? ( + + + + + + ) : null} + {offer ? ( + + {copy.expires.replace('{time}', expires)} + + ) : null} + {failed ? ( + + {copy.failed} + + ) : null} +