diff --git a/ts/features/onboarding/navigation/routes.ts b/ts/features/onboarding/navigation/routes.ts index 6f4e6cb..f45066f 100644 --- a/ts/features/onboarding/navigation/routes.ts +++ b/ts/features/onboarding/navigation/routes.ts @@ -1,5 +1,5 @@ /** - * Routes configuration for the {@link OnboardingNavigator.tsx} + * Routes configuration for the {@link OnBoardingNavigator.tsx} */ const ONBOARDING_ROUTES = { // Onboarding section diff --git a/ts/features/onboarding/screens/OnboardingCarousel.tsx b/ts/features/onboarding/screens/OnboardingCarousel.tsx index 940bb11..c710c01 100644 --- a/ts/features/onboarding/screens/OnboardingCarousel.tsx +++ b/ts/features/onboarding/screens/OnboardingCarousel.tsx @@ -27,7 +27,7 @@ export const OnboardingCarousel = () => { const {t} = useTranslation(['global', 'onboarding']); const skipCarousel = useCallback(() => { - navigation.navigate('ROOT_ONBOARDING', {screen: 'ONBOARDING_START'}); + navigation.navigate('ROOT_ONBOARDING_NAV', {screen: 'ONBOARDING_START'}); }, [navigation]); const nextStep = useCallback(() => { diff --git a/ts/features/onboarding/screens/OnboardingStart.tsx b/ts/features/onboarding/screens/OnboardingStart.tsx index 938e0d7..1a848a3 100644 --- a/ts/features/onboarding/screens/OnboardingStart.tsx +++ b/ts/features/onboarding/screens/OnboardingStart.tsx @@ -26,7 +26,7 @@ const OnboardingStart = () => { }); const onStartPress = () => - navigation.navigate('ROOT_ONBOARDING', { + navigation.navigate('ROOT_ONBOARDING_NAV', { screen: 'ONBOARDING_PIN_CREATION', params: {isOnboarding: true} }); diff --git a/ts/features/wallet/components/ActivationBanner.tsx b/ts/features/wallet/components/ActivationBanner.tsx index 92db32d..a70e2e0 100644 --- a/ts/features/wallet/components/ActivationBanner.tsx +++ b/ts/features/wallet/components/ActivationBanner.tsx @@ -48,8 +48,8 @@ export const ActivationBanner = ({ action={action} labelClose={labelClose} onPress={() => - navigation.navigate('MAIN_WALLET', { - screen: 'INSTANCE_CREATION' + navigation.navigate('MAIN_WALLET_NAV', { + screen: 'PID_ISSUANCE_INSTANCE_CREATION' }) } onClose={onClose} diff --git a/ts/features/wallet/navigation/WalletNavigator.tsx b/ts/features/wallet/navigation/WalletNavigator.tsx index 8e8a921..3cec934 100644 --- a/ts/features/wallet/navigation/WalletNavigator.tsx +++ b/ts/features/wallet/navigation/WalletNavigator.tsx @@ -1,9 +1,9 @@ import * as React from 'react'; import {createNativeStackNavigator} from '@react-navigation/native-stack'; -import Failure from '../screens/pidIssuance/Failure'; +import PidIssuanceFailure from '../screens/pidIssuance/PidIssuanceFailure'; import WalletInstanceCreation from '../screens/pidIssuance/WalletInstanceCreation'; -import Issuance from '../screens/pidIssuance/Issuance'; -import Success from '../screens/pidIssuance/Success'; +import PidIssuancRequest from '../screens/pidIssuance/PidIssuanceRequest'; +import PidIssuanceSuccess from '../screens/pidIssuance/PidIssuanceSuccess'; import WALLET_ROUTES from './routes'; /** @@ -12,7 +12,7 @@ import WALLET_ROUTES from './routes'; */ export type WalletNavigatorParamsList = { [WALLET_ROUTES.PID_ISSUANCE.INSTANCE_CREATION]: undefined; - [WALLET_ROUTES.PID_ISSUANCE.ISSUANCE]: undefined; + [WALLET_ROUTES.PID_ISSUANCE.REQUEST]: undefined; [WALLET_ROUTES.PID_ISSUANCE.SUCCESS]: undefined; [WALLET_ROUTES.PID_ISSUANCE.FAILURE]: undefined; }; @@ -34,15 +34,15 @@ const WalletNavigator = () => ( /> diff --git a/ts/features/wallet/navigation/routes.ts b/ts/features/wallet/navigation/routes.ts index 5fa739c..ccb4a3b 100644 --- a/ts/features/wallet/navigation/routes.ts +++ b/ts/features/wallet/navigation/routes.ts @@ -3,10 +3,10 @@ */ const WALLET_ROUTES = { PID_ISSUANCE: { - INSTANCE_CREATION: 'INSTANCE_CREATION', - ISSUANCE: 'ISSUANCE', - SUCCESS: 'SUCCESS', - FAILURE: 'FAILURE' + INSTANCE_CREATION: 'PID_ISSUANCE_INSTANCE_CREATION', + REQUEST: 'PID_ISSUANCE_REQUEST', + SUCCESS: 'PID_ISSUANCE_SUCCESS', + FAILURE: 'PID_ISSUANCE_FAILURE' } as const } as const; diff --git a/ts/features/wallet/saga/handleGetAttestation.ts b/ts/features/wallet/saga/handleGetAttestation.ts deleted file mode 100644 index fb17a3a..0000000 --- a/ts/features/wallet/saga/handleGetAttestation.ts +++ /dev/null @@ -1,40 +0,0 @@ -import {call, select} from 'typed-redux-saga'; -import Config from 'react-native-config'; -import { - createCryptoContextFor, - WalletInstanceAttestation -} from '@pagopa/io-react-native-wallet'; -import {regenerateCryptoKey} from '../../../utils/crypto'; -import {WIA_KEYTAG} from '../utils/crypto'; -import {getIntegrityContext} from '../utils/integrity'; -import {createWalletProviderFetch} from '../utils/fetch'; -import {selectSessionId} from '../../../store/reducers/preferences'; - -/** - * Utility generator function to obtain a wallet attestation. - * @param instanceKeyTag - the keytag bound to the wallet instance for which the attestation is requested. - * @returns the attestation for the wallet instance. - * @throws {@link Errors.WalletProviderResponseError} if the wallet provider returns an error. - */ -export function* getAttestation(instanceKeyTag: string) { - const sessionId = yield* select(selectSessionId); - const walletProviderBaseUrl = Config.WALLET_PROVIDER_BASE_URL; - const appFetch = createWalletProviderFetch(walletProviderBaseUrl, sessionId); - - const integrityContext = getIntegrityContext(instanceKeyTag); - // generate Key for Wallet Instance Attestation - // ensure the key esists befor starting the issuing process - yield* call(regenerateCryptoKey, WIA_KEYTAG); - const wiaCryptoContext = createCryptoContextFor(WIA_KEYTAG); - - /** - * Obtains a new Wallet Instance Attestation. - * WARNING: The integrity context must be the same used when creating the Wallet Instance with the same keytag. - */ - return yield* call(WalletInstanceAttestation.getAttestation, { - wiaCryptoContext, - integrityContext, - walletProviderBaseUrl, - appFetch - }); -} diff --git a/ts/features/wallet/saga/pid.ts b/ts/features/wallet/saga/pid.ts index ec4aa87..e7dabf1 100644 --- a/ts/features/wallet/saga/pid.ts +++ b/ts/features/wallet/saga/pid.ts @@ -193,7 +193,7 @@ function* storePidWithIdentification( if (setIdentificationIdentified.match(resAction)) { yield* put(addCredential({credential: action.payload.credential})); yield* put(setLifecycle({lifecycle: Lifecycle.LIFECYCLE_VALID})); - navigate('MAIN_WALLET', {screen: 'SUCCESS'}); + navigate('MAIN_WALLET_NAV', {screen: 'PID_ISSUANCE_SUCCESS'}); } else { return; } diff --git a/ts/features/wallet/screens/pidIssuance/Failure.tsx b/ts/features/wallet/screens/pidIssuance/PidIssuanceFailure.tsx similarity index 94% rename from ts/features/wallet/screens/pidIssuance/Failure.tsx rename to ts/features/wallet/screens/pidIssuance/PidIssuanceFailure.tsx index 259687f..fb461e1 100644 --- a/ts/features/wallet/screens/pidIssuance/Failure.tsx +++ b/ts/features/wallet/screens/pidIssuance/PidIssuanceFailure.tsx @@ -10,7 +10,7 @@ import {useHardwareBackButton} from '../../../../hooks/useHardwareBackButton'; * Filure screen of the pid issuance flow. * Currently it only shows a message and a button to go back to the main screen. */ -const Failure = () => { +const PidIssuanceFailure = () => { const {t} = useTranslation(['global', 'wallet']); const navigation = useNavigation(); const dispatch = useAppDispatch(); @@ -37,4 +37,4 @@ const Failure = () => { ); }; -export default Failure; +export default PidIssuanceFailure; diff --git a/ts/features/wallet/screens/pidIssuance/Issuance.tsx b/ts/features/wallet/screens/pidIssuance/PidIssuanceRequest.tsx similarity index 95% rename from ts/features/wallet/screens/pidIssuance/Issuance.tsx rename to ts/features/wallet/screens/pidIssuance/PidIssuanceRequest.tsx index ee69f55..6c5fe08 100644 --- a/ts/features/wallet/screens/pidIssuance/Issuance.tsx +++ b/ts/features/wallet/screens/pidIssuance/PidIssuanceRequest.tsx @@ -28,7 +28,7 @@ import {addCredentialWithIdentification} from '../../store/credentials'; * A loading screen is shown until the PID is issued, then the user can see a preview of the PID and decide to add it to the wallet. * If the PID issuance fails, the user is redirected to the failure screen. */ -const Issuance = () => { +const PidIssuanceRequest = () => { const {t} = useTranslation(['wallet', 'global']); const navigation = useNavigation(); const dispatch = useAppDispatch(); @@ -41,8 +41,8 @@ const Issuance = () => { useEffect(() => { if (error.status === true) { - navigation.navigate('MAIN_WALLET', { - screen: 'FAILURE' + navigation.navigate('MAIN_WALLET_NAV', { + screen: 'PID_ISSUANCE_FAILURE' }); } }, [error, navigation]); @@ -97,7 +97,7 @@ const Issuance = () => { ); }; -export default Issuance; +export default PidIssuanceRequest; const styles = StyleSheet.create({ scroll: { diff --git a/ts/features/wallet/screens/pidIssuance/Success.tsx b/ts/features/wallet/screens/pidIssuance/PidIssuanceSuccess.tsx similarity index 95% rename from ts/features/wallet/screens/pidIssuance/Success.tsx rename to ts/features/wallet/screens/pidIssuance/PidIssuanceSuccess.tsx index 8022742..cc509bd 100644 --- a/ts/features/wallet/screens/pidIssuance/Success.tsx +++ b/ts/features/wallet/screens/pidIssuance/PidIssuanceSuccess.tsx @@ -10,7 +10,7 @@ import {useAppDispatch} from '../../../../store'; * It currently shows a message and two buttons: one to add the PID to the wallet and one to add it later. * They both redirect to the main screen. */ -const Success = () => { +const PidIssuanceSuccess = () => { const {t} = useTranslation(['wallet']); const navigation = useNavigation(); const dispatch = useAppDispatch(); @@ -40,4 +40,4 @@ const Success = () => { ); }; -export default Success; +export default PidIssuanceSuccess; diff --git a/ts/features/wallet/screens/pidIssuance/WalletInstanceCreation.tsx b/ts/features/wallet/screens/pidIssuance/WalletInstanceCreation.tsx index dded81f..3c53297 100644 --- a/ts/features/wallet/screens/pidIssuance/WalletInstanceCreation.tsx +++ b/ts/features/wallet/screens/pidIssuance/WalletInstanceCreation.tsx @@ -30,8 +30,8 @@ const WalletInstanceCreation = () => { useEffect(() => { if (success.status === true) { - navigation.navigate('MAIN_WALLET', { - screen: 'ISSUANCE' + navigation.navigate('MAIN_WALLET_NAV', { + screen: 'PID_ISSUANCE_REQUEST' }); dispatch(resetInstanceCreation()); } @@ -39,8 +39,8 @@ const WalletInstanceCreation = () => { useEffect(() => { if (error.status === true) { - navigation.navigate('MAIN_WALLET', { - screen: 'FAILURE' + navigation.navigate('MAIN_WALLET_NAV', { + screen: 'PID_ISSUANCE_FAILURE' }); } }, [error, navigation]); diff --git a/ts/navigation/RootStacknavigator.tsx b/ts/navigation/RootStacknavigator.tsx index 9908b1e..ebaa808 100644 --- a/ts/navigation/RootStacknavigator.tsx +++ b/ts/navigation/RootStacknavigator.tsx @@ -23,17 +23,17 @@ import {navigationRef} from './utils'; export type RootStackParamList = { // Main - [ROOT_ROUTES.TAB_NAV]: NavigatorScreenParams; + [ROOT_ROUTES.MAIN_NAV]: NavigatorScreenParams; [ROOT_ROUTES.ERROR]: undefined; [ROOT_ROUTES.LOADING]: undefined; [ROOT_ROUTES.ERROR]: undefined; // Onboarding - [ROOT_ROUTES.ONBOARDING]: NavigatorScreenParams; + [ROOT_ROUTES.ONBOARDING_NAV]: NavigatorScreenParams; // Main navigator when onboarding is completed [MAIN_ROUTES.TAB_NAV]: undefined; - [MAIN_ROUTES.WALLET]: NavigatorScreenParams; + [MAIN_ROUTES.WALLET_NAV]: NavigatorScreenParams; }; const Stack = createNativeStackNavigator(); @@ -68,10 +68,13 @@ export const RootStackNavigator = () => { const getInitialScreen = useCallback((): Screens => { switch (isStartupDone) { case 'DONE': - return {name: ROOT_ROUTES.TAB_NAV, component: MainStackNavigator}; + return {name: ROOT_ROUTES.MAIN_NAV, component: MainStackNavigator}; case 'WAIT_ONBOARDING': - return {name: ROOT_ROUTES.ONBOARDING, component: OnboardingNavigator}; + return { + name: ROOT_ROUTES.ONBOARDING_NAV, + component: OnboardingNavigator + }; case 'ERROR': // An error occurred during startup diff --git a/ts/navigation/main/MainStackNavigator.tsx b/ts/navigation/main/MainStackNavigator.tsx index 6c1476e..08a9f37 100644 --- a/ts/navigation/main/MainStackNavigator.tsx +++ b/ts/navigation/main/MainStackNavigator.tsx @@ -14,7 +14,7 @@ import MAIN_ROUTES from './routes'; */ export type MainNavigatorParamsList = { [MAIN_ROUTES.TAB_NAV]: undefined; - [MAIN_ROUTES.WALLET]: NavigatorScreenParams; + [MAIN_ROUTES.WALLET_NAV]: NavigatorScreenParams; [MAIN_ROUTES.SETTINGS]: undefined; }; @@ -29,7 +29,7 @@ const MainStackNavigator = () => ( initialRouteName={MAIN_ROUTES.TAB_NAV} screenOptions={{headerShown: false}}> - + ); diff --git a/ts/navigation/main/routes.ts b/ts/navigation/main/routes.ts index 1ccb91b..4d0b9e5 100644 --- a/ts/navigation/main/routes.ts +++ b/ts/navigation/main/routes.ts @@ -4,7 +4,7 @@ const MAIN_ROUTES = { // Main section TAB_NAV: 'MAIN_TAB_NAV', - WALLET: 'MAIN_WALLET', + WALLET_NAV: 'MAIN_WALLET_NAV', SETTINGS: 'MAIN_SETTINGS' } as const; diff --git a/ts/navigation/routes.tsx b/ts/navigation/routes.tsx index 43ee77f..6e994ca 100644 --- a/ts/navigation/routes.tsx +++ b/ts/navigation/routes.tsx @@ -3,12 +3,12 @@ */ const ROOT_ROUTES = { // Main section - TAB_NAV: 'ROOT_TAB_NAV', + MAIN_NAV: 'ROOT_MAIN_NAV', ERROR: 'ROOT_ERROR', LOADING: 'ROOT_LOADING', // Onboarding - ONBOARDING: 'ROOT_ONBOARDING' + ONBOARDING_NAV: 'ROOT_ONBOARDING_NAV' } as const; export default ROOT_ROUTES; diff --git a/ts/screens/WalletHome.tsx b/ts/screens/WalletHome.tsx index ef1aec2..dbdcd0d 100644 --- a/ts/screens/WalletHome.tsx +++ b/ts/screens/WalletHome.tsx @@ -25,7 +25,7 @@ const WalletHome = () => { firstAction={{ icon: 'coggle', onPress: () => - navigation.navigate('ROOT_TAB_NAV', {screen: 'MAIN_SETTINGS'}), + navigation.navigate('ROOT_MAIN_NAV', {screen: 'MAIN_SETTINGS'}), accessibilityLabel: t('global:settings.title') }} /> diff --git a/ts/screens/pin/PinCreation.tsx b/ts/screens/pin/PinCreation.tsx index fdde13f..75132ab 100644 --- a/ts/screens/pin/PinCreation.tsx +++ b/ts/screens/pin/PinCreation.tsx @@ -75,19 +75,19 @@ export const PinCreation = () => { */ if (isOnboarding) { if (biometricState === 'Available') { - navigation.navigate('ROOT_ONBOARDING', { + navigation.navigate('ROOT_ONBOARDING_NAV', { screen: 'ONBOARDING_BIOMETRIC_AVAILABLE' }); return; } else { if (!hasDeviceScreenLock) { - navigation.navigate('ROOT_ONBOARDING', { + navigation.navigate('ROOT_ONBOARDING_NAV', { screen: 'ONBOARDING_BIOMETRIC_NO_SCREEN_LOCK' }); return; } if (biometricState === 'NotEnrolled') { - navigation.navigate('ROOT_ONBOARDING', { + navigation.navigate('ROOT_ONBOARDING_NAV', { screen: 'ONBOARDING_BIOMETRIC_NOT_ENROLLED' }); return;