Skip to content

Commit

Permalink
Merge 10660f8 into 39388f3
Browse files Browse the repository at this point in the history
  • Loading branch information
hevelius authored Nov 12, 2023
2 parents 39388f3 + 10660f8 commit 89605ba
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 11 deletions.
8 changes: 4 additions & 4 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3444,10 +3444,10 @@ features:
credentialPreviewScreen:
title: "Here's a preview of your credential"
subtitle: "Before adding it, check if the data is correct."
somethingWrong:
title: "Something wrong?"
subtitle: "If there are errors in the data or you want to better understand what they mean, contact {{issuer}}."
action: "Ask for help"
banner:
title: "Something doesn't add up?"
content: "If you want to delve deeper into some data or report errors, contact support."
actionTitle: "Contact support"
bottomSheet:
about:
title: "Who is it?"
Expand Down
7 changes: 3 additions & 4 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3469,11 +3469,10 @@ features:
title: "Ecco un’anteprima della tua tessera"
subtitle: "Prima di aggiungerla, verifica che tutte le informazioni siano
corrette."
somethingWrong:
banner:
title: "Qualcosa non torna?"
subtitle: "Se ci sono errori nei dati o vuoi capire meglio cosa significano,
contatta {{issuer}}."
action: "Contatta l'assistenza"
content: "Se ci sono errori nei dati o vuoi capire meglio cosa significano, contatta l’assistenza."
actionTitle: "Contatta l'assistenza"
bottomSheet:
about:
title: "Chi è?"
Expand Down
4 changes: 4 additions & 0 deletions ts/features/it-wallet/navigation/ItwParamsList.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ItwCredentialDetailsScreenNavigationParams } from "../screens/credential/ItwCredentialDetailsScreen";
import { ItwPidRequestScreenNavigationParams } from "../screens/issuing/ItwPidRequestScreen";
import { ItwCieCardReaderScreenNavigationParams } from "../screens/issuing/cie/ItwCieCardReaderScreen";
import { ItwCieConsentDataUsageScreenNavigationParams } from "../screens/issuing/cie/ItwCieConsentDataUsageScreen";
Expand Down Expand Up @@ -39,6 +40,9 @@ export type ItwParamsList = {
[ITW_ROUTES.CREDENTIAL.ISSUING.CHECKS]: undefined;
[ITW_ROUTES.CREDENTIAL.ISSUING.AUTH]: undefined;
[ITW_ROUTES.CREDENTIAL.ISSUING.PREVIEW]: undefined;
// CREDENTIALS PRESENTATION
[ITW_ROUTES.CREDENTIAL.PRESENTATION
.CREDENTIAL_DETAILS]: ItwCredentialDetailsScreenNavigationParams;
// GENERIC
[ITW_ROUTES.GENERIC.NOT_AVAILABLE]: undefined;
};
3 changes: 3 additions & 0 deletions ts/features/it-wallet/navigation/ItwRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export const ITW_ROUTES = {
CHECKS: "ITW_CREDENTIAL_ISSUING_CHECKS",
AUTH: "ITW_CREDENTIAL_ISSUING_AUTH",
PREVIEW: "ITW_CREDENTIAL_ISSUING_PREVIEW"
} as const,
PRESENTATION: {
CREDENTIAL_DETAILS: "ITW_CREDENTIAL_PRESENTATION_DETAILS"
} as const
} as const,
GENERIC: {
Expand Down
6 changes: 6 additions & 0 deletions ts/features/it-wallet/navigation/ItwStackNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import ItwPresentationDataScreen from "../screens/presentation/crossdevice/new/I
import ItwPresentationResultScreen from "../screens/presentation/crossdevice/new/ItwPresentationResultScreen";
import ItwCredentialsChecksScreen from "../screens/credential/issuing/ItwCredentialChecksScreen";
import ItwCredentialCatalogScreen from "../screens/credential/issuing/ItwCredentialsCatalogScreen";
import ItwCredentialDetailsScreen from "../screens/credential/ItwCredentialDetailsScreen";
import { ItwParamsList } from "./ItwParamsList";
import { ITW_ROUTES } from "./ItwRoutes";

Expand Down Expand Up @@ -123,6 +124,11 @@ export const ItwStackNavigator = () => (
name={ITW_ROUTES.CREDENTIAL.ISSUING.PREVIEW}
component={ItwCredentialPreviewScreen}
/>
{/* CREDENTIAL PRESENTATION */}
<Stack.Screen
name={ITW_ROUTES.CREDENTIAL.PRESENTATION.CREDENTIAL_DETAILS}
component={ItwCredentialDetailsScreen}
/>
{/* COMMON */}
<Stack.Screen
name={ITW_ROUTES.GENERIC.NOT_AVAILABLE}
Expand Down
8 changes: 8 additions & 0 deletions ts/features/it-wallet/screens/ItwHomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ const ItwHomeScreen = () => {
.map((credential, idx) => (
<Pressable
onLongPress={onLongPressCredential}
onPress={() =>
navigation.navigate(ITW_ROUTES.MAIN, {
screen: ITW_ROUTES.CREDENTIAL.PRESENTATION.CREDENTIAL_DETAILS,
params: {
credential
}
})
}
key={`${credential.displayData.title}-${idx}`}
>
<ItwCredentialCard
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import React from "react";
import { RouteProp, useRoute } from "@react-navigation/native";
import {
Banner,
BlockButtonProps,
FooterWithButtons,
VSpacer
} from "@pagopa/io-app-design-system";
import { ScrollView } from "react-native-gesture-handler";
import { SafeAreaView, View } from "react-native";
import { constNull } from "fp-ts/lib/function";
import ItwCredentialCard from "../../components/ItwCredentialCard";
import { IOStyles } from "../../../../components/core/variables/IOStyles";
import BaseScreenComponent from "../../../../components/screens/BaseScreenComponent";
import I18n from "../../../../i18n";
import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp";
import { ItwParamsList } from "../../navigation/ItwParamsList";
import ItwCredentialClaimsList from "../../components/ItwCredentialClaimsList";
import { StoredCredential } from "../../store/reducers/itwCredentialsReducer";

export type ItwCredentialDetailsScreenNavigationParams = {
credential: StoredCredential;
};

type ItwCredentialDetailscreenRouteProps = RouteProp<
ItwParamsList,
"ITW_CREDENTIAL_PRESENTATION_DETAILS"
>;

/**
* Renders a preview screen which displays a visual representation and the claims contained in the credential.
*/
const ItwCredentialDetailsScreen = () => {
const route = useRoute<ItwCredentialDetailscreenRouteProps>();
const { credential } = route.params;
const bannerViewRef = React.createRef<View>();

/**
* Content view which asks the user to confirm the issuance of the credential.
* @param data - the issuance result data of the credential used to display the credential.
*/
const ContentView = ({ data }: { data: StoredCredential }) => {
const presentationButton: BlockButtonProps = {
type: "Solid",
buttonProps: {
label: I18n.t(
"features.itWallet.presentation.credentialDetails.buttons.qrCode"
),
accessibilityLabel: I18n.t(
"features.itWallet.presentation.credentialDetails.buttons.qrCode"
),
onPress: () => null
}
};

return (
<BaseScreenComponent goBack={true} contextualHelp={emptyContextualHelp}>
<SafeAreaView style={IOStyles.flex}>
<ScrollView contentContainerStyle={IOStyles.horizontalContentPadding}>
<ItwCredentialCard
parsedCredential={data.parsedCredential}
display={data.displayData}
/>
<VSpacer />
<ItwCredentialClaimsList data={{ ...data, issuerName: "INPS" }} />
<VSpacer size={32} />
<Banner
testID={"ItwBannerTestID"}
viewRef={bannerViewRef}
color={"neutral"}
size="big"
title={I18n.t(
"features.itWallet.issuing.credentialPreviewScreen.banner.title"
)}
content={I18n.t(
"features.itWallet.issuing.credentialPreviewScreen.banner.content"
)}
pictogramName={"security"}
action={I18n.t(
"features.itWallet.issuing.credentialPreviewScreen.banner.actionTitle"
)}
onPress={constNull}
/>
<VSpacer size={32} />
</ScrollView>
<FooterWithButtons
type={"SingleButton"}
primary={presentationButton}
/>
</SafeAreaView>
</BaseScreenComponent>
);
};

return <ContentView data={credential} />;
};

export default ItwCredentialDetailsScreen;
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,17 @@ const ItwCredentialPreviewScreen = () => {
color={"neutral"}
size="big"
title={I18n.t(
"features.itWallet.issuing.credentialPreviewScreen.somethingWrong.title"
"features.itWallet.issuing.credentialPreviewScreen.banner.title"
)}
content={I18n.t(
"features.itWallet.issuing.credentialPreviewScreen.somethingWrong.subtitle",
"features.itWallet.issuing.credentialPreviewScreen.banner.content",
{
issuer: data.issuerName
}
)}
pictogramName={"security"}
action={I18n.t(
"features.itWallet.issuing.credentialPreviewScreen.somethingWrong.action"
"features.itWallet.issuing.credentialPreviewScreen.banner.actionTitle"
)}
onPress={present}
/>
Expand Down

0 comments on commit 89605ba

Please sign in to comment.