Relay pairing: prove direct + iOS deeplink smoke

This commit is contained in:
Mohamed Boudra
2026-02-05 01:26:39 +07:00
parent 9b8f1e348d
commit dc5336660b
11 changed files with 121 additions and 27 deletions
+14 -5
View File
@@ -297,15 +297,24 @@ function OfferLinkListener({
}: {
upsertDaemonFromOfferUrl: (offerUrlOrFragment: string) => Promise<unknown>;
}) {
const router = useRouter();
useEffect(() => {
let cancelled = false;
const handleUrl = (url: string | null) => {
if (!url) return;
if (!url.includes("#offer=")) return;
void upsertDaemonFromOfferUrl(url).catch((error) => {
if (cancelled) return;
console.warn("[Linking] Failed to import pairing offer", error);
});
void upsertDaemonFromOfferUrl(url)
.then((profile) => {
if (cancelled) return;
const serverId = (profile as any)?.serverId;
if (typeof serverId !== "string" || !serverId) return;
router.replace({ pathname: "/", params: { serverId } });
})
.catch((error) => {
if (cancelled) return;
console.warn("[Linking] Failed to import pairing offer", error);
});
};
void Linking.getInitialURL().then(handleUrl).catch(() => undefined);
@@ -318,7 +327,7 @@ function OfferLinkListener({
cancelled = true;
subscription.remove();
};
}, [upsertDaemonFromOfferUrl]);
}, [router, upsertDaemonFromOfferUrl]);
return null;
}
@@ -124,11 +124,14 @@ export function PairLinkModal({ visible, onClose, onSaved }: PairLinkModalProps)
<Text style={styles.label}>Pairing link</Text>
<InputComponent
testID="pair-link-input"
nativeID="pair-link-input"
accessibilityLabel="pair-link-input"
value={offerUrl}
onChangeText={setOfferUrl}
placeholder="https://app.paseo.sh/#offer=..."
placeholderTextColor={theme.colors.foregroundMuted}
style={styles.input}
autoFocus
autoCapitalize="none"
autoCorrect={false}
keyboardType="url"
@@ -137,7 +140,15 @@ export function PairLinkModal({ visible, onClose, onSaved }: PairLinkModalProps)
</View>
<View style={styles.actions}>
<Pressable style={styles.button} onPress={handleClose} disabled={isSaving} testID="pair-link-cancel">
<Pressable
style={styles.button}
onPress={handleClose}
disabled={isSaving}
testID="pair-link-cancel"
accessible
accessibilityRole="button"
accessibilityLabel="Cancel"
>
<Text style={styles.buttonText}>Cancel</Text>
</Pressable>
<Pressable
@@ -145,6 +156,9 @@ export function PairLinkModal({ visible, onClose, onSaved }: PairLinkModalProps)
onPress={() => void handleSave()}
disabled={isSaving}
testID="pair-link-submit"
accessible
accessibilityRole="button"
accessibilityLabel="Pair"
>
<View style={styles.connectRow}>
<Link size={16} color={theme.colors.palette.white} />