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

[SIW-1455] Reissuing expired or expiring eID #6580

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
aa53709
feat: reissuing eid
RiccardoMolinari95 Dec 23, 2024
a0f6f55
refactor: prettify
RiccardoMolinari95 Dec 23, 2024
38afaa3
refactor: reintroduced store of real eid and credential and not mocked
RiccardoMolinari95 Dec 23, 2024
503d15d
test: add test eid reissuing
RiccardoMolinari95 Dec 23, 2024
4daa05b
test: add tests for back button in UserIdentification: ModeSelection
RiccardoMolinari95 Dec 23, 2024
903cb6c
refactor: prettify
RiccardoMolinari95 Dec 23, 2024
d9f0a5c
Merge commit '80d7bd563c8810002384c28a4677de923403bbd2' into SIW-1455…
RiccardoMolinari95 Dec 24, 2024
50f94fa
fix lint
RiccardoMolinari95 Dec 24, 2024
1ba545e
chore: check wia before start eid reisuuing flow
RiccardoMolinari95 Jan 3, 2025
c517752
refactor: deleted assignWalletInstanceAttestationToContext action
RiccardoMolinari95 Jan 3, 2025
d12f249
fix: lint
RiccardoMolinari95 Jan 3, 2025
e8d82be
chore:prettify
RiccardoMolinari95 Jan 3, 2025
7f44f95
test: fix
RiccardoMolinari95 Jan 3, 2025
1159e10
Merge branch 'master' into SIW-1455-credential-expiry-and-reissuing
RiccardoMolinari95 Jan 7, 2025
ef32d1f
Merge branch 'master' into SIW-1455-credential-expiry-and-reissuing
RiccardoMolinari95 Jan 8, 2025
2ca518f
refactor: screen props in ItwIdentificationModeSelectionScreen
RiccardoMolinari95 Jan 8, 2025
decb8ab
chore: prettify
RiccardoMolinari95 Jan 8, 2025
b72bffd
chore: deleted console log
RiccardoMolinari95 Jan 8, 2025
95f5372
test: fix ItwIdentificationModeSelectionScreen test
RiccardoMolinari95 Jan 8, 2025
d19bcf8
test: removed unused prop
RiccardoMolinari95 Jan 8, 2025
9cba6a7
Merge branch 'master' into SIW-1455-credential-expiry-and-reissuing
RiccardoMolinari95 Jan 8, 2025
c2d1773
Merge branch 'master' into SIW-1455-credential-expiry-and-reissuing
RiccardoMolinari95 Jan 8, 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
8 changes: 8 additions & 0 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3482,6 +3482,7 @@ features:
valid: L'ultima verifica è del {{date}}.
expiring: Verifica la tua identità entro il {{date}}.
expired: È necessario un rapido passaggio di verifica per continuare a usare Documenti su IO.
action: Inizia
MDL:
expiring:
title: "Patente su IO: documento in scadenza"
Expand Down Expand Up @@ -3535,6 +3536,13 @@ features:
openPdf: "Show document"
shareButton: Save or share
fiscalCode: Your Fiscal Code
eid:
verificationExpired:
title: Verifica la tua identità
contentStart: "È un passaggio di sicurezza necessario per continuare ad usare "
contentBold: Documenti su IO
contentEnd: "."
primaryAction: Inizia
trustmark:
cta: Mostra certificato di autenticità
description: Mostra il QR Code per attestare l’autenticità del documento quando ti viene richiesto.
Expand Down
8 changes: 8 additions & 0 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3482,6 +3482,7 @@ features:
valid: L'ultima verifica è del {{date}}.
expiring: Verifica la tua identità entro il {{date}}.
expired: È necessario un rapido passaggio di verifica per continuare a usare Documenti su IO.
action: Inizia
MDL:
expiring:
title: "Patente su IO: documento in scadenza"
Expand Down Expand Up @@ -3535,6 +3536,13 @@ features:
openPdf: "Mostra documento"
shareButton: Salva o condividi
fiscalCode: Il tuo Codice Fiscale
eid:
verificationExpired:
title: Verifica la tua identità
contentStart: "È un passaggio di sicurezza necessario per continuare ad usare "
contentBold: Documenti su IO
contentEnd: "."
primaryAction: Inizia
trustmark:
cta: Mostra certificato di autenticità
description: Mostra il QR Code per attestare l’autenticità del documento quando ti viene richiesto.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const ItwEidInfoBottomSheetContent = ({
</React.Fragment>
))}
</View>
<ItwEidLifecycleAlert />
<ItwEidLifecycleAlert navigation={navigation} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the useIONavigation hook inside the component instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some problems using useIONavigation inside the ItwEidLifecycleAlert component, so I preferred to pass it from the parent component to ItwEidLifecycleAlert as a prop since it was already available.
Let me know if this is okay for you, or if you would like me to try integrating it directly into ItwEidLifecycleAlert

<IOMarkdown
content={I18n.t(
"features.itWallet.presentation.bottomSheets.eidInfo.contentBottom"
Expand Down
27 changes: 24 additions & 3 deletions ts/features/itwallet/common/components/ItwEidLifecycleAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
ItwJwtCredentialStatus,
StoredCredential
} from "../utils/itwTypesUtils";
import { useIONavigation } from "../../../../navigation/params/AppParamsList";
import { ITW_ROUTES } from "../../navigation/routes";

const defaultLifecycleStatus: Array<ItwJwtCredentialStatus> = [
"valid",
Expand All @@ -27,17 +29,28 @@ type Props = {
* The eID statuses that will render the alert.
*/
lifecycleStatus?: Array<ItwJwtCredentialStatus>;
navigation: ReturnType<typeof useIONavigation>;
};

/**
* This component renders an alert that displays information on the eID status.
*/
export const ItwEidLifecycleAlert = ({
lifecycleStatus = defaultLifecycleStatus
lifecycleStatus = defaultLifecycleStatus,
navigation
}: Props) => {
const eidOption = useIOSelector(itwCredentialsEidSelector);
const maybeEidStatus = useIOSelector(itwCredentialsEidStatusSelector);

const startEidReissuing = () => {
navigation.navigate(ITW_ROUTES.MAIN, {
screen: ITW_ROUTES.IDENTIFICATION.MODE_SELECTION,
params: {
eidReissuing: true
}
});
};

const Content = ({
eid,
eidStatus
Expand Down Expand Up @@ -73,14 +86,22 @@ export const ItwEidLifecycleAlert = ({
{
date: format(eid.jwt.expiration, "DD-MM-YYYY")
}
)
),
action: I18n.t(
"features.itWallet.presentation.bottomSheets.eidInfo.alert.action"
),
onPress: startEidReissuing
},
jwtExpired: {
testID: "itwEidLifecycleAlertTestID_jwtExpired",
variant: "error",
content: I18n.t(
"features.itWallet.presentation.bottomSheets.eidInfo.alert.expired"
)
),
action: I18n.t(
"features.itWallet.presentation.bottomSheets.eidInfo.alert.action"
),
onPress: startEidReissuing
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,19 @@ import {
import { itwDisabledIdentificationMethodsSelector } from "../../../../store/reducers/backendStatus/remoteConfig";
import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader";
import { isCIEAuthenticationSupportedSelector } from "../../machine/eid/selectors";
import { IOStackNavigationRouteProps } from "../../../../navigation/params/AppParamsList";
import { ItwParamsList } from "../../navigation/ItwParamsList";

export const ItwIdentificationModeSelectionScreen = () => {
export type ItwIdentificationModeSelectionScreenNavigationParams = {
eidReissuing?: boolean;
};

type ScreenProps = IOStackNavigationRouteProps<
ItwParamsList,
"ITW_IDENTIFICATION_MODE_SELECTION"
>;

export const ItwIdentificationModeSelectionScreen = (params: ScreenProps) => {
const machineRef = ItwEidIssuanceMachineContext.useActorRef();
const isCieAuthenticationSupported = ItwEidIssuanceMachineContext.useSelector(
isCIEAuthenticationSupportedSelector
Expand All @@ -45,6 +56,16 @@ export const ItwIdentificationModeSelectionScreen = () => {
[isCieAuthenticationSupported]
);

const { eidReissuing } = params.route.params;

useFocusEffect(
useCallback(() => {
if (eidReissuing) {
machineRef.send({ type: "start-reissuing" });
}
}, [eidReissuing, machineRef])
);

useFocusEffect(trackItWalletIDMethod);

const handleSpidPress = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { ItwEidIssuanceMachineContext } from "../../../machine/provider";
import { itwEidIssuanceMachine } from "../../../machine/eid/machine";
import { ItwLifecycleState } from "../../../lifecycle/store/reducers";
import { ToolEnum } from "../../../../../../definitions/content/AssistanceToolConfig";
import { IOStackNavigationProp } from "../../../../../navigation/params/AppParamsList";
import { ItwParamsList } from "../../../navigation/ItwParamsList";

jest.mock("../../../../../config", () => ({
itwEnabled: true
Expand Down Expand Up @@ -128,10 +130,29 @@ describe("ItwIdentificationModeSelectionScreen", () => {
}
});

const mockNavigation = new Proxy(
{},
{
get: _ => jest.fn()
}
) as unknown as IOStackNavigationProp<
ItwParamsList,
"ITW_IDENTIFICATION_MODE_SELECTION"
>;

const route = {
key: "ITW_IDENTIFICATION_MODE_SELECTION",
name: ITW_ROUTES.IDENTIFICATION.MODE_SELECTION,
params: {}
};

return renderScreenWithNavigationStoreContext<GlobalState>(
() => (
<ItwEidIssuanceMachineContext.Provider logic={logic}>
<ItwIdentificationModeSelectionScreen />
<ItwIdentificationModeSelectionScreen
navigation={mockNavigation}
route={route}
/>
</ItwEidIssuanceMachineContext.Provider>
),
ITW_ROUTES.IDENTIFICATION.MODE_SELECTION,
Expand Down
Loading
Loading