-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(IT Wallet): [SIW-1853] Ipatente routing with IT Wallet (#6521)
## Short description This PR enables a link between the iPatente service and IT Wallet adding a custom route parsing the credentialType used by iPatente service. ## List of changes proposed in this pull request - A new error screen was added when the user tries to navigate to the credential without having that specific credential. - Added the navigation routing when using a specific deep link related to the iPatente service. ## How to test Use this deep link to navigate into the credential (MDL only) and check these results: - Wallet not active -> Error screen that route you to activate the wallet - Wallet active but MDL not requested -> Screen that route you to request the MDL - Wallet active MDL active -> MDL details screen Deep link to be used: `ioit://itw/presentation/credential-detail/MDL` Screenshot: ![IMAGE 2024-12-11 15:08:36](https://github.com/user-attachments/assets/ac182db6-273c-4163-bec7-670be8bb2b4d) --------- Co-authored-by: Federico Mastrini <[email protected]>
- Loading branch information
Showing
6 changed files
with
78 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
ts/features/itwallet/common/components/ItwCredentialNotFound.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React, { useEffect } from "react"; | ||
import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; | ||
import I18n from "../../../../i18n"; | ||
import { ItwCredentialIssuanceMachineContext } from "../../machine/provider"; | ||
import { useIONavigation } from "../../../../navigation/params/AppParamsList"; | ||
import { useItwDisableGestureNavigation } from "../hooks/useItwDisableGestureNavigation"; | ||
import { useAvoidHardwareBackButton } from "../../../../utils/useAvoidHardwareBackButton"; | ||
|
||
const ItwCredentialNotFound = ({ | ||
credentialType | ||
}: { | ||
credentialType: string; | ||
}) => { | ||
const machineRef = ItwCredentialIssuanceMachineContext.useActorRef(); | ||
const navigation = useIONavigation(); | ||
|
||
// Disable the back gesture navigation and the hardware back button | ||
useItwDisableGestureNavigation(); | ||
useAvoidHardwareBackButton(); | ||
|
||
const navigateToCredential = () => { | ||
machineRef.send({ | ||
type: "select-credential", | ||
credentialType | ||
}); | ||
}; | ||
|
||
const handleClose = () => { | ||
navigation.pop(); | ||
}; | ||
|
||
// Since this component could be used on a screen where the header is visible, we hide it. | ||
useEffect(() => { | ||
navigation.setOptions({ | ||
headerShown: false | ||
}); | ||
}, [navigation]); | ||
|
||
return ( | ||
<OperationResultScreenContent | ||
pictogram="cie" | ||
title={I18n.t("features.itWallet.issuance.credentialNotFound.title")} | ||
subtitle={I18n.t( | ||
"features.itWallet.issuance.credentialNotFound.subtitle" | ||
)} | ||
isHeaderVisible={false} | ||
action={{ | ||
label: I18n.t("global.buttons.continue"), | ||
accessibilityLabel: I18n.t("global.buttons.continue"), | ||
onPress: navigateToCredential | ||
}} | ||
secondaryAction={{ | ||
label: I18n.t("global.buttons.cancel"), | ||
accessibilityLabel: I18n.t("global.buttons.cancel"), | ||
onPress: handleClose | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export default ItwCredentialNotFound; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters