SELF-1662: Improve prove deeplink navigation (#1517)

* Improve prove deeplink navigation

* fix tests
This commit is contained in:
Justin Hernandez
2025-12-16 20:43:14 -08:00
committed by GitHub
parent a6194665ec
commit e1c7ecdbb8
3 changed files with 16 additions and 4 deletions

View File

@@ -125,7 +125,9 @@ export const handleUrl = (selfClient: SelfClient, uri: string) => {
selfClient.getSelfAppState().setSelfApp(selfAppJson);
selfClient.getSelfAppState().startAppListener(selfAppJson.sessionId);
navigationRef.navigate('Prove' as never);
navigationRef.reset(
createDeeplinkNavigationState('Prove', correctParentScreen),
);
return;
} catch (error) {
@@ -140,7 +142,9 @@ export const handleUrl = (selfClient: SelfClient, uri: string) => {
selfClient.getSelfAppState().cleanSelfApp();
selfClient.getSelfAppState().startAppListener(sessionId);
navigationRef.navigate('Prove' as never);
navigationRef.reset(
createDeeplinkNavigationState('Prove', correctParentScreen),
);
} else if (mock_passport) {
try {
const data = JSON.parse(mock_passport);

View File

@@ -17,6 +17,7 @@ const verificationScreens = {
options: {
headerShown: false,
animation: 'slide_from_bottom',
gestureEnabled: false,
} as NativeStackNavigationOptions,
},
Prove: {
@@ -29,6 +30,7 @@ const verificationScreens = {
headerTitleStyle: {
color: white,
},
gestureEnabled: false,
} as NativeStackNavigationOptions,
},
QRCodeTrouble: {

View File

@@ -90,7 +90,10 @@ describe('deeplinks', () => {
expect(mockStartAppListener).toHaveBeenCalledWith('abc');
const { navigationRef } = require('@/navigation');
expect(navigationRef.navigate).toHaveBeenCalledWith('Prove');
expect(navigationRef.reset).toHaveBeenCalledWith({
index: 1,
routes: [{ name: 'Home' }, { name: 'Prove' }],
});
});
it('handles sessionId parameter', () => {
@@ -113,7 +116,10 @@ describe('deeplinks', () => {
expect(mockStartAppListener).toHaveBeenCalledWith('123');
const { navigationRef } = require('@/navigation');
expect(navigationRef.navigate).toHaveBeenCalledWith('Prove');
expect(navigationRef.reset).toHaveBeenCalledWith({
index: 1,
routes: [{ name: 'Home' }, { name: 'Prove' }],
});
});
it('handles mock_passport parameter', () => {