Skip to content

Commit ea62db0

Browse files
LeleDallasHantex9
andauthored
feat: [IOBP-1890] IDPay onboarding loading screen (#7211)
## Short description This pull request introduces a new loading screen to the IDPay onboarding flow. This screen will be displayed before the final onboarding outcome ## List of changes proposed in this pull request - `navigateToLoadingScreen` action to the onboarding actions implementation to navigate to the loading screen - Implemented the `IdPayLoadingScreen` component, which displays a loading indicator and triggers a transition once the loading state is complete - Added a new state (`OnLoading`) to the IDPay onboarding state machine, including transitions and entry actions (`navigateToLoadingScreen`) - Update IDPay stack navigator and routes - Fix error outcome navigation with a new event `check-details` to go inside initiative details if already onboarded ## How to test - Try to onboard an initiative - Ensure that before successful/failure outcome, a loading screen is appearing ## Preview | Error outcome | Success outcome| |--------|--------| | <video src="https://github.com/user-attachments/assets/2bfd9897-5f75-47ef-810a-8de866711e5b"/> |<video src="https://github.com/user-attachments/assets/5d68b675-bf80-4fe7-940c-65f08f1cab70"/>| --------- Co-authored-by: Alessandro <[email protected]>
1 parent 8c30ff8 commit ea62db0

File tree

11 files changed

+66
-5
lines changed

11 files changed

+66
-5
lines changed

locales/de/index.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4130,6 +4130,10 @@
41304130
"deny": "Non attivare",
41314131
"success": "Sie aktivierten Push -Benachrichtigungen",
41324132
"advice": "Consigliato"
4133+
},
4134+
"loading": {
4135+
"subtitle": "Attendi qualche secondo",
4136+
"title": "Stiamo elaborando la tua richiesta"
41334137
}
41344138
}
41354139
}

locales/en/index.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5819,6 +5819,10 @@
58195819
"deny": "Non attivare",
58205820
"success": "You activated Push notifications",
58215821
"advice": "Consigliato"
5822+
},
5823+
"loading": {
5824+
"subtitle": "Attendi qualche secondo",
5825+
"title": "Stiamo elaborando la tua richiesta"
58225826
}
58235827
},
58245828
"configuration": {

locales/it/index.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5819,6 +5819,10 @@
58195819
"deny": "Non attivare",
58205820
"success": "Hai attivato le notifiche push",
58215821
"advice": "Consigliato"
5822+
},
5823+
"loading": {
5824+
"subtitle": "Attendi qualche secondo",
5825+
"title": "Stiamo elaborando la tua richiesta"
58225826
}
58235827
},
58245828
"configuration": {

ts/features/idpay/onboarding/machine/actions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ export const createActionsImplementation = (
7575
const closeOnboardingSuccess = () =>
7676
navigation.navigate(SERVICES_ROUTES.SERVICES_HOME);
7777

78+
const navigateToLoadingScreen = () =>
79+
navigation.navigate(IdPayOnboardingRoutes.IDPAY_ONBOARDING_MAIN, {
80+
screen: IdPayOnboardingRoutes.IDPAY_ONBOARDING_LOADING
81+
});
82+
7883
const handleSessionExpired = () => {
7984
dispatch(
8085
refreshSessionToken.request({
@@ -96,6 +101,7 @@ export const createActionsImplementation = (
96101
navigateToInputFormScreen,
97102
navigateToEnableNotificationScreen,
98103
navigateToEnableMessageScreen,
104+
navigateToLoadingScreen,
99105
closeOnboarding,
100106
closeOnboardingSuccess,
101107
handleSessionExpired

ts/features/idpay/onboarding/machine/events.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ export type UpdatePushNotificationSetting = {
4040
readonly isPushNotificationEnabled: boolean;
4141
};
4242

43+
export type CheckDetails = {
44+
readonly type: "check-details";
45+
};
46+
4347
export type IdPayOnboardingEvents =
4448
| StartOnboarding
4549
| SelectMultiConsent
@@ -48,4 +52,5 @@ export type IdPayOnboardingEvents =
4852
| Next
4953
| Back
5054
| Close
51-
| UpdatePushNotificationSetting;
55+
| UpdatePushNotificationSetting
56+
| CheckDetails;

ts/features/idpay/onboarding/machine/machine.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export const idPayOnboardingMachine = setup({
3838
handleSessionExpired: notImplementedStub,
3939
navigateToInputFormScreen: notImplementedStub,
4040
navigateToEnableNotificationScreen: notImplementedStub,
41-
navigateToEnableMessageScreen: notImplementedStub
41+
navigateToEnableMessageScreen: notImplementedStub,
42+
navigateToLoadingScreen: notImplementedStub
4243
},
4344
actors: {
4445
getInitiativeInfo: fromPromise<InitiativeDataDTO, string>(
@@ -512,6 +513,7 @@ export const idPayOnboardingMachine = setup({
512513
},
513514

514515
AcceptingCriteria: {
516+
entry: "navigateToLoadingScreen",
515517
tags: [IdPayTags.Loading],
516518
invoke: {
517519
src: "acceptRequiredCriteria",
@@ -576,7 +578,7 @@ export const idPayOnboardingMachine = setup({
576578
OnboardingFailure: {
577579
entry: "navigateToFailureScreen",
578580
on: {
579-
next: {
581+
"check-details": {
580582
actions: "navigateToInitiativeMonitoringScreen"
581583
}
582584
}

ts/features/idpay/onboarding/navigation/navigator.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import IdPayEnableNotificationScreen from "../screens/IdPayEnableNotificationScr
1111
import IdPayFailureScreen from "../screens/IdPayFailureScreen";
1212
import { IdPayInitiativeDetailsScreen } from "../screens/IdPayInitiativeDetailsScreen";
1313
import IdPayInputFormVerificationScreen from "../screens/IdPayInputFormVerificationScreen";
14+
import IdPayLoadingScreen from "../screens/IdPayLoadingScreen";
1415
import IdPayMultiValuePrerequisitesScreen from "../screens/IdPayMultiValuePrerequisitesScreen";
1516
import IdPayPDNDPrerequisitesScreen from "../screens/IdPayPDNDPrerequisitesScreen";
1617
import { IdPayOnboardingParamsList } from "./params";
@@ -82,6 +83,12 @@ export const InnerNavigator = () => {
8283
component={IdPayFailureScreen}
8384
options={{ gestureEnabled: false, headerShown: false }}
8485
/>
86+
87+
<Stack.Screen
88+
name={IdPayOnboardingRoutes.IDPAY_ONBOARDING_LOADING}
89+
component={IdPayLoadingScreen}
90+
options={{ gestureEnabled: false, headerShown: false }}
91+
/>
8592
</Stack.Navigator>
8693
);
8794
};

ts/features/idpay/onboarding/navigation/params.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ export type IdPayOnboardingParamsList = {
1111
[IdPayOnboardingRoutes.IDPAY_ONBOARDING_MULTI_SELF_DECLARATIONS]: undefined;
1212
[IdPayOnboardingRoutes.IDPAY_ONBOARDING_INPUT_FORM]: undefined;
1313
[IdPayOnboardingRoutes.IDPAY_ONBOARDING_ENABLE_NOTIFICATIONS]: undefined;
14+
[IdPayOnboardingRoutes.IDPAY_ONBOARDING_LOADING]: undefined;
1415
};

ts/features/idpay/onboarding/navigation/routes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ export const IdPayOnboardingRoutes = {
99
IDPAY_ONBOARDING_MULTI_SELF_DECLARATIONS:
1010
"IDPAY_ONBOARDING_MULTI_SELF_DECLARATIONS",
1111
IDPAY_ONBOARDING_INPUT_FORM: "IDPAY_ONBOARDING_INPUT_FORM",
12-
IDPAY_ONBOARDING_ENABLE_NOTIFICATIONS: "IDPAY_ONBOARDING_ENABLE_NOTIFICATIONS"
12+
IDPAY_ONBOARDING_ENABLE_NOTIFICATIONS:
13+
"IDPAY_ONBOARDING_ENABLE_NOTIFICATIONS",
14+
IDPAY_ONBOARDING_LOADING: "IDPAY_ONBOARDING_LOADING"
1315
} as const;

ts/features/idpay/onboarding/screens/IdPayFailureScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const IdPayFailureScreen = () => {
3131
accessibilityLabel: I18n.t(
3232
"idpay.onboarding.failure.button.goToInitiative"
3333
),
34-
onPress: () => machine.send({ type: "next" })
34+
onPress: () => machine.send({ type: "check-details" })
3535
}),
3636
[machine]
3737
);

0 commit comments

Comments
 (0)