mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
merge: fix invite journey routing
This commit is contained in:
commit
bb0c712ede
1 file changed
+5
-4
@@ -41,6 +41,7 @@ export default function PairingScreen() {
|
|||||||
const [prefillAttempted, setPrefillAttempted] = useState(false);
|
const [prefillAttempted, setPrefillAttempted] = useState(false);
|
||||||
const [joinError, setJoinError] = useState<string | null>(null);
|
const [joinError, setJoinError] = useState<string | null>(null);
|
||||||
const [isPollOffline, setIsPollOffline] = useState(false);
|
const [isPollOffline, setIsPollOffline] = useState(false);
|
||||||
|
const [isIncomingConflictDismissed, setIsIncomingConflictDismissed] = useState(false);
|
||||||
|
|
||||||
// Redirect if already paired. Pairing claims both members' sealed answers and
|
// Redirect if already paired. Pairing claims both members' sealed answers and
|
||||||
// computes matches server-side, so the matches store must refetch here too:
|
// computes matches server-side, so the matches store must refetch here too:
|
||||||
@@ -59,7 +60,7 @@ export default function PairingScreen() {
|
|||||||
}
|
}
|
||||||
const seen = await hasSeenPairedUnlock(user.id, couple.id);
|
const seen = await hasSeenPairedUnlock(user.id, couple.id);
|
||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
router.replace(seen ? "/(app)" : "/(app)/paired");
|
router.replace(seen ? "/(app)" : "/(app)/paired" as any);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
return () => { cancelled = true; };
|
return () => { cancelled = true; };
|
||||||
@@ -173,7 +174,7 @@ export default function PairingScreen() {
|
|||||||
await useMatchStore.getState().fetchMatches(true);
|
await useMatchStore.getState().fetchMatches(true);
|
||||||
Events.coupleJoined();
|
Events.coupleJoined();
|
||||||
|
|
||||||
router.replace("/(app)/paired");
|
router.replace("/(app)/paired" as any);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
const details = error instanceof ApiError ? error.details as { error?: { code?: string } } : undefined;
|
const details = error instanceof ApiError ? error.details as { error?: { code?: string } } : undefined;
|
||||||
const code = details?.error?.code;
|
const code = details?.error?.code;
|
||||||
@@ -336,14 +337,14 @@ export default function PairingScreen() {
|
|||||||
</Animated.View>
|
</Animated.View>
|
||||||
|
|
||||||
<View style={styles.content}>
|
<View style={styles.content}>
|
||||||
{incomingCode && (
|
{incomingCode && !isIncomingConflictDismissed && (
|
||||||
<GlassCard variant="elevated">
|
<GlassCard variant="elevated">
|
||||||
<Text style={styles.conflictTitle}>Use this code instead?</Text>
|
<Text style={styles.conflictTitle}>Use this code instead?</Text>
|
||||||
<Text style={styles.conflictBody}>You have your own invite out. To join theirs, cancel yours first. Your code will stop working, and answers you've given since you created it will be deleted.</Text>
|
<Text style={styles.conflictBody}>You have your own invite out. To join theirs, cancel yours first. Your code will stop working, and answers you've given since you created it will be deleted.</Text>
|
||||||
<GlassButton onPress={handleCancelOwnAndPrefill} variant="danger" fullWidth disabled={isSubmitting} testID="pairing-conflict-cancel-and-join">
|
<GlassButton onPress={handleCancelOwnAndPrefill} variant="danger" fullWidth disabled={isSubmitting} testID="pairing-conflict-cancel-and-join">
|
||||||
Cancel mine and join
|
Cancel mine and join
|
||||||
</GlassButton>
|
</GlassButton>
|
||||||
<TouchableOpacity onPress={() => void clearPendingInviteCode()} style={styles.cancelButton} testID="pairing-conflict-keep-own">
|
<TouchableOpacity onPress={() => { setIsIncomingConflictDismissed(true); void clearPendingInviteCode(); }} style={styles.cancelButton} testID="pairing-conflict-keep-own">
|
||||||
<Text style={styles.cancelButtonText}>Keep my invite</Text>
|
<Text style={styles.cancelButtonText}>Keep my invite</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</GlassCard>
|
</GlassCard>
|
||||||
|
|||||||
Reference in new issue
Block a user