Skip to content

Commit

Permalink
Merge branch 'master' into IOPLT-784
Browse files Browse the repository at this point in the history
  • Loading branch information
CrisTofani authored Feb 13, 2025
2 parents 24b55f2 + df85e81 commit 379ce2c
Show file tree
Hide file tree
Showing 30 changed files with 438 additions and 60 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.83.0-rc.1](https://github.com/pagopa/io-app/compare/2.83.0-rc.0...2.83.0-rc.1) (2025-02-12)


### Features

* **IT Wallet:** [[SIW-1962](https://pagopa.atlassian.net/browse/SIW-1962)] Remote presentation handle wallet instance presence ([#6694](https://github.com/pagopa/io-app/issues/6694)) ([20d6906](https://github.com/pagopa/io-app/commit/20d6906331909b8ee703d0cc0d9193d92db97d2d))

## [2.83.0-rc.0](https://github.com/pagopa/io-app/compare/2.82.0-rc.7...2.83.0-rc.0) (2025-02-11)


Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ android {
applicationId "it.pagopa.io.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 100154924
versionName "2.83.0.0"
versionCode 100154925
versionName "2.83.0.1"
multiDexEnabled true
// The resConfigs attribute will remove all not required localized resources while building the application,
// including the localized resources from libraries.
Expand Down
6 changes: 3 additions & 3 deletions ios/ItaliaApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@
CODE_SIGN_ENTITLEMENTS = ItaliaApp/ItaliaApp.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = M2X5YQ4BJ7;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -839,7 +839,7 @@
CODE_SIGN_ENTITLEMENTS = ItaliaApp/ItaliaApp.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = M2X5YQ4BJ7;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -1081,7 +1081,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = M2X5YQ4BJ7;
Expand Down
2 changes: 1 addition & 1 deletion ios/ItaliaApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>0</string>
<string>1</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/ItaliaAppTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0</string>
<string>1</string>
</dict>
</plist>
10 changes: 10 additions & 0 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3557,6 +3557,16 @@ features:
loadingScreen:
title: Stiamo facendo alcune verifiche di sicurezza...
subtitle: Attendi qualche secondo
walletInactiveScreen:
title: Attiva Documenti su IO per continuare
subtitle: Per accedere con IT Wallet ai servizi online è necessario prima attivare la funzionalità Documenti su IO.
primaryAction: Inizia
secondaryAction: Non ora
missingCredentialsScreen:
title: Mancano i dati contenuti in {{credentialName}}
subtitle: Aggiungi il documento al Portafoglio prima di continuare e poi riprova.
primaryAction: Aggiungi documento al Portafoglio
secondaryAction: Annulla
trustmark:
description: Mostra il QR Code per attestare l’autenticità del documento quando ti viene richiesto.
qrCode: QR code autenticità credenziale
Expand Down
10 changes: 10 additions & 0 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3557,6 +3557,16 @@ features:
loadingScreen:
title: Stiamo facendo alcune verifiche di sicurezza...
subtitle: Attendi qualche secondo
walletInactiveScreen:
title: Attiva Documenti su IO per continuare
subtitle: Per accedere con IT Wallet ai servizi online è necessario prima attivare la funzionalità Documenti su IO.
primaryAction: Inizia
secondaryAction: Non ora
missingCredentialsScreen:
title: Mancano i dati contenuti in {{credentialName}}
subtitle: Aggiungi il documento al Portafoglio prima di continuare e poi riprova.
primaryAction: Aggiungi documento al Portafoglio
secondaryAction: Annulla
trustmark:
description: Mostra il QR Code per attestare l’autenticità del documento quando ti viene richiesto.
qrCode: QR code autenticità credenziale
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "italia-app",
"version": "2.83.0-rc.0",
"version": "2.83.0-rc.1",
"private": true,
"scripts": {
"start": "react-native start",
Expand Down
2 changes: 1 addition & 1 deletion publiccode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ releaseDate: "2024-11-21"
url: "https://github.com/pagopa/io-app"
applicationSuite: IO
landingURL: "https://io.italia.it/"
softwareVersion: 2.83.0-rc.0
softwareVersion: 2.83.0-rc.1
developmentStatus: beta
softwareType: standalone/mobile
roadmap: "https://io.italia.it/"
Expand Down
4 changes: 2 additions & 2 deletions ts/components/screens/OperationResultScreenContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ type OperationResultScreenContentProps = WithTestID<{
subtitleProps?: Pick<BodyProps, "textBreakStrategy" | "lineBreakStrategyIOS">;
action?: Pick<
ButtonSolidProps,
"label" | "accessibilityLabel" | "onPress" | "testID"
"label" | "accessibilityLabel" | "onPress" | "testID" | "icon"
>;
secondaryAction?: Pick<
ButtonLinkProps,
"label" | "accessibilityLabel" | "onPress" | "testID"
"label" | "accessibilityLabel" | "onPress" | "testID" | "icon"
>;
isHeaderVisible?: boolean;
}>;
Expand Down
8 changes: 3 additions & 5 deletions ts/features/barcode/screens/BarcodeScanScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ import {
IOStackNavigationProp
} from "../../../navigation/params/AppParamsList";
import { useIOSelector } from "../../../store/hooks";
import {
barcodesScannerConfigSelector,
isIdPayEnabledSelector
} from "../../../store/reducers/backendStatus/remoteConfig";
import { barcodesScannerConfigSelector } from "../../../store/reducers/backendStatus/remoteConfig";
import { emptyContextualHelp } from "../../../utils/emptyContextualHelp";
import { useIOBottomSheetAutoresizableModal } from "../../../utils/hooks/bottomSheet";
import { IdPayPaymentRoutes } from "../../idpay/payment/navigation/routes";
Expand All @@ -46,11 +43,12 @@ import { usePagoPaPayment } from "../../payments/checkout/hooks/usePagoPaPayment
import { FCI_ROUTES } from "../../fci/navigation/routes";
import { paymentAnalyticsDataSelector } from "../../payments/history/store/selectors";
import { ITW_REMOTE_ROUTES } from "../../itwallet/presentation/remote/navigation/routes.ts";
import { isIdPayLocallyEnabledSelector } from "../../../store/reducers/persistedPreferences.ts";

const BarcodeScanScreen = () => {
const navigation = useNavigation<IOStackNavigationProp<AppParamsList>>();
const openDeepLink = useOpenDeepLink();
const isIdPayEnabled = useIOSelector(isIdPayEnabledSelector);
const isIdPayEnabled = useIOSelector(isIdPayLocallyEnabledSelector);
const paymentAnalyticsData = useIOSelector(paymentAnalyticsDataSelector);

const { startPaymentFlowWithRptId } = usePagoPaPayment();
Expand Down
3 changes: 2 additions & 1 deletion ts/features/itwallet/common/utils/itwStoreUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { GlobalState } from "../../../../store/reducers/types";
import { type CredentialIssuanceFailure } from "../../machine/credential/failure";
import { type IssuanceFailure } from "../../machine/eid/failure";
import { RemoteFailure } from "../../presentation/remote/machine/failure.ts";

interface PollForStoreValueOptions<T> {
getState: () => GlobalState;
Expand Down Expand Up @@ -54,7 +55,7 @@ export const pollForStoreValue = <T>({
* Serialize failure reasons that are instances of {@link Error}, to be safely stored and displayed.
*/
export const serializeFailureReason = (
failure: IssuanceFailure | CredentialIssuanceFailure
failure: IssuanceFailure | CredentialIssuanceFailure | RemoteFailure
) => ({
...failure,
reason:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
import { createActor } from "xstate";
import { itwRemoteMachine } from "../machine.ts";
import _ from "lodash";
import { StateFrom, createActor } from "xstate";
import { ItwRemoteMachine, itwRemoteMachine } from "../machine.ts";

const T_CLIENT_ID = "clientId";
const T_REQUEST_URI = "https://example.com";
const T_STATE = "state";

type MachineSnapshot = StateFrom<ItwRemoteMachine>;

describe("itwRemoteMachine", () => {
const navigateToDiscoveryScreen = jest.fn();
const navigateToWallet = jest.fn();
const navigateToFailureScreen = jest.fn();
const closeIssuance = jest.fn();

const isWalletActive = jest.fn();

const mockedMachine = itwRemoteMachine.provide({
actions: {},
actions: {
navigateToDiscoveryScreen,
navigateToWallet,
navigateToFailureScreen,
closeIssuance
},
actors: {},
guards: {}
guards: {
isWalletActive
}
});

afterEach(() => {
Expand All @@ -23,7 +40,9 @@ describe("itwRemoteMachine", () => {
expect(actor.getSnapshot().value).toStrictEqual("Idle");
});

it("should transition from Idle to RemoteRequestValidation when receiving start event", () => {
it("should transition from Idle to WalletInactive when wallet is inactive", () => {
isWalletActive.mockReturnValue(false);

const actor = createActor(mockedMachine);
actor.start();

Expand All @@ -36,11 +55,73 @@ describe("itwRemoteMachine", () => {
}
});

expect(actor.getSnapshot().value).toStrictEqual("RemoteRequestValidation");
expect(actor.getSnapshot().context.payload).toStrictEqual({
clientId: T_CLIENT_ID,
requestUri: T_REQUEST_URI,
state: T_STATE
expect(actor.getSnapshot().value).toStrictEqual("Failure");
expect(navigateToFailureScreen).toHaveBeenCalledTimes(1);
});

it("Should navigate to wallet when user not accept to active ITWallet", async () => {
const initialSnapshot: MachineSnapshot =
createActor(itwRemoteMachine).getSnapshot();

const snapshot: MachineSnapshot = _.merge(undefined, initialSnapshot, {
value: "Failure",
context: {
payload: {
clientId: T_CLIENT_ID,
requestUri: T_REQUEST_URI,
state: T_STATE
}
}
} as MachineSnapshot);

const actor = createActor(mockedMachine, {
snapshot
});
actor.start();

actor.send({ type: "go-to-wallet" });
expect(navigateToWallet).toHaveBeenCalledTimes(1);
});

it("Should navigate to TOS when user accept to active ITWallet", async () => {
const initialSnapshot: MachineSnapshot =
createActor(itwRemoteMachine).getSnapshot();

const snapshot: MachineSnapshot = _.merge(undefined, initialSnapshot, {
value: "Failure",
context: {
payload: {
clientId: T_CLIENT_ID,
requestUri: T_REQUEST_URI,
state: T_STATE
}
}
} as MachineSnapshot);

const actor = createActor(mockedMachine, {
snapshot
});
actor.start();

actor.send({ type: "go-to-wallet-activation" });
expect(navigateToDiscoveryScreen).toHaveBeenCalledTimes(1);
});

it("should transition from Idle to ClaimsDisclosure when ITWallet is active", () => {
const actor = createActor(mockedMachine);
actor.start();

isWalletActive.mockReturnValue(true);

actor.send({
type: "start",
payload: {
clientId: T_CLIENT_ID,
requestUri: T_REQUEST_URI,
state: T_STATE
}
});

expect(actor.getSnapshot().value).toStrictEqual("ClaimsDisclosure");
});
});
40 changes: 38 additions & 2 deletions ts/features/itwallet/presentation/remote/machine/actions.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
// This file is a placeholder for future implementation
export const createRemoteActionsImplementation = () => ({});
import { useIONavigation } from "../../../../../navigation/params/AppParamsList.ts";
import { ITW_REMOTE_ROUTES } from "../navigation/routes.ts";
import ROUTES from "../../../../../navigation/routes.ts";
import { ITW_ROUTES } from "../../../navigation/routes.ts";

export const createRemoteActionsImplementation = (
navigation: ReturnType<typeof useIONavigation>
) => ({
navigateToFailureScreen: () => {
navigation.navigate(ITW_REMOTE_ROUTES.MAIN, {
screen: ITW_REMOTE_ROUTES.FAILURE
});
},

navigateToDiscoveryScreen: () => {
navigation.navigate(ITW_ROUTES.MAIN, {
screen: ITW_ROUTES.DISCOVERY.INFO
});
},

navigateToWallet: () => {
navigation.reset({
index: 1,
routes: [
{
name: ROUTES.MAIN,
params: {
screen: ROUTES.WALLET_HOME
}
}
]
});
},

closeIssuance: () => {
navigation.popToTop();
}
});
24 changes: 23 additions & 1 deletion ts/features/itwallet/presentation/remote/machine/events.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
import { ItwRemoteRequestPayload } from "../Utils/itwRemoteTypeUtils.ts";

export type Reset = {
type: "reset";
};

export type Start = {
type: "start";
payload: ItwRemoteRequestPayload;
};

export type GoToWalletActivation = {
type: "go-to-wallet-activation";
};

export type GoToWallet = {
type: "go-to-wallet";
};

export type Back = {
type: "back";
};

export type RemoteEvents = Start | Back;
export type Close = {
type: "close";
};

export type RemoteEvents =
| Reset
| Start
| GoToWalletActivation
| GoToWallet
| Back
| Close;
Loading

0 comments on commit 379ce2c

Please sign in to comment.