Skip to content

Commit

Permalink
fix(IT Wallet): [SIW-1867] Unsupported device cta onpress action (#6437)
Browse files Browse the repository at this point in the history
## Short description
This pull request focuses on enhancing the error handling and user
experience in the `ItwIssuanceEidFailureScreen` component by making use
of the `IOToast` component and a utility function for opening URLs.

## List of changes proposed in this pull request
* Replaced the `Linking.openURL` function with the `openWebUrl` utility
function, which includes a callback to display an error toast using
`IOToast` if the URL fails to open.

## How to test
Navigate inside the `ItwIssuanceEidFailureScreen` simulating an error
and test the CTA.
  • Loading branch information
ale-mazz authored Nov 21, 2024
1 parent 6759423 commit e6df0f8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as O from "fp-ts/lib/Option";
import { constNull, pipe } from "fp-ts/lib/function";
import React, { useEffect } from "react";
import { Linking } from "react-native";
import { useIOToast } from "@pagopa/io-app-design-system";
import {
OperationResultScreenContent,
OperationResultScreenContentProps
Expand All @@ -27,6 +27,7 @@ import {
trackItwUnsupportedDevice,
trackWalletCreationFailed
} from "../../analytics";
import { openWebUrl } from "../../../../utils/url";

export const ItwIssuanceEidFailureScreen = () => {
const failureOption =
Expand All @@ -47,6 +48,7 @@ const ContentView = ({ failure }: ContentViewProps) => {
const machineRef = ItwEidIssuanceMachineContext.useActorRef();
const identification =
ItwEidIssuanceMachineContext.useSelector(selectIdentification);
const toast = useIOToast();

useDebugInfo({
failure
Expand Down Expand Up @@ -118,7 +120,9 @@ const ContentView = ({ failure }: ContentViewProps) => {
"features.itWallet.unsupportedDevice.error.secondaryAction"
),
onPress: () =>
Linking.openURL("https://io.italia.it/documenti-su-io/faq/#n1_12")
openWebUrl("https://io.italia.it/documenti-su-io/faq/#n1_12", () =>
toast.error(I18n.t("global.jserror.title"))
)
}
},
[IssuanceFailureType.NOT_MATCHING_IDENTITY]: {
Expand Down

0 comments on commit e6df0f8

Please sign in to comment.