Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { itwLifecycleIsValidSelector } from "../../../lifecycle/store/selectors"

export type ItwIdentificationNavigationParams = {
eidReissuing?: boolean;
animationEnabled?: boolean;
};

export type ItwIdentificationModeSelectionScreenProps =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export type ItwIssuanceCredentialAsyncContinuationNavigationParams = {

type ScreenProps = IOStackNavigationRouteProps<
ItwParamsList,
"ITW_ISSUANCE_CREDENTIAL_ASYNC_FLOW_CONTINUATION"
"ITW_LANDING_SCREEN_CREDENTIAL_ASYNC_FLOW_CONTINUATION"
>;

const routeParams = t.type({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { useCallback } from "react";
import I18n from "i18next";
import { useNavigation } from "@react-navigation/native";
import {
IOStackNavigationProp,
useIONavigation
} from "../../../../navigation/params/AppParamsList";
import { useIOSelector } from "../../../../store/hooks";
import { itwLifecycleIsValidSelector } from "../../lifecycle/store/selectors";
import { ITW_ROUTES } from "../../navigation/routes";
import { useOnFirstRender } from "../../../../utils/hooks/useOnFirstRender";
import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent";
import { ItwParamsList } from "../../navigation/ItwParamsList";

/**
* Landing screen for the eID reissuing flow started from a message.
* Since this flow is started from outside the Wallet screen,
* it it necessary to make some preliminary checks before proceeding.
*/
export const ItwIssuanceEidReissuanceLandingScreen = () => {
const navigation = useIONavigation();

const isWalletValid = useIOSelector(itwLifecycleIsValidSelector);

// TODO: use more specific messages - see SIW-3233
if (!isWalletValid) {
return (
<OperationResultScreenContent
title={I18n.t("features.itWallet.issuance.genericError.title")}
pictogram="fatalError"
action={{
label: I18n.t("global.buttons.back"),
onPress: () => navigation.goBack()
}}
/>
);
}

return <NavigateToIdentificationModeSelection />;
};

const NavigateToIdentificationModeSelection = () => {
const navigation = useNavigation<IOStackNavigationProp<ItwParamsList>>();

const startEidReissuing = useCallback(() => {
navigation.replace(ITW_ROUTES.IDENTIFICATION.MODE_SELECTION, {
eidReissuing: true,
animationEnabled: false
});
}, [navigation]);

useOnFirstRender(startEidReissuing);

return null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const renderComponent = (

return renderScreenWithNavigationStoreContext<GlobalState>(
ItwIssuanceCredentialAsyncContinuationScreen,
ITW_ROUTES.ISSUANCE.CREDENTIAL_ASYNC_FLOW_CONTINUATION,
ITW_ROUTES.LANDING.CREDENTIAL_ASYNC_FLOW_CONTINUATION,
routeParams ?? {},
store
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ exports[`ItwIssuanceCredentialAsyncContinuationScreen it should render the activ
]
}
>
ITW_ISSUANCE_CREDENTIAL_ASYNC_FLOW_CONTINUATION
ITW_LANDING_SCREEN_CREDENTIAL_ASYNC_FLOW_CONTINUATION
</Text>
</View>
<View
Expand Down Expand Up @@ -1158,7 +1158,7 @@ exports[`ItwIssuanceCredentialAsyncContinuationScreen it should render the docum
]
}
>
ITW_ISSUANCE_CREDENTIAL_ASYNC_FLOW_CONTINUATION
ITW_LANDING_SCREEN_CREDENTIAL_ASYNC_FLOW_CONTINUATION
</Text>
</View>
<View
Expand Down Expand Up @@ -2109,7 +2109,7 @@ exports[`ItwIssuanceCredentialAsyncContinuationScreen it should render the gener
]
}
>
ITW_ISSUANCE_CREDENTIAL_ASYNC_FLOW_CONTINUATION
ITW_LANDING_SCREEN_CREDENTIAL_ASYNC_FLOW_CONTINUATION
</Text>
</View>
<View
Expand Down Expand Up @@ -2869,7 +2869,7 @@ exports[`ItwIssuanceCredentialAsyncContinuationScreen it should render the gener
]
}
>
ITW_ISSUANCE_CREDENTIAL_ASYNC_FLOW_CONTINUATION
ITW_LANDING_SCREEN_CREDENTIAL_ASYNC_FLOW_CONTINUATION
</Text>
</View>
<View
Expand Down
6 changes: 4 additions & 2 deletions ts/features/itwallet/navigation/ItwParamsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ export type ItwParamsList = {
| undefined;
[ITW_ROUTES.ISSUANCE.CREDENTIAL_PREVIEW]: undefined;
[ITW_ROUTES.ISSUANCE.CREDENTIAL_FAILURE]: undefined;
[ITW_ROUTES.ISSUANCE
.CREDENTIAL_ASYNC_FLOW_CONTINUATION]: ItwIssuanceCredentialAsyncContinuationNavigationParams;
[ITW_ROUTES.ISSUANCE.UPCOMING_CREDENTIAL]: undefined;
[ITW_ROUTES.ISSUANCE.IT_WALLET_INACTIVE]: undefined;
// PRESENTATION
Expand All @@ -65,6 +63,10 @@ export type ItwParamsList = {
[ITW_ROUTES.PRESENTATION.CREDENTIAL_FISCAL_CODE_MODAL]: undefined;
[ITW_ROUTES.PRESENTATION.EID_VERIFICATION_EXPIRED]: undefined;
[ITW_ROUTES.PRESENTATION.PID_DETAIL]: undefined;
// LANDING SCREENS
[ITW_ROUTES.LANDING
.CREDENTIAL_ASYNC_FLOW_CONTINUATION]: ItwIssuanceCredentialAsyncContinuationNavigationParams;
[ITW_ROUTES.LANDING.EID_REISSUANCE]: undefined;
// OTHERS
[ITW_ROUTES.IDENTITY_NOT_MATCHING_SCREEN]: undefined;
[ITW_ROUTES.WALLET_REVOCATION_SCREEN]: undefined;
Expand Down
20 changes: 15 additions & 5 deletions ts/features/itwallet/navigation/ItwStackNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import ItwCieIdLoginScreen from "../identification/cieId/screens/ItwCieIdLoginSc
import { ItwIdentificationModeSelectionScreen } from "../identification/common/screens/ItwIdentificationModeSelectionScreen.tsx";
import { ItwIdentificationIdpSelectionScreen } from "../identification/spid/screens/ItwIdentificationIdpSelectionScreen.tsx";
import ItwSpidIdpLoginScreen from "../identification/spid/screens/ItwSpidIdpLoginScreen.tsx";
import { ItwIssuanceEidReissuanceLandingScreen } from "../issuance/screens/ItwIssuanceEidReissuanceLandingScreen";
import { ItwIssuanceCredentialAsyncContinuationScreen } from "../issuance/screens/ItwIssuanceCredentialAsyncContinuationScreen";
import { ItwIssuanceCredentialFailureScreen } from "../issuance/screens/ItwIssuanceCredentialFailureScreen";
import { ItwIssuanceCredentialPreviewScreen } from "../issuance/screens/ItwIssuanceCredentialPreviewScreen";
Expand Down Expand Up @@ -131,6 +132,9 @@ const InnerNavigator = memo(() => {
<Stack.Screen
name={ITW_ROUTES.IDENTIFICATION.MODE_SELECTION}
component={ItwIdentificationModeSelectionScreen}
options={({ route }) => ({
animationEnabled: route.params.animationEnabled
})}
/>
<Stack.Screen
name={ITW_ROUTES.IDENTIFICATION.CIE_WARNING}
Expand Down Expand Up @@ -216,11 +220,6 @@ const InnerNavigator = memo(() => {
* TODO: [SIW-1375] better retry and go back handling logic for the issuance process
*/
/>
<Stack.Screen
name={ITW_ROUTES.ISSUANCE.CREDENTIAL_ASYNC_FLOW_CONTINUATION}
component={withItwEnabled(ItwIssuanceCredentialAsyncContinuationScreen)}
options={hiddenHeader}
/>
<Stack.Screen
name={ITW_ROUTES.ISSUANCE.UPCOMING_CREDENTIAL}
component={ItwIssuanceUpcomingCredentialScreen}
Expand Down Expand Up @@ -277,6 +276,17 @@ const InnerNavigator = memo(() => {
component={ItwPresentationEidVerificationExpiredScreen}
options={{ headerShown: false }}
/>
{/* Landing screens from deep links */}
<Stack.Screen
name={ITW_ROUTES.LANDING.CREDENTIAL_ASYNC_FLOW_CONTINUATION}
component={withItwEnabled(ItwIssuanceCredentialAsyncContinuationScreen)}
options={hiddenHeader}
/>
<Stack.Screen
name={ITW_ROUTES.LANDING.EID_REISSUANCE}
component={withItwEnabled(ItwIssuanceEidReissuanceLandingScreen)}
options={hiddenHeader}
/>
{/* Proximity's flow routes */}
<Stack.Group screenOptions={hiddenHeader}>
<Stack.Screen
Expand Down
9 changes: 6 additions & 3 deletions ts/features/itwallet/navigation/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ export const ITW_ROUTES = {
CREDENTIAL_TRUST_ISSUER: "ITW_ISSUANCE_CREDENTIAL_TRUST_ISSUER",
CREDENTIAL_PREVIEW: "ITW_ISSUANCE_CREDENTIAL_PREVIEW",
CREDENTIAL_FAILURE: "ITW_ISSUANCE_CREDENTIAL_FAILURE",
CREDENTIAL_ASYNC_FLOW_CONTINUATION:
"ITW_ISSUANCE_CREDENTIAL_ASYNC_FLOW_CONTINUATION",
UPCOMING_CREDENTIAL: "ITW_ISSUANCE_UPCOMING_CREDENTIAL",
IT_WALLET_INACTIVE: "ITW_ISSUANCE_IT_WALLET_INACTIVE"
} as const,
Expand All @@ -61,5 +59,10 @@ export const ITW_ROUTES = {
PLAYGROUNDS: ITW_PLAYGROUND_ROUTES,
SETTINGS: "ITW_SETTINGS" as const,
IDENTITY_NOT_MATCHING_SCREEN: "ITW_IDENTITY_NOT_MATCHING_SCREEN" as const,
WALLET_REVOCATION_SCREEN: "ITW_WALLET_REVOCATION_SCREEN" as const
WALLET_REVOCATION_SCREEN: "ITW_WALLET_REVOCATION_SCREEN" as const,
LANDING: {
CREDENTIAL_ASYNC_FLOW_CONTINUATION:
"ITW_LANDING_SCREEN_CREDENTIAL_ASYNC_FLOW_CONTINUATION",
EID_REISSUANCE: "ITW_LANDING_SCREEN_EID_REISSUANCE"
} as const
};
3 changes: 2 additions & 1 deletion ts/features/itwallet/navigation/useItwLinkingOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export const useItwLinkingOptions = (): PathConfigMap<AppParamsList> => {
[ITW_ROUTES.MAIN]: {
path: "itw",
screens: {
[ITW_ROUTES.ISSUANCE.CREDENTIAL_ASYNC_FLOW_CONTINUATION]:
[ITW_ROUTES.LANDING.EID_REISSUANCE]: "credential/reissuance/eid",
[ITW_ROUTES.LANDING.CREDENTIAL_ASYNC_FLOW_CONTINUATION]:
"credential/issuance",
[isItwValid
? ITW_ROUTES.DISCOVERY.ALREADY_ACTIVE_SCREEN
Expand Down
Loading