-
Notifications
You must be signed in to change notification settings - Fork 104
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-1574] Add wallet instance revocation (#6252)
## Short description This PR adds the feature to revoke the current wallet instance in-app. ## List of changes proposed in this pull request - Created a new route with `ItwLifecycleWalletRevocationScreen` - Added a new state to the eID issuance machine to handle revocation - Added the revoke button to the eID info bottom sheet - Updated `io-react-native-wallet` ## How to test Press the button to revoke the wallet instance and check the network: you should see a HTTP call to `/wallet/wallet-instances/current/status`. Then check the Redux store to see the `features.itWallet` slice reset. https://github.com/user-attachments/assets/89fb6b8b-a174-4101-a0d7-90f0b576112d --------- Co-authored-by: LazyAfternoons <[email protected]>
- Loading branch information
1 parent
464ade9
commit bc87f7e
Showing
17 changed files
with
233 additions
and
12 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { WalletInstance } from "@pagopa/io-react-native-wallet"; | ||
import { itwWalletProviderBaseUrl } from "../../../../config"; | ||
import { SessionToken } from "../../../../types/SessionToken"; | ||
import { createItWalletFetch } from "../../api/client"; | ||
|
||
/** | ||
* Revoke the current wallet instance. | ||
* @param sessionToken | ||
*/ | ||
export const revokeCurrentWalletInstance = async ( | ||
sessionToken: SessionToken | ||
): Promise<void> => { | ||
const appFetch = createItWalletFetch(itwWalletProviderBaseUrl, sessionToken); | ||
|
||
await WalletInstance.revokeCurrentWalletInstance({ | ||
walletProviderBaseUrl: itwWalletProviderBaseUrl, | ||
appFetch | ||
}); | ||
}; |
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
62 changes: 62 additions & 0 deletions
62
ts/features/itwallet/lifecycle/screens/ItwLifecycleWalletRevocationScreen.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,62 @@ | ||
import React from "react"; | ||
import { View } from "react-native"; | ||
import { Body, IOStyles } from "@pagopa/io-app-design-system"; | ||
import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; | ||
import I18n from "../../../../i18n"; | ||
import { ItwEidIssuanceMachineContext } from "../../machine/provider"; | ||
import { selectIsLoading } from "../../machine/eid/selectors"; | ||
import LoadingScreenContent from "../../../../components/screens/LoadingScreenContent"; | ||
import { useItwDisableGestureNavigation } from "../../common/hooks/useItwDisableGestureNavigation"; | ||
import { useAvoidHardwareBackButton } from "../../../../utils/useAvoidHardwareBackButton"; | ||
|
||
const RevocationLoadingScreen = () => { | ||
useItwDisableGestureNavigation(); | ||
useAvoidHardwareBackButton(); | ||
|
||
return ( | ||
<LoadingScreenContent | ||
contentTitle={I18n.t( | ||
"features.itWallet.walletRevocation.loadingScreen.title" | ||
)} | ||
> | ||
<View style={[IOStyles.alignCenter, IOStyles.horizontalContentPadding]}> | ||
<Body> | ||
{I18n.t("features.itWallet.walletRevocation.loadingScreen.subtitle")} | ||
</Body> | ||
</View> | ||
</LoadingScreenContent> | ||
); | ||
}; | ||
|
||
export const ItwLifecycleWalletRevocationScreen = () => { | ||
const machineRef = ItwEidIssuanceMachineContext.useActorRef(); | ||
const isLoading = ItwEidIssuanceMachineContext.useSelector(selectIsLoading); | ||
|
||
if (isLoading) { | ||
return <RevocationLoadingScreen />; | ||
} | ||
|
||
return ( | ||
<OperationResultScreenContent | ||
pictogram="attention" | ||
title={I18n.t("features.itWallet.walletRevocation.confirmScreen.title")} | ||
subtitle={I18n.t( | ||
"features.itWallet.walletRevocation.confirmScreen.subtitle" | ||
)} | ||
action={{ | ||
label: I18n.t( | ||
"features.itWallet.walletRevocation.confirmScreen.action" | ||
), | ||
accessibilityLabel: I18n.t( | ||
"features.itWallet.walletRevocation.confirmScreen.action" | ||
), | ||
onPress: () => machineRef.send({ type: "revoke-wallet-instance" }) | ||
}} | ||
secondaryAction={{ | ||
label: I18n.t("global.buttons.cancel"), | ||
accessibilityLabel: I18n.t("global.buttons.cancel"), | ||
onPress: () => machineRef.send({ type: "close" }) | ||
}} | ||
/> | ||
); | ||
}; |
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
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
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
Oops, something went wrong.