Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: [IOBP-1115] Replace deprecated components and functions for IDPay #6586

Merged
merged 35 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
cbd2aa6
refactor: update idpay headers
LeleDallas Jan 3, 2025
aa3c517
refactor: update idpay headers
LeleDallas Jan 3, 2025
673a994
test: add missing navigation mock function
LeleDallas Jan 3, 2025
0464b64
refactor: update radio/switch components
LeleDallas Jan 3, 2025
3e899d7
refactor: removed deprecated nav screen
LeleDallas Jan 7, 2025
1ea295b
refactor: removed reanimated deprecation
LeleDallas Jan 7, 2025
483f90d
refactor: FooterActions from design system
LeleDallas Jan 7, 2025
12ac51b
test: replace deprecated functions
LeleDallas Jan 7, 2025
5e8f5ad
refactor: replace deprecated scroll view
LeleDallas Jan 7, 2025
a803b46
refactor: using IOScrollViewWithLargeHeader
LeleDallas Jan 7, 2025
2c6e49b
refactor: update idpay configuration scrollview types
LeleDallas Jan 7, 2025
3cd40af
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 8, 2025
1b9fee4
refactor: update idpay code scrollview
LeleDallas Jan 8, 2025
04c5b2a
refactor: update idpay onboarding scrollview
LeleDallas Jan 8, 2025
da3b762
refactor: update idpay barcode screen scrollview
LeleDallas Jan 8, 2025
9bca3c2
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 8, 2025
d57c900
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 9, 2025
d023e9c
test: apply getAllByText as the element appears multiple times
LeleDallas Jan 9, 2025
4e961c3
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 9, 2025
7d1891d
refactor: replace custom radio with RadioGroup
LeleDallas Jan 9, 2025
b4468ce
Merge branch 'IOBP-1094-update-radio-button-for-idpay' into IOBP-1115…
LeleDallas Jan 9, 2025
4e9b4d1
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 10, 2025
f01f6e0
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 10, 2025
1d64f79
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 10, 2025
e82a082
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 13, 2025
aac0bb6
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 13, 2025
e15420f
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 15, 2025
6f03a07
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 15, 2025
0badea1
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 15, 2025
ba30881
Merge branch 'IOBP-1094-update-radio-button-for-idpay' into IOBP-1115…
LeleDallas Jan 15, 2025
6e6df0b
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 15, 2025
19338e7
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 15, 2025
49ee21c
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 16, 2025
8057041
refactor: hide header for outcome screen
LeleDallas Jan 16, 2025
236aa7d
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: update idpay onboarding scrollview
Remove old footer action button
LeleDallas committed Jan 8, 2025

Verified

This commit was signed with the committer’s verified signature.
darkdh Anthony Tseng
commit 04c5b2a392ace8b6ad5768ce8a72dbc9f7467420
2 changes: 1 addition & 1 deletion ts/features/idpay/onboarding/navigation/navigator.tsx
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ export const InnerNavigator = () => {
initialRouteName={
IdPayOnboardingRoutes.IDPAY_ONBOARDING_INITIATIVE_DETAILS
}
screenOptions={{ gestureEnabled: isGestureEnabled, headerShown: false }}
screenOptions={{ gestureEnabled: isGestureEnabled }}
screenListeners={{
beforeRemove: () => {
// Read more on https://reactnavigation.org/docs/preventing-going-back/
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
import {
Body,
FooterActionsInline,
H2,
ListItemSwitch,
VSpacer
} from "@pagopa/io-app-design-system";
import { Divider, ListItemSwitch } from "@pagopa/io-app-design-system";
import React from "react";
import { View } from "react-native";
import { ScrollView } from "react-native-gesture-handler";
import { SelfDeclarationBoolDTO } from "../../../../../definitions/idpay/SelfDeclarationBoolDTO";
import LoadingSpinnerOverlay from "../../../../components/LoadingSpinnerOverlay";
import { IOStyles } from "../../../../components/core/variables/IOStyles";
import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel";
import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader";
import I18n from "../../../../i18n";
import { dpr28Dec2000Url } from "../../../../urls";
import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp";
@@ -49,53 +41,52 @@ const InitiativeSelfDeclarationsScreen = () => {
const getSelfCriteriaBoolAnswer = (criteria: SelfDeclarationBoolDTO) =>
selfCriteriaBoolAnswers[criteria.code] ?? false;

useHeaderSecondLevel({
title: I18n.t("idpay.onboarding.navigation.header"),
contextualHelp: emptyContextualHelp,
goBack: goBackOnPress,
supportRequest: true
});

return (
<LoadingSpinnerOverlay isLoading={isLoading}>
<ScrollView contentContainerStyle={{ flexGrow: 1 }}>
<View style={IOStyles.horizontalContentPadding}>
<H2>{I18n.t("idpay.onboarding.boolPrerequisites.header")}</H2>
<VSpacer size={16} />
<Body>{I18n.t("idpay.onboarding.boolPrerequisites.body")}</Body>
<Body
weight="Semibold"
asLink
onPress={() => openWebUrl(dpr28Dec2000Url)}
>
{I18n.t("idpay.onboarding.boolPrerequisites.link")}
</Body>
<VSpacer size={24} />
{selfCriteriaBool.map(criteria => (
<View key={criteria.code}>
<ListItemSwitch
label={criteria.description}
onSwitchValueChange={toggleCriteria(criteria)}
value={getSelfCriteriaBoolAnswer(criteria)}
/>
<VSpacer size={16} />
</View>
))}
</View>
</ScrollView>
<FooterActionsInline
startAction={{
color: "primary",
label: I18n.t("global.buttons.back"),
onPress: goBackOnPress
}}
endAction={{
<IOScrollViewWithLargeHeader
title={{
label: I18n.t("idpay.onboarding.boolPrerequisites.header"),
section: I18n.t("idpay.onboarding.navigation.header")
}}
description={[
{
text: I18n.t("idpay.onboarding.boolPrerequisites.body")
},
{
text: "\n"
},
{
text: I18n.t("idpay.onboarding.boolPrerequisites.link"),
weight: "Semibold",
asLink: true,
onPress: () => openWebUrl(dpr28Dec2000Url)
}
]}
goBack={goBackOnPress}
contextualHelp={emptyContextualHelp}
headerActionsProp={{ showHelp: true }}
actions={{
type: "SingleButton",
primary: {
label: I18n.t("global.buttons.continue"),
onPress: continueOnPress,
disabled: !areAllSelfCriteriaBoolAccepted
}}
/>
</LoadingSpinnerOverlay>
}
}}
includeContentMargins
>
<LoadingSpinnerOverlay isLoading={isLoading}>
{selfCriteriaBool.map((criteria, index) => (
<View key={criteria.code}>
<ListItemSwitch
label={criteria.description}
onSwitchValueChange={toggleCriteria(criteria)}
value={getSelfCriteriaBoolAnswer(criteria)}
/>
{index !== selfCriteriaBool.length - 1 && <Divider />}
</View>
))}
</LoadingSpinnerOverlay>
</IOScrollViewWithLargeHeader>
);
};

Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
/* eslint-disable no-underscore-dangle */
import {
Body,
FooterActionsInline,
H1,
H6,
IOColors,
IOStyles,
Icon,
PressableListItemBase,
VSpacer
PressableListItemBase
} from "@pagopa/io-app-design-system";
import { default as React } from "react";
import { ScrollView, StyleSheet, View } from "react-native";
import { StyleSheet, View } from "react-native";
import PagerView from "react-native-pager-view";
import { SelfDeclarationMultiDTO } from "../../../../../definitions/idpay/SelfDeclarationMultiDTO";
import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel";
import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader";
import I18n from "../../../../i18n";
import { IdPayOnboardingMachineContext } from "../machine/provider";
import {
@@ -87,49 +83,50 @@ const MultiValuePrerequisiteItemScreenContent = ({
};
const handleGoBack = () => machine.send({ type: "back" });

useHeaderSecondLevel({
title: I18n.t("idpay.onboarding.headerTitle"),
goBack: handleGoBack
});

return (
<>
<View style={IOStyles.horizontalContentPadding}>
<H1>{I18n.t("idpay.onboarding.multiPrerequisites.header")}</H1>
<VSpacer size={16} />
<Body>{I18n.t("idpay.onboarding.multiPrerequisites.body")}</Body>
{/* TODO: Add a proper `onPress` function to the following link.
It was a `<Link>` without anything else before */}
{/* eslint-disable-next-line @typescript-eslint/no-empty-function */}
<Body weight="Semibold" asLink onPress={() => {}}>
{I18n.t("idpay.onboarding.multiPrerequisites.link")}
</Body>
<VSpacer size={24} />
<H6>{selfDeclaration.description}</H6>
<ScrollView>
{selfDeclaration.value.map((answer, index) => (
<CustomListItem
key={index}
text={answer}
checked={index === selectedIndex}
onPress={() => setSelectedIndex(index)}
/>
))}
</ScrollView>
</View>
<FooterActionsInline
startAction={{
color: "primary",
onPress: handleGoBack,
label: I18n.t("global.buttons.back")
}}
endAction={{
<IOScrollViewWithLargeHeader
title={{
label: I18n.t("idpay.onboarding.multiPrerequisites.header"),
section: I18n.t("idpay.onboarding.headerTitle")
}}
goBack={handleGoBack}
includeContentMargins
actions={{
type: "SingleButton",
primary: {
onPress: handleContinuePress,
disabled: selectedIndex === undefined,
label: I18n.t("global.buttons.continue")
}}
/>
</>
}
}}
description={[
{
text: I18n.t("idpay.onboarding.multiPrerequisites.body")
},
{
text: "\n"
},
{
// TODO: Add a proper `onPress` function to the following link.
// It was a `<Link>` without anything else before
text: I18n.t("idpay.onboarding.multiPrerequisites.link"),
weight: "Semibold",
asLink: true,
// eslint-disable-next-line @typescript-eslint/no-empty-function
onPress: () => {}
}
]}
>
<H6>{selfDeclaration.description}</H6>
{selfDeclaration.value.map((answer, index) => (
<CustomListItem
key={index}
text={answer}
checked={index === selectedIndex}
onPress={() => setSelectedIndex(index)}
/>
))}
</IOScrollViewWithLargeHeader>
);
};

95 changes: 35 additions & 60 deletions ts/features/idpay/onboarding/screens/PDNDPrerequisitesScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import {
Body,
ButtonSolid,
ContentWrapper,
FooterActionsInline,
H2,
ModuleSummary,
VSpacer
} from "@pagopa/io-app-design-system";
import * as pot from "@pagopa/ts-commons/lib/pot";
import * as O from "fp-ts/lib/Option";
import { pipe } from "fp-ts/lib/function";
import React from "react";
import { ScrollView, StyleSheet, View } from "react-native";
import { ServiceId } from "../../../../../definitions/backend/ServiceId";
import { IOStyles } from "../../../../components/core/variables/IOStyles";
import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader";
import LegacyMarkdown from "../../../../components/ui/Markdown/LegacyMarkdown";
import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel";
import I18n from "../../../../i18n";
import { useIOSelector } from "../../../../store/hooks";
import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp";
@@ -25,12 +20,6 @@ import { IdPayOnboardingMachineContext } from "../machine/provider";
import { pdndCriteriaSelector, selectServiceId } from "../machine/selectors";
import { getPDNDCriteriaDescription } from "../utils/strings";

const styles = StyleSheet.create({
listContainer: {
marginTop: 24
}
});

export const PDNDPrerequisitesScreen = () => {
const { useActorRef, useSelector } = IdPayOnboardingMachineContext;
const machine = useActorRef();
@@ -89,58 +78,44 @@ export const PDNDPrerequisitesScreen = () => {

const pdndCriteria = useSelector(pdndCriteriaSelector);

useHeaderSecondLevel({
title: I18n.t("idpay.onboarding.navigation.header"),
contextualHelp: emptyContextualHelp,
goBack: goBackOnPress,
supportRequest: true
});

return (
<>
<ScrollView>
<View style={IOStyles.horizontalContentPadding}>
<VSpacer size={16} />
<H2>{I18n.t("idpay.onboarding.PDNDPrerequisites.title")}</H2>
<VSpacer size={16} />
<Body>
{I18n.t("idpay.onboarding.PDNDPrerequisites.subtitle", {
service: serviceName
})}
</Body>
</View>
<View style={[IOStyles.horizontalContentPadding, styles.listContainer]}>
{pdndCriteria.map((criteria, index) => (
<React.Fragment key={index}>
<ModuleSummary
label={I18n.t(
`idpay.onboarding.PDNDPrerequisites.code.${criteria.code}`
)}
description={getPDNDCriteriaDescription(criteria)}
onPress={() => {
setAuthority(criteria.authority);
present();
}}
/>
<VSpacer size={16} />
</React.Fragment>
))}
</View>
</ScrollView>
<FooterActionsInline
startAction={{
color: "primary",
label: I18n.t("global.buttons.back"),
onPress: goBackOnPress
}}
endAction={{
color: "primary",
<IOScrollViewWithLargeHeader
includeContentMargins
title={{
label: I18n.t("idpay.onboarding.PDNDPrerequisites.title"),
section: I18n.t("idpay.onboarding.navigation.header")
}}
description={I18n.t("idpay.onboarding.PDNDPrerequisites.subtitle", {
service: serviceName
})}
actions={{
type: "SingleButton",
primary: {
label: I18n.t("global.buttons.continue"),
onPress: continueOnPress
}}
/>
}
}}
goBack={goBackOnPress}
contextualHelp={emptyContextualHelp}
headerActionsProp={{ showHelp: true }}
>
{pdndCriteria.map((criteria, index) => (
<React.Fragment key={index}>
<ModuleSummary
label={I18n.t(
`idpay.onboarding.PDNDPrerequisites.code.${criteria.code}`
)}
description={getPDNDCriteriaDescription(criteria)}
onPress={() => {
setAuthority(criteria.authority);
present();
}}
/>
<VSpacer size={16} />
</React.Fragment>
))}
{bottomSheet}
</>
</IOScrollViewWithLargeHeader>
);
};


Unchanged files with check annotations Beta

setGenericPassword: jest.fn(
(username: string, password: string, options: Options) => {
// eslint-disable-next-line

Check warning on line 31 in ts/__mocks__/react-native-keychain.ts

GitHub Actions / static-checks

Unexpected unlimited 'eslint-disable-next-line' comment. Specify some rule names to disable
keychainDB[options.service] = {
username,
password,
resetGenericPassword: jest.fn((options: Options | undefined) => {
if (options) {
// eslint-disable-next-line

Check warning on line 43 in ts/__mocks__/react-native-keychain.ts

GitHub Actions / static-checks

Unexpected unlimited 'eslint-disable-next-line' comment. Specify some rule names to disable
delete keychainDB[options.service];
}
return Promise.resolve(true);
const getServiceT: GetServiceT = {
method: "get",
url: params => `/api/v1/services/${params.service_id}`,
query: _ => ({}),

Check warning on line 157 in ts/api/backend.ts

GitHub Actions / static-checks

'_' is already declared in the upper scope on line 17 column 8
headers: tokenHeaderProducer,
response_decoder: getServiceDefaultDecoder()
};
const getServicePreferenceT: GetServicePreferencesT = {
method: "get",
url: params => `/api/v1/services/${params.service_id}/preferences`,
query: _ => ({}),

Check warning on line 165 in ts/api/backend.ts

GitHub Actions / static-checks

'_' is already declared in the upper scope on line 17 column 8
headers: tokenHeaderProducer,
response_decoder: getServicePreferencesDefaultDecoder()
};
method: "post",
url: params => `/api/v1/services/${params.service_id}/preferences`,
headers: composeHeaderProducers(tokenHeaderProducer, ApiHeaderJson),
query: _ => ({}),

Check warning on line 174 in ts/api/backend.ts

GitHub Actions / static-checks

'_' is already declared in the upper scope on line 17 column 8
body: body => JSON.stringify(body.body),
response_decoder: upsertServicePreferencesDefaultDecoder()
};
const getMessagesT: GetUserMessagesT = {
method: "get",
url: _ => "/api/v1/messages",

Check warning on line 181 in ts/api/backend.ts

GitHub Actions / static-checks

'_' is already declared in the upper scope on line 17 column 8
query: params => {
const {
maximum_id,
method: "get",
url: ({ id }) => `/api/v1/third-party-messages/${id}`,
headers: composeHeaderProducers(tokenHeaderProducer, ApiHeaderJson),
query: _ => ({}),

Check warning on line 225 in ts/api/backend.ts

GitHub Actions / static-checks

'_' is already declared in the upper scope on line 17 column 8
response_decoder: getThirdPartyMessageDefaultDecoder()
};
const getThirdPartyMessagePreconditionT: GetThirdPartyMessagePreconditionT = {
method: "get",
url: ({ id }) => `/api/v1/third-party-messages/${id}/precondition`,
query: _ => ({}),

Check warning on line 232 in ts/api/backend.ts

GitHub Actions / static-checks

'_' is already declared in the upper scope on line 17 column 8
headers: composeHeaderProducers(tokenHeaderProducer, ApiHeaderJson),
response_decoder: getThirdPartyMessagePreconditionDefaultDecoder()
};
const upsertMessageStatusAttributesT: UpsertMessageStatusAttributesT = {
method: "put",
url: params => `/api/v1/messages/${params.id}/message-status`,
query: _ => ({}),

Check warning on line 240 in ts/api/backend.ts

GitHub Actions / static-checks

'_' is already declared in the upper scope on line 17 column 8
body: params => JSON.stringify(params.body),
headers: composeHeaderProducers(tokenHeaderProducer, ApiHeaderJson),
response_decoder: upsertMessageStatusAttributesDefaultDecoder()
const getProfileT: GetUserProfileT = {
method: "get",
url: () => "/api/v1/profile",
query: _ => ({}),

Check warning on line 249 in ts/api/backend.ts

GitHub Actions / static-checks

'_' is already declared in the upper scope on line 17 column 8
headers: tokenHeaderProducer,
response_decoder: getUserProfileDefaultDecoder()
};