Skip to content

Commit

Permalink
Merge branch 'main' into EUDIW-205-wallet-home
Browse files Browse the repository at this point in the history
  • Loading branch information
LazyAfternoons authored Jan 14, 2025
2 parents 9805f14 + 6df6257 commit 56cae72
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 84 deletions.
2 changes: 1 addition & 1 deletion ts/features/onboarding/navigation/routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Routes configuration for the {@link OnboardingNavigator.tsx}
* Routes configuration for the {@link OnBoardingNavigator.tsx}
*/
const ONBOARDING_ROUTES = {
// Onboarding section
Expand Down
2 changes: 1 addition & 1 deletion ts/features/onboarding/screens/OnboardingCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion ts/features/onboarding/screens/OnboardingStart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const OnboardingStart = () => {
});

const onStartPress = () =>
navigation.navigate('ROOT_ONBOARDING', {
navigation.navigate('ROOT_ONBOARDING_NAV', {
screen: 'ONBOARDING_PIN_CREATION',
params: {isOnboarding: true}
});
Expand Down
4 changes: 2 additions & 2 deletions ts/features/wallet/components/ActivationBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
16 changes: 8 additions & 8 deletions ts/features/wallet/navigation/WalletNavigator.tsx
Original file line number Diff line number Diff line change
@@ -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';

/**
Expand All @@ -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;
};
Expand All @@ -34,15 +34,15 @@ const WalletNavigator = () => (
/>
<Stack.Screen
name={WALLET_ROUTES.PID_ISSUANCE.FAILURE}
component={Failure}
component={PidIssuanceFailure}
/>
<Stack.Screen
name={WALLET_ROUTES.PID_ISSUANCE.ISSUANCE}
component={Issuance}
name={WALLET_ROUTES.PID_ISSUANCE.REQUEST}
component={PidIssuancRequest}
/>
<Stack.Screen
name={WALLET_ROUTES.PID_ISSUANCE.SUCCESS}
component={Success}
component={PidIssuanceSuccess}
/>
</Stack.Group>
</Stack.Navigator>
Expand Down
8 changes: 4 additions & 4 deletions ts/features/wallet/navigation/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
40 changes: 0 additions & 40 deletions ts/features/wallet/saga/handleGetAttestation.ts

This file was deleted.

2 changes: 1 addition & 1 deletion ts/features/wallet/saga/pid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -37,4 +37,4 @@ const Failure = () => {
);
};

export default Failure;
export default PidIssuanceFailure;
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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]);
Expand Down Expand Up @@ -97,7 +97,7 @@ const Issuance = () => {
);
};

export default Issuance;
export default PidIssuanceRequest;

const styles = StyleSheet.create({
scroll: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -40,4 +40,4 @@ const Success = () => {
);
};

export default Success;
export default PidIssuanceSuccess;
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ const WalletInstanceCreation = () => {

useEffect(() => {
if (success.status === true) {
navigation.navigate('MAIN_WALLET', {
screen: 'ISSUANCE'
navigation.navigate('MAIN_WALLET_NAV', {
screen: 'PID_ISSUANCE_REQUEST'
});
dispatch(resetInstanceCreation());
}
}, [success, navigation, dispatch]);

useEffect(() => {
if (error.status === true) {
navigation.navigate('MAIN_WALLET', {
screen: 'FAILURE'
navigation.navigate('MAIN_WALLET_NAV', {
screen: 'PID_ISSUANCE_FAILURE'
});
}
}, [error, navigation]);
Expand Down
13 changes: 8 additions & 5 deletions ts/navigation/RootStacknavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ import {navigationRef} from './utils';

export type RootStackParamList = {
// Main
[ROOT_ROUTES.TAB_NAV]: NavigatorScreenParams<MainNavigatorParamsList>;
[ROOT_ROUTES.MAIN_NAV]: NavigatorScreenParams<MainNavigatorParamsList>;
[ROOT_ROUTES.ERROR]: undefined;
[ROOT_ROUTES.LOADING]: undefined;
[ROOT_ROUTES.ERROR]: undefined;

// Onboarding
[ROOT_ROUTES.ONBOARDING]: NavigatorScreenParams<OnboardingNavigatorParamsList>;
[ROOT_ROUTES.ONBOARDING_NAV]: NavigatorScreenParams<OnboardingNavigatorParamsList>;

// Main navigator when onboarding is completed
[MAIN_ROUTES.TAB_NAV]: undefined;
[MAIN_ROUTES.WALLET]: NavigatorScreenParams<WalletNavigatorParamsList>;
[MAIN_ROUTES.WALLET_NAV]: NavigatorScreenParams<WalletNavigatorParamsList>;
};

const Stack = createNativeStackNavigator<RootStackParamList>();
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ts/navigation/main/MainStackNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import MAIN_ROUTES from './routes';
*/
export type MainNavigatorParamsList = {
[MAIN_ROUTES.TAB_NAV]: undefined;
[MAIN_ROUTES.WALLET]: NavigatorScreenParams<WalletNavigatorParamsList>;
[MAIN_ROUTES.WALLET_NAV]: NavigatorScreenParams<WalletNavigatorParamsList>;
[MAIN_ROUTES.SETTINGS]: undefined;
};

Expand All @@ -29,7 +29,7 @@ const MainStackNavigator = () => (
initialRouteName={MAIN_ROUTES.TAB_NAV}
screenOptions={{headerShown: false}}>
<Stack.Screen name={MAIN_ROUTES.TAB_NAV} component={TabNavigator} />
<Stack.Screen name={MAIN_ROUTES.WALLET} component={WalletNavigator} />
<Stack.Screen name={MAIN_ROUTES.WALLET_NAV} component={WalletNavigator} />
<Stack.Screen name={MAIN_ROUTES.SETTINGS} component={Settings} />
</Stack.Navigator>
);
Expand Down
2 changes: 1 addition & 1 deletion ts/navigation/main/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions ts/navigation/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion ts/screens/WalletHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,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')
}}
/>
Expand Down
6 changes: 3 additions & 3 deletions ts/screens/pin/PinCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 56cae72

Please sign in to comment.