-
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.
chore(IT Wallet): [SIW-1804] Already activated wallet screen (#6376)
## Short description This PR adds a new error screen visible if the user tries to activate the wallet when it is already active, starting with the CTA of the activation message ## List of changes proposed in this pull request - Added a new `ItwAlreadyActiveScreen` - Mapped the navigation inside `useItwLinkingOptions` ## How to test From the message CTA with an active eID try to navigate to the Discovery screen. You can also use the deep link to test the navigation `ioit://itw/discovery/info` Preview: ![IMAGE 2024-11-06 15:07:35](https://github.com/user-attachments/assets/9e8dabd1-3491-47a6-858c-90a0edaa94f4)
- Loading branch information
Showing
10 changed files
with
119 additions
and
9 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
61 changes: 61 additions & 0 deletions
61
ts/features/itwallet/discovery/screens/ItwAlreadyActiveScreen.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, { useCallback } from "react"; | ||
import { useFocusEffect } from "@react-navigation/native"; | ||
import I18n from "../../../../i18n"; | ||
import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent"; | ||
import { useAvoidHardwareBackButton } from "../../../../utils/useAvoidHardwareBackButton"; | ||
import ROUTES from "../../../../navigation/routes"; | ||
import { useIONavigation } from "../../../../navigation/params/AppParamsList"; | ||
import { useItwDisableGestureNavigation } from "../../common/hooks/useItwDisableGestureNavigation"; | ||
import { trackItwAlreadyActivated } from "../../analytics"; | ||
|
||
export const ItwAlreadyActiveScreen = () => { | ||
useItwDisableGestureNavigation(); | ||
useAvoidHardwareBackButton(); | ||
|
||
const navigation = useIONavigation(); | ||
|
||
const navigateToWallet = () => { | ||
navigation.reset({ | ||
index: 1, | ||
routes: [ | ||
{ | ||
name: ROUTES.MAIN, | ||
params: { | ||
screen: ROUTES.WALLET_HOME | ||
} | ||
} | ||
] | ||
}); | ||
}; | ||
|
||
const handleClose = () => { | ||
navigation.pop(); | ||
}; | ||
|
||
useFocusEffect( | ||
useCallback(() => { | ||
trackItwAlreadyActivated(); | ||
}, []) | ||
); | ||
|
||
return ( | ||
<OperationResultScreenContent | ||
pictogram="itWallet" | ||
title={I18n.t("features.itWallet.discovery.alreadyActive.title")} | ||
subtitle={I18n.t("features.itWallet.discovery.alreadyActive.content")} | ||
isHeaderVisible={false} | ||
action={{ | ||
label: I18n.t("features.itWallet.discovery.alreadyActive.action"), | ||
accessibilityLabel: I18n.t( | ||
"features.itWallet.discovery.alreadyActive.action" | ||
), | ||
onPress: navigateToWallet | ||
}} | ||
secondaryAction={{ | ||
label: I18n.t("global.buttons.close"), | ||
accessibilityLabel: I18n.t("global.buttons.close"), | ||
onPress: handleClose | ||
}} | ||
/> | ||
); | ||
}; |
26 changes: 26 additions & 0 deletions
26
ts/features/itwallet/discovery/screens/__tests__/ItwAlreadyActiveScreen.test.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,26 @@ | ||
import * as React from "react"; | ||
import { createStore } from "redux"; | ||
import { applicationChangeState } from "../../../../../store/actions/application"; | ||
import { appReducer } from "../../../../../store/reducers"; | ||
import { GlobalState } from "../../../../../store/reducers/types"; | ||
import { renderScreenWithNavigationStoreContext } from "../../../../../utils/testWrapper"; | ||
import { ITW_ROUTES } from "../../../navigation/routes"; | ||
import { ItwAlreadyActiveScreen } from "../ItwAlreadyActiveScreen"; | ||
|
||
describe("Test ItwAlreadyActive screen", () => { | ||
it("it should render the screen correctly", () => { | ||
const component = renderComponent(); | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
const renderComponent = () => { | ||
const globalState = appReducer(undefined, applicationChangeState("active")); | ||
|
||
return renderScreenWithNavigationStoreContext<GlobalState>( | ||
() => <ItwAlreadyActiveScreen />, | ||
ITW_ROUTES.DISCOVERY.ALREADY_ACTIVE_SCREEN, | ||
{}, | ||
createStore(appReducer, globalState as any) | ||
); | ||
}; |
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