Skip to content

Commit

Permalink
feat: [IOPID-2798] Add new copy on logout alert if there is an active…
Browse files Browse the repository at this point in the history
… wallet instance (#6772)

## Short description
In this PR, a new copy was added in the alert that is shown in the
logout screen to be shown to users who have the wallet instance active

## Demo 

| With active Wallet instance | Without active Wallet instance (as-is) |
| - | - | 
| <video
src="https://github.com/user-attachments/assets/9ea86d1f-aa81-4c16-bf96-b90482e5a8ff"
/> | <video
src="https://github.com/user-attachments/assets/eb13ee87-3560-4c81-a9f4-63e896b7b36f"
/> |

## How to test
1. Run the application 
2. To test the behavior with or without an active wallet instance,
manually modify the value of `itwLifecycleIsOperationalOrValid`:
  - Set to `true` if you need an active wallet instance.
- Set to `false` if you want to test the flow without a wallet instance.

---------

Co-authored-by: mariateresaventura <[email protected]>
  • Loading branch information
Ladirico and mariateresaventura authored Mar 5, 2025
1 parent ae6c924 commit f591e0a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions locales/en/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"menulabel": "Logout from IO",
"alertTitle": "Do you want to logout?",
"alertMessage": "You will need to login again with SPID or CIE to use the app.",
"activeWiAlertMessage": "You will need to log in again with SPID or CIE to use the app.\n\nIf you log in to IO from a device other than your usual one, the Documenti su IO feature will be reset for security reasons.",
"loading": "You're leaving IO",
"exit": "Exit"
},
Expand Down
1 change: 1 addition & 0 deletions locales/it/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
"menulabel": "Esci da IO",
"alertTitle": "Vuoi davvero uscire?",
"alertMessage": "Dovrai entrare di nuovo con SPID o CIE per usare l’app.",
"activeWiAlertMessage": "Dovrai entrare di nuovo con SPID o CIE per usare l’app.\n\nSe accedi a IO da un dispositivo diverso da quello abituale, per motivi di sicurezza la funzionalità Documenti su IO verrà reimpostata.",
"loading": "Stai uscendo da IO",
"exit": "Esci"
},
Expand Down
21 changes: 15 additions & 6 deletions ts/screens/profile/ProfileMainScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { setDebugModeEnabled } from "../../store/actions/debug";
import { useIODispatch, useIOSelector } from "../../store/hooks";
import { isDebugModeEnabledSelector } from "../../store/reducers/debug";
import { isDevEnv } from "../../utils/environment";
import { itwLifecycleIsOperationalOrValid } from "../../features/itwallet/lifecycle/store/selectors";
import DeveloperModeSection from "./DeveloperModeSection";
import { ProfileMainScreenTopBanner } from "./ProfileMainScreenTopBanner";

Expand All @@ -54,9 +55,18 @@ const ProfileMainScreenFC = () => {
const navigation = useIONavigation();
const { show } = useIOToast();
const isDebugModeEnabled = useIOSelector(isDebugModeEnabledSelector);
const selectItwLifecycleIsOperationalOrValid = useIOSelector(
itwLifecycleIsOperationalOrValid
);
const [tapsOnAppVersion, setTapsOnAppVersion] = useState(0);
const idResetTap = useRef<number>();

const handleContinue = useCallback(() => {
navigation.navigate(ROUTES.PROFILE_NAVIGATOR, {
screen: ROUTES.PROFILE_LOGOUT
});
}, [navigation]);

useEffect(
() => () => {
hideModal();
Expand All @@ -70,22 +80,21 @@ const ProfileMainScreenFC = () => {
const onLogoutPress = useCallback(() => {
Alert.alert(
I18n.t("profile.logout.alertTitle"),
I18n.t("profile.logout.alertMessage"),
selectItwLifecycleIsOperationalOrValid
? I18n.t("profile.logout.activeWiAlertMessage")
: I18n.t("profile.logout.alertMessage"),
[
{
text: I18n.t("global.buttons.cancel")
},
{
text: I18n.t("profile.logout.exit"),
onPress: () =>
navigation.navigate(ROUTES.PROFILE_NAVIGATOR, {
screen: ROUTES.PROFILE_LOGOUT
})
onPress: handleContinue
}
],
{ cancelable: true }
);
}, [navigation]);
}, [handleContinue, selectItwLifecycleIsOperationalOrValid]);

const resetAppTapCounter = useCallback(() => {
setTapsOnAppVersion(0);
Expand Down

0 comments on commit f591e0a

Please sign in to comment.