From 56d8263648666e8ea195bcc752b355ac788c189e Mon Sep 17 00:00:00 2001 From: Bryce McMath <32586431+bryce-mcmath@users.noreply.github.com> Date: Wed, 10 Jul 2024 15:57:16 -0700 Subject: [PATCH] feat: verifier proof improvements (#1191) Signed-off-by: Bryce McMath --- .../App/components/misc/CredentialCard11.tsx | 2 +- .../misc/VerifierCredentialCard.tsx | 4 ++ .../legacy/core/App/localization/en/index.ts | 3 +- .../legacy/core/App/localization/fr/index.ts | 3 +- .../core/App/localization/pt-br/index.ts | 3 +- .../core/App/screens/ProofRequesting.tsx | 9 +-- packages/legacy/core/App/utils/oca.ts | 1 + .../ProofRequesting.test.tsx.snap | 63 ++++++++++--------- .../W3cProofRequest.test.tsx.snap | 2 +- 9 files changed, 48 insertions(+), 42 deletions(-) diff --git a/packages/legacy/core/App/components/misc/CredentialCard11.tsx b/packages/legacy/core/App/components/misc/CredentialCard11.tsx index 7beb5bf606..2d6cde44b4 100644 --- a/packages/legacy/core/App/components/misc/CredentialCard11.tsx +++ b/packages/legacy/core/App/components/misc/CredentialCard11.tsx @@ -246,7 +246,7 @@ const CredentialCard11: React.FC = ({ const parseAttribute = (item: (Attribute & Predicate) | undefined) => { let parsedItem = item - if (item && item.value != null) { + if (item && item.pValue != null) { parsedItem = pTypeToText(item, t, attributeTypes) as Attribute & Predicate } const parsedValue = formatIfDate( diff --git a/packages/legacy/core/App/components/misc/VerifierCredentialCard.tsx b/packages/legacy/core/App/components/misc/VerifierCredentialCard.tsx index 95e238c3b4..621536e624 100644 --- a/packages/legacy/core/App/components/misc/VerifierCredentialCard.tsx +++ b/packages/legacy/core/App/components/misc/VerifierCredentialCard.tsx @@ -15,6 +15,7 @@ import { TextInput, TouchableOpacity, } from 'react-native' +import Icon from 'react-native-vector-icons/MaterialIcons' import ImageModal from '../../components/modals/ImageModal' import { TOKENS, useContainer } from '../../container-api' @@ -261,6 +262,9 @@ const VerifierCredentialCard: React.FC = ({ {ylabel} + {item.satisfied && !preview ? ( + + ) : null} {item.pType} {/* Only allow editing parametrizable predicates in preview mode */} {item.parameterizable && preview && onChangeValue ? ( diff --git a/packages/legacy/core/App/localization/en/index.ts b/packages/legacy/core/App/localization/en/index.ts index dc66ad12bc..d7d0648f3e 100644 --- a/packages/legacy/core/App/localization/en/index.ts +++ b/packages/legacy/core/App/localization/en/index.ts @@ -669,8 +669,7 @@ const translation = { "GenerateNewQR": "Request another proof", "BackToList": "Back to list", "ShareLink": "Share link", - "ScanQR": "Show this QR code to the other person", - "ScanQRComment": "After the QR code is scanned, a proof request will be sent.", + "ScanQR": "Show this QR code to the other person to verify:", "InformationReceived": "Information received.", "InformationReceivedDetails": "Review the information below.", "ProofVerificationFailed": "Proof verification failed", diff --git a/packages/legacy/core/App/localization/fr/index.ts b/packages/legacy/core/App/localization/fr/index.ts index c3910da077..3765499c13 100644 --- a/packages/legacy/core/App/localization/fr/index.ts +++ b/packages/legacy/core/App/localization/fr/index.ts @@ -646,8 +646,7 @@ const translation = { "GenerateNewQR": "Demander une autre preuve", "BackToList": "Retour à la liste", "ShareLink": "Lien de partage", - "ScanQR": "Afficher ce code QR à la personne qui demande la preuve", - "ScanQRComment": "Après le scan du code QR, une demande de preuve sera envoyée.", + "ScanQR": "Afficher ce code QR à la personne qui demande la preuve:", "InformationReceived": "Information reçue.", "InformationReceivedDetails": "Revoyer les informations ci-dessous.", "ProofVerificationFailed": "La vérification de la preuve a échoué", diff --git a/packages/legacy/core/App/localization/pt-br/index.ts b/packages/legacy/core/App/localization/pt-br/index.ts index 3de8db5a2b..01dbdc3306 100644 --- a/packages/legacy/core/App/localization/pt-br/index.ts +++ b/packages/legacy/core/App/localization/pt-br/index.ts @@ -627,8 +627,7 @@ const translation = { "GenerateNewQR": "Requisitar outra prova", "BackToList": "Voltar para a lista", "ShareLink": "Compartilhar link", - "ScanQR": "Mostrar este QR code para a outra pessoa", - "ScanQRComment": "Depois do QR code ser scaneado, a requisição de prova será enviada.", + "ScanQR": "Mostrar este QR code para a outra pessoa:", "InformationReceived": "Informação recebida.", "InformationReceivedDetails": "Revisar a informação abaixo.", "ProofVerificationFailed": "A verificação da prova falhou", diff --git a/packages/legacy/core/App/screens/ProofRequesting.tsx b/packages/legacy/core/App/screens/ProofRequesting.tsx index 963717fe20..4a0d24c6ae 100644 --- a/packages/legacy/core/App/screens/ProofRequesting.tsx +++ b/packages/legacy/core/App/screens/ProofRequesting.tsx @@ -84,13 +84,14 @@ const ProofRequesting: React.FC = ({ route, navigation }) }, headerContainer: { alignItems: 'center', - padding: 16, - marginHorizontal: 30, + paddingVertical: 16, + marginHorizontal: 20, textAlign: 'center', }, primaryHeaderText: { ...TextTheme.headingThree, textAlign: 'center', + marginTop: 20, }, secondaryHeaderText: { ...TextTheme.normal, @@ -216,8 +217,8 @@ const ProofRequesting: React.FC = ({ route, navigation }) {message && } - {t('Verifier.ScanQR')} - {t('Verifier.ScanQRComment')} + {t('Verifier.ScanQR')} + {template?.name} diff --git a/packages/legacy/core/App/utils/oca.ts b/packages/legacy/core/App/utils/oca.ts index 3af626e528..cbc334f393 100644 --- a/packages/legacy/core/App/utils/oca.ts +++ b/packages/legacy/core/App/utils/oca.ts @@ -62,6 +62,7 @@ export const buildFieldsFromSharedAnonCredsProof = (data: CredentialSharedProofD name: predicate.name, pType: predicate.predicateType, pValue: predicate.predicateValue, + satisfied: true, }) ) } diff --git a/packages/legacy/core/__tests__/screens/__snapshots__/ProofRequesting.test.tsx.snap b/packages/legacy/core/__tests__/screens/__snapshots__/ProofRequesting.test.tsx.snap index 4871d05e74..ab3f1d5568 100644 --- a/packages/legacy/core/__tests__/screens/__snapshots__/ProofRequesting.test.tsx.snap +++ b/packages/legacy/core/__tests__/screens/__snapshots__/ProofRequesting.test.tsx.snap @@ -77,8 +77,8 @@ exports[`ProofRequesting Component generate new qr works correctly 1`] = ` style={ Object { "alignItems": "center", - "marginHorizontal": 30, - "padding": 16, + "marginHorizontal": 20, + "paddingVertical": 16, "textAlign": "center", } } @@ -86,9 +86,10 @@ exports[`ProofRequesting Component generate new qr works correctly 1`] = ` - Verifier.ScanQRComment + Student full name @@ -274,8 +275,8 @@ exports[`ProofRequesting Component renders correctly 1`] = ` style={ Object { "alignItems": "center", - "marginHorizontal": 30, - "padding": 16, + "marginHorizontal": 20, + "paddingVertical": 16, "textAlign": "center", } } @@ -283,9 +284,10 @@ exports[`ProofRequesting Component renders correctly 1`] = ` - Verifier.ScanQRComment + Student full name @@ -427,8 +429,8 @@ exports[`ProofRequesting Component renders correctly 2`] = ` style={ Object { "alignItems": "center", - "marginHorizontal": 30, - "padding": 16, + "marginHorizontal": 20, + "paddingVertical": 16, "textAlign": "center", } } @@ -436,9 +438,10 @@ exports[`ProofRequesting Component renders correctly 2`] = ` - Verifier.ScanQRComment + Student full name diff --git a/packages/legacy/core/__tests__/screens/__snapshots__/W3cProofRequest.test.tsx.snap b/packages/legacy/core/__tests__/screens/__snapshots__/W3cProofRequest.test.tsx.snap index 85864dc558..adbafaaac3 100644 --- a/packages/legacy/core/__tests__/screens/__snapshots__/W3cProofRequest.test.tsx.snap +++ b/packages/legacy/core/__tests__/screens/__snapshots__/W3cProofRequest.test.tsx.snap @@ -914,7 +914,7 @@ exports[`displays a proof request screen with a proof request displays a proof r testID="com.ariesbifold:id/CredentialCard" >