From 45cd74c9172700d41a8cea6be7f9eba9b1a03ab3 Mon Sep 17 00:00:00 2001 From: Bryce McMath Date: Wed, 30 Oct 2024 17:07:33 -0700 Subject: [PATCH] refactor: address pr comments Signed-off-by: Bryce McMath --- app/container-imp.ts | 1 + app/src/localization/en/index.ts | 8 ++-- app/src/localization/fr/index.ts | 8 ++-- app/src/localization/pt-br/index.ts | 8 ++-- ...ardButton.test.tsx => TileButton.test.tsx} | 18 ++++---- ...test.tsx.snap => TileButton.test.tsx.snap} | 4 +- .../Birthdate.test.tsx | 2 +- .../Choose.test.tsx | 8 ++-- .../Instructions.test.tsx | 2 +- .../ManualSerial.test.tsx | 2 +- .../Scan.test.tsx | 2 +- .../__snapshots__/Birthdate.test.tsx.snap | 0 .../__snapshots__/Choose.test.tsx.snap | 0 .../__snapshots__/Instructions.test.tsx.snap | 0 .../__snapshots__/ManualSerial.test.tsx.snap | 0 .../__snapshots__/Scan.test.tsx.snap | 0 .../contents/VerificationSteps/Steps.test.tsx | 26 ++++++------ .../{CardButton.tsx => TileButton.tsx} | 12 +++--- .../unified/contents/EmailStep/.gitkeep | 0 .../Birthdate.tsx | 4 +- .../Choose.tsx | 12 +++--- .../Instructions.tsx | 10 +++-- .../ManualSerial.tsx | 22 ++++++---- .../Scan.tsx | 4 +- .../contents/ResidentialAddressStep/.gitkeep | 0 .../contents/VerificationSteps/Steps.tsx | 18 ++++---- .../contents/VerifyIdentityStep/.gitkeep | 0 .../navigators/VerifiedPersonStack.tsx | 42 +++++++++---------- .../{VerificationStep2.tsx => EmailStep.tsx} | 4 +- ...onStep1.tsx => EvidenceCollectionStep.tsx} | 24 +++++------ ...onStep3.tsx => ResidentialAddressStep.tsx} | 4 +- .../unified/screens/VerificationSteps.tsx | 23 ++++++---- ...cationStep4.tsx => VerifyIdentityStep.tsx} | 4 +- app/src/types/navigators.ts | 8 ++-- 34 files changed, 149 insertions(+), 131 deletions(-) rename app/src/modules/unified/__tests__/components/{CardButton.test.tsx => TileButton.test.tsx} (78%) rename app/src/modules/unified/__tests__/components/__snapshots__/{CardButton.test.tsx.snap => TileButton.test.tsx.snap} (95%) rename app/src/modules/unified/__tests__/contents/{VerificationStep1 => EvidenceCollectionStep}/Birthdate.test.tsx (93%) rename app/src/modules/unified/__tests__/contents/{VerificationStep1 => EvidenceCollectionStep}/Choose.test.tsx (79%) rename app/src/modules/unified/__tests__/contents/{VerificationStep1 => EvidenceCollectionStep}/Instructions.test.tsx (93%) rename app/src/modules/unified/__tests__/contents/{VerificationStep1 => EvidenceCollectionStep}/ManualSerial.test.tsx (95%) rename app/src/modules/unified/__tests__/contents/{VerificationStep1 => EvidenceCollectionStep}/Scan.test.tsx (83%) rename app/src/modules/unified/__tests__/contents/{VerificationStep1 => EvidenceCollectionStep}/__snapshots__/Birthdate.test.tsx.snap (100%) rename app/src/modules/unified/__tests__/contents/{VerificationStep1 => EvidenceCollectionStep}/__snapshots__/Choose.test.tsx.snap (100%) rename app/src/modules/unified/__tests__/contents/{VerificationStep1 => EvidenceCollectionStep}/__snapshots__/Instructions.test.tsx.snap (100%) rename app/src/modules/unified/__tests__/contents/{VerificationStep1 => EvidenceCollectionStep}/__snapshots__/ManualSerial.test.tsx.snap (100%) rename app/src/modules/unified/__tests__/contents/{VerificationStep1 => EvidenceCollectionStep}/__snapshots__/Scan.test.tsx.snap (100%) rename app/src/modules/unified/components/{CardButton.tsx => TileButton.tsx} (90%) create mode 100644 app/src/modules/unified/contents/EmailStep/.gitkeep rename app/src/modules/unified/contents/{VerificationStep1 => EvidenceCollectionStep}/Birthdate.tsx (94%) rename app/src/modules/unified/contents/{VerificationStep1 => EvidenceCollectionStep}/Choose.tsx (93%) rename app/src/modules/unified/contents/{VerificationStep1 => EvidenceCollectionStep}/Instructions.tsx (90%) rename app/src/modules/unified/contents/{VerificationStep1 => EvidenceCollectionStep}/ManualSerial.tsx (87%) rename app/src/modules/unified/contents/{VerificationStep1 => EvidenceCollectionStep}/Scan.tsx (90%) create mode 100644 app/src/modules/unified/contents/ResidentialAddressStep/.gitkeep create mode 100644 app/src/modules/unified/contents/VerifyIdentityStep/.gitkeep rename app/src/modules/unified/screens/{VerificationStep2.tsx => EmailStep.tsx} (81%) rename app/src/modules/unified/screens/{VerificationStep1.tsx => EvidenceCollectionStep.tsx} (86%) rename app/src/modules/unified/screens/{VerificationStep3.tsx => ResidentialAddressStep.tsx} (77%) rename app/src/modules/unified/screens/{VerificationStep4.tsx => VerifyIdentityStep.tsx} (77%) diff --git a/app/container-imp.ts b/app/container-imp.ts index 14dd5fa2..d7027110 100644 --- a/app/container-imp.ts +++ b/app/container-imp.ts @@ -213,6 +213,7 @@ export class AppContainer implements Container { }, ], enableTours: true, + enableChat: true, supportedLanguages: ['en'], showPreface: true, disableOnboardingSkip: true, diff --git a/app/src/localization/en/index.ts b/app/src/localization/en/index.ts index 013ead9d..936e961b 100644 --- a/app/src/localization/en/index.ts +++ b/app/src/localization/en/index.ts @@ -66,20 +66,20 @@ const translation = { "Settings": "Menu", "Preface": "BC Wallet", "VerificationSteps": "Setup steps", - "VerificationStep1": { + "EvidenceCollectionStep": { "Stage1": "Choose your identification", "Stage2": "Instructions", "Stage3": "Scan your identification", "Stage4": "Enter serial number", "Stage5": "Enter birthdate", }, - "VerificationStep2": { + "ResidentialAddressStep": { "Stage1": "TODO", }, - "VerificationStep3": { + "EmailStep": { "Stage1": "TODO", }, - "VerificationStep4": { + "VerifyIdentityStep": { "Stage1": "TODO", }, }, diff --git a/app/src/localization/fr/index.ts b/app/src/localization/fr/index.ts index 3c8d0907..8252dab3 100644 --- a/app/src/localization/fr/index.ts +++ b/app/src/localization/fr/index.ts @@ -66,20 +66,20 @@ const translation = { "Settings": "Menu", "Preface": "BC Wallet", "VerificationSteps": "Setup steps (FR)", - "VerificationStep1": { + "EvidenceCollectionStep": { "Stage1": "Choose your identification (FR)", "Stage2": "Instructions (FR)", "Stage3": "Scan your identification (FR)", "Stage4": "Enter serial number (FR)", "Stage5": "Enter birthdate (FR)", }, - "VerificationStep2": { + "ResidentialAddressStep": { "Stage1": "TODO", }, - "VerificationStep3": { + "EmailStep": { "Stage1": "TODO", }, - "VerificationStep4": { + "VerifyIdentityStep": { "Stage1": "TODO", }, }, diff --git a/app/src/localization/pt-br/index.ts b/app/src/localization/pt-br/index.ts index 8e8d9206..9c6ae014 100644 --- a/app/src/localization/pt-br/index.ts +++ b/app/src/localization/pt-br/index.ts @@ -66,20 +66,20 @@ const translation = { "Settings": "Menu (PT-BR)", "Preface": "BC Wallet", "VerificationSteps": "Setup steps (PT-BR)", - "VerificationStep1": { + "EvidenceCollectionStep": { "Stage1": "Choose your identification (PT-BR)", "Stage2": "Instructions (PT-BR)", "Stage3": "Scan your identification (PT-BR)", "Stage4": "Enter serial number (PT-BR)", "Stage5": "Enter birthdate (PT-BR)", }, - "VerificationStep2": { + "ResidentialAddressStep": { "Stage1": "TODO", }, - "VerificationStep3": { + "EmailStep": { "Stage1": "TODO", }, - "VerificationStep4": { + "VerifyIdentityStep": { "Stage1": "TODO", }, }, diff --git a/app/src/modules/unified/__tests__/components/CardButton.test.tsx b/app/src/modules/unified/__tests__/components/TileButton.test.tsx similarity index 78% rename from app/src/modules/unified/__tests__/components/CardButton.test.tsx rename to app/src/modules/unified/__tests__/components/TileButton.test.tsx index 570d0164..52fa782e 100644 --- a/app/src/modules/unified/__tests__/components/CardButton.test.tsx +++ b/app/src/modules/unified/__tests__/components/TileButton.test.tsx @@ -1,15 +1,15 @@ +import { testIdWithKey } from '@hyperledger/aries-bifold-core' import { fireEvent, render } from '@testing-library/react-native' import React from 'react' -import CardButton from '../../components/CardButton' -import { testIdWithKey } from '@hyperledger/aries-bifold-core' +import TileButton from '../../components/TileButton' -describe('CardButton Component', () => { +describe('TileButton Component', () => { const onPress = jest.fn() const actionText = 'Action text' const description = 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Quasi et consectetur iusto error aliquam' - const testIDKey = 'CardButton' + const testIDKey = 'TileButton' const accessibilityLabel = 'Card' beforeEach(() => { @@ -18,7 +18,7 @@ describe('CardButton Component', () => { test('renders correctly', () => { const tree = render( - { test('test ID is present and press handler works', () => { const { getByTestId } = render( - { /> ) - const cardButton = getByTestId(testIdWithKey(testIDKey)) - expect(cardButton).toBeDefined() - fireEvent(cardButton, 'press') + const tileButton = getByTestId(testIdWithKey(testIDKey)) + expect(tileButton).toBeDefined() + fireEvent(tileButton, 'press') expect(onPress).toHaveBeenCalledTimes(1) }) }) diff --git a/app/src/modules/unified/__tests__/components/__snapshots__/CardButton.test.tsx.snap b/app/src/modules/unified/__tests__/components/__snapshots__/TileButton.test.tsx.snap similarity index 95% rename from app/src/modules/unified/__tests__/components/__snapshots__/CardButton.test.tsx.snap rename to app/src/modules/unified/__tests__/components/__snapshots__/TileButton.test.tsx.snap index e1c947a3..c5d1b0f9 100644 --- a/app/src/modules/unified/__tests__/components/__snapshots__/CardButton.test.tsx.snap +++ b/app/src/modules/unified/__tests__/components/__snapshots__/TileButton.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`CardButton Component renders correctly 1`] = ` +exports[`TileButton Component renders correctly 1`] = ` { const onComplete = jest.fn() diff --git a/app/src/modules/unified/__tests__/contents/VerificationStep1/Choose.test.tsx b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/Choose.test.tsx similarity index 79% rename from app/src/modules/unified/__tests__/contents/VerificationStep1/Choose.test.tsx rename to app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/Choose.test.tsx index d5db406b..94a90a23 100644 --- a/app/src/modules/unified/__tests__/contents/VerificationStep1/Choose.test.tsx +++ b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/Choose.test.tsx @@ -3,7 +3,7 @@ import { fireEvent, render } from '@testing-library/react-native' import React from 'react' import { initialState, reducer } from '../../../../../store' -import ChooseContent from '../../../contents/VerificationStep1/Choose' +import ChooseContent from '../../../contents/EvidenceCollectionStep/Choose' describe('ChooseContent Component', () => { const goToInstructions = jest.fn() @@ -28,9 +28,9 @@ describe('ChooseContent Component', () => { ) - const continueButton = getByTestId(testIdWithKey('CombinedCard')) - expect(continueButton).toBeDefined() - fireEvent(continueButton, 'press') + const combinedCardTileButton = getByTestId(testIdWithKey('CombinedCard')) + expect(combinedCardTileButton).toBeDefined() + fireEvent(combinedCardTileButton, 'press') expect(goToInstructions).toHaveBeenCalledTimes(1) }) }) diff --git a/app/src/modules/unified/__tests__/contents/VerificationStep1/Instructions.test.tsx b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/Instructions.test.tsx similarity index 93% rename from app/src/modules/unified/__tests__/contents/VerificationStep1/Instructions.test.tsx rename to app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/Instructions.test.tsx index 44cdbd83..80ba8705 100644 --- a/app/src/modules/unified/__tests__/contents/VerificationStep1/Instructions.test.tsx +++ b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/Instructions.test.tsx @@ -1,7 +1,7 @@ import { fireEvent, render } from '@testing-library/react-native' import React from 'react' -import InstructionsContent from '../../../contents/VerificationStep1/Instructions' +import InstructionsContent from '../../../contents/EvidenceCollectionStep/Instructions' import { testIdWithKey } from '@hyperledger/aries-bifold-core' describe('InstructionsContent Component', () => { diff --git a/app/src/modules/unified/__tests__/contents/VerificationStep1/ManualSerial.test.tsx b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/ManualSerial.test.tsx similarity index 95% rename from app/src/modules/unified/__tests__/contents/VerificationStep1/ManualSerial.test.tsx rename to app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/ManualSerial.test.tsx index 6cadbc03..a42b5bb7 100644 --- a/app/src/modules/unified/__tests__/contents/VerificationStep1/ManualSerial.test.tsx +++ b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/ManualSerial.test.tsx @@ -3,7 +3,7 @@ import { fireEvent, render } from '@testing-library/react-native' import React from 'react' import { initialState, reducer } from '../../../../../store' -import ManualSerialContent from '../../../contents/VerificationStep1/ManualSerial' +import ManualSerialContent from '../../../contents/EvidenceCollectionStep/ManualSerial' describe('ManualSerialContent Component', () => { const goToBirthdate = jest.fn() diff --git a/app/src/modules/unified/__tests__/contents/VerificationStep1/Scan.test.tsx b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/Scan.test.tsx similarity index 83% rename from app/src/modules/unified/__tests__/contents/VerificationStep1/Scan.test.tsx rename to app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/Scan.test.tsx index 13d2892d..9ae85b2a 100644 --- a/app/src/modules/unified/__tests__/contents/VerificationStep1/Scan.test.tsx +++ b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/Scan.test.tsx @@ -1,7 +1,7 @@ import { render } from '@testing-library/react-native' import React from 'react' -import ScanContent from '../../../contents/VerificationStep1/Scan' +import ScanContent from '../../../contents/EvidenceCollectionStep/Scan' describe('ScanContent Component', () => { const goToBirthdate = jest.fn() diff --git a/app/src/modules/unified/__tests__/contents/VerificationStep1/__snapshots__/Birthdate.test.tsx.snap b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/__snapshots__/Birthdate.test.tsx.snap similarity index 100% rename from app/src/modules/unified/__tests__/contents/VerificationStep1/__snapshots__/Birthdate.test.tsx.snap rename to app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/__snapshots__/Birthdate.test.tsx.snap diff --git a/app/src/modules/unified/__tests__/contents/VerificationStep1/__snapshots__/Choose.test.tsx.snap b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/__snapshots__/Choose.test.tsx.snap similarity index 100% rename from app/src/modules/unified/__tests__/contents/VerificationStep1/__snapshots__/Choose.test.tsx.snap rename to app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/__snapshots__/Choose.test.tsx.snap diff --git a/app/src/modules/unified/__tests__/contents/VerificationStep1/__snapshots__/Instructions.test.tsx.snap b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/__snapshots__/Instructions.test.tsx.snap similarity index 100% rename from app/src/modules/unified/__tests__/contents/VerificationStep1/__snapshots__/Instructions.test.tsx.snap rename to app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/__snapshots__/Instructions.test.tsx.snap diff --git a/app/src/modules/unified/__tests__/contents/VerificationStep1/__snapshots__/ManualSerial.test.tsx.snap b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/__snapshots__/ManualSerial.test.tsx.snap similarity index 100% rename from app/src/modules/unified/__tests__/contents/VerificationStep1/__snapshots__/ManualSerial.test.tsx.snap rename to app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/__snapshots__/ManualSerial.test.tsx.snap diff --git a/app/src/modules/unified/__tests__/contents/VerificationStep1/__snapshots__/Scan.test.tsx.snap b/app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/__snapshots__/Scan.test.tsx.snap similarity index 100% rename from app/src/modules/unified/__tests__/contents/VerificationStep1/__snapshots__/Scan.test.tsx.snap rename to app/src/modules/unified/__tests__/contents/EvidenceCollectionStep/__snapshots__/Scan.test.tsx.snap diff --git a/app/src/modules/unified/__tests__/contents/VerificationSteps/Steps.test.tsx b/app/src/modules/unified/__tests__/contents/VerificationSteps/Steps.test.tsx index 43af1435..253874e4 100644 --- a/app/src/modules/unified/__tests__/contents/VerificationSteps/Steps.test.tsx +++ b/app/src/modules/unified/__tests__/contents/VerificationSteps/Steps.test.tsx @@ -5,10 +5,10 @@ import VerificationStepsContent from '../../../contents/VerificationSteps/Steps' import { testIdWithKey } from '@hyperledger/aries-bifold-core' describe('VerificationStepsContent Component', () => { - const goToStep1 = jest.fn() - const goToStep2 = jest.fn() - const goToStep3 = jest.fn() - const goToStep4 = jest.fn() + const goToEvidenceCollectionStep = jest.fn() + const goToResidentialAddressStep = jest.fn() + const goToEmailStep = jest.fn() + const goToVerifyIdentityStep = jest.fn() beforeEach(() => { jest.resetAllMocks() @@ -17,10 +17,10 @@ describe('VerificationStepsContent Component', () => { test('renders correctly', () => { const tree = render( ) expect(tree).toMatchSnapshot() @@ -29,16 +29,16 @@ describe('VerificationStepsContent Component', () => { test('Step1 test ID is present and press handler works', () => { const { getByTestId } = render( ) const step1Button = getByTestId(testIdWithKey('Step1')) expect(step1Button).toBeDefined() fireEvent(step1Button, 'press') - expect(goToStep1).toHaveBeenCalledTimes(1) + expect(goToEvidenceCollectionStep).toHaveBeenCalledTimes(1) }) }) diff --git a/app/src/modules/unified/components/CardButton.tsx b/app/src/modules/unified/components/TileButton.tsx similarity index 90% rename from app/src/modules/unified/components/CardButton.tsx rename to app/src/modules/unified/components/TileButton.tsx index eb6d0a43..db7d8b0f 100644 --- a/app/src/modules/unified/components/CardButton.tsx +++ b/app/src/modules/unified/components/TileButton.tsx @@ -2,7 +2,7 @@ import { testIdWithKey, useTheme } from '@hyperledger/aries-bifold-core' import { Text, View, Image, StyleSheet, Pressable, ImageSourcePropType, ViewStyle } from 'react-native' import Icon from 'react-native-vector-icons/MaterialCommunityIcons' -export type CardButtonProps = { +export type TileButtonProps = { onPress: () => void testIDKey: string accessibilityLabel: string @@ -12,7 +12,7 @@ export type CardButtonProps = { style?: ViewStyle } -const CardButton: React.FC = ({ +const TileButton: React.FC = ({ onPress, testIDKey, accessibilityLabel, @@ -20,10 +20,10 @@ const CardButton: React.FC = ({ description, imgSrc, style, -}: CardButtonProps) => { +}: TileButtonProps) => { const { ColorPallet, TextTheme } = useTheme() const styles = StyleSheet.create({ - card: { + tile: { borderRadius: 4, backgroundColor: ColorPallet.notification.info, padding: 24, @@ -50,7 +50,7 @@ const CardButton: React.FC = ({ testID={testIdWithKey(testIDKey)} accessibilityLabel={accessibilityLabel} > - + {actionText} @@ -64,4 +64,4 @@ const CardButton: React.FC = ({ ) } -export default CardButton +export default TileButton diff --git a/app/src/modules/unified/contents/EmailStep/.gitkeep b/app/src/modules/unified/contents/EmailStep/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/app/src/modules/unified/contents/VerificationStep1/Birthdate.tsx b/app/src/modules/unified/contents/EvidenceCollectionStep/Birthdate.tsx similarity index 94% rename from app/src/modules/unified/contents/VerificationStep1/Birthdate.tsx rename to app/src/modules/unified/contents/EvidenceCollectionStep/Birthdate.tsx index eba22d81..284d550c 100644 --- a/app/src/modules/unified/contents/VerificationStep1/Birthdate.tsx +++ b/app/src/modules/unified/contents/EvidenceCollectionStep/Birthdate.tsx @@ -7,11 +7,11 @@ import { SafeAreaView } from 'react-native-safe-area-context' import { BCDispatchAction, BCState } from '../../../../store' -type ContentProps = { +type BirthdateContentProps = { onComplete: () => void } -const BirthdateContent: React.FC = ({ onComplete }: ContentProps) => { +const BirthdateContent: React.FC = ({ onComplete }: BirthdateContentProps) => { const today = new Date() const { t } = useTranslation() const { ColorPallet, TextTheme } = useTheme() diff --git a/app/src/modules/unified/contents/VerificationStep1/Choose.tsx b/app/src/modules/unified/contents/EvidenceCollectionStep/Choose.tsx similarity index 93% rename from app/src/modules/unified/contents/VerificationStep1/Choose.tsx rename to app/src/modules/unified/contents/EvidenceCollectionStep/Choose.tsx index ac0a5691..32e4f211 100644 --- a/app/src/modules/unified/contents/VerificationStep1/Choose.tsx +++ b/app/src/modules/unified/contents/EvidenceCollectionStep/Choose.tsx @@ -5,17 +5,17 @@ import { Text, StyleSheet, ScrollView, Pressable, View, useWindowDimensions } fr import { SafeAreaView } from 'react-native-safe-area-context' import Icon from 'react-native-vector-icons/MaterialCommunityIcons' -import CardButton, { CardButtonProps } from '../../components/CardButton' +import TileButton, { TileButtonProps } from '../../components/TileButton' import { BCDispatchAction, BCState } from '../../../../store' import { UnifiedCardType } from '../../types' const pagePadding = 24 -type ContentProps = { +type ChooseContentProps = { goToInstructions: () => void } -const ChooseContent: React.FC = ({ goToInstructions }: ContentProps) => { +const ChooseContent: React.FC = ({ goToInstructions }: ChooseContentProps) => { const { t } = useTranslation() const { ColorPallet, TextTheme } = useTheme() const [, dispatch] = useStore() @@ -111,8 +111,8 @@ const ChooseContent: React.FC = ({ goToInstructions }: ContentProp imgSrc: require('../../assets/img/no_photo_card.png'), style: { marginBottom: 16 }, }, - ] as CardButtonProps[] - ).map((props, i) => ) + ] as TileButtonProps[] + ).map((props, i) => ) }, [onPressCombinedCard, onPressPhotoCard, onPressNoPhotoCard, t]) return ( @@ -137,7 +137,7 @@ const ChooseContent: React.FC = ({ goToInstructions }: ContentProp - void goToManualSerial: () => void } -const InstructionsContent: React.FC = ({ goToScan, goToManualSerial }: ContentProps) => { +const InstructionsContent: React.FC = ({ + goToScan, + goToManualSerial, +}: InstructionsContentProps) => { const { t } = useTranslation() const { ColorPallet, TextTheme } = useTheme() const { width } = useWindowDimensions() @@ -33,7 +37,7 @@ const InstructionsContent: React.FC = ({ goToScan, goToManualSeria }, image: { width: width - pagePadding * 2, - height: (width - pagePadding * 2) * 0.67, + height: (width - pagePadding * 2) * twoThirds, marginBottom: 24, }, heading: { diff --git a/app/src/modules/unified/contents/VerificationStep1/ManualSerial.tsx b/app/src/modules/unified/contents/EvidenceCollectionStep/ManualSerial.tsx similarity index 87% rename from app/src/modules/unified/contents/VerificationStep1/ManualSerial.tsx rename to app/src/modules/unified/contents/EvidenceCollectionStep/ManualSerial.tsx index 1b76359c..4c0748e6 100644 --- a/app/src/modules/unified/contents/VerificationStep1/ManualSerial.tsx +++ b/app/src/modules/unified/contents/EvidenceCollectionStep/ManualSerial.tsx @@ -14,17 +14,19 @@ import { Image, StyleSheet, Text, useWindowDimensions, View } from 'react-native import { BCDispatchAction, BCState } from '../../../../store' const pagePadding = 24 +const twoThirds = 0.67 +const maxSerialNumberLength = 15 type ErrorState = { visible: boolean description: string } -interface ContentProps { +type ManualSerialContentProps = { goToBirthdate: () => void } -const ManualSerialContent: React.FC = ({ goToBirthdate }: ContentProps) => { +const ManualSerialContent: React.FC = ({ goToBirthdate }: ManualSerialContentProps) => { const { t } = useTranslation() const { ColorPallet, TextTheme } = useTheme() const [store, dispatch] = useStore() @@ -47,7 +49,7 @@ const ManualSerialContent: React.FC = ({ goToBirthdate }: ContentP }, image: { width: width - pagePadding * 2, - height: (width - pagePadding * 2) * 0.67, + height: (width - pagePadding * 2) * twoThirds, marginBottom: 24, }, error: { @@ -79,15 +81,19 @@ const ManualSerialContent: React.FC = ({ goToBirthdate }: ContentP description: t('Unified.ManualSerial.EmptySerialError'), visible: true, }) - } else if (serial.length > 15) { + return + } + + if (serial.length > maxSerialNumberLength) { setErrorState({ description: t('Unified.ManualSerial.CharCountError'), visible: true, }) - } else { - dispatch({ type: BCDispatchAction.UPDATE_SERIAL, payload: [serial] }) - goToBirthdate() + return } + + dispatch({ type: BCDispatchAction.UPDATE_SERIAL, payload: [serial] }) + goToBirthdate() }, [serial, t, dispatch, goToBirthdate]) return ( @@ -102,7 +108,7 @@ const ManualSerialContent: React.FC = ({ goToBirthdate }: ContentP void } -const ScanContent: React.FC = () => { +const ScanContent: React.FC = () => { const { ColorPallet, TextTheme } = useTheme() const styles = StyleSheet.create({ diff --git a/app/src/modules/unified/contents/ResidentialAddressStep/.gitkeep b/app/src/modules/unified/contents/ResidentialAddressStep/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/app/src/modules/unified/contents/VerificationSteps/Steps.tsx b/app/src/modules/unified/contents/VerificationSteps/Steps.tsx index 69e722d6..9df0fd2b 100644 --- a/app/src/modules/unified/contents/VerificationSteps/Steps.tsx +++ b/app/src/modules/unified/contents/VerificationSteps/Steps.tsx @@ -13,14 +13,16 @@ interface SetupStep { testIDKey: string } -type ContentProps = { - goToStep1: () => void - goToStep2: () => void - goToStep3: () => void - goToStep4: () => void +type VerificationStepsContentProps = { + goToEvidenceCollectionStep: () => void + goToResidentialAddressStep: () => void + goToEmailStep: () => void + goToVerifyIdentityStep: () => void } -export const VerificationStepsContent: React.FC = ({ goToStep1 }: ContentProps) => { +export const VerificationStepsContent: React.FC = ({ + goToEvidenceCollectionStep, +}: VerificationStepsContentProps) => { const { ColorPallet, TextTheme } = useTheme() const { t } = useTranslation() @@ -74,7 +76,7 @@ export const VerificationStepsContent: React.FC = ({ goToStep1 }: active: true, complete: false, content: {t('Unified.Steps.ScanOrTakePhotos')}, - onPress: () => goToStep1(), + onPress: () => goToEvidenceCollectionStep(), testIDKey: 'Step1', }, { @@ -111,7 +113,7 @@ export const VerificationStepsContent: React.FC = ({ goToStep1 }: testIDKey: 'Step4', }, ] - }, [styles, t, goToStep1]) + }, [styles, t, goToEvidenceCollectionStep]) return ( diff --git a/app/src/modules/unified/contents/VerifyIdentityStep/.gitkeep b/app/src/modules/unified/contents/VerifyIdentityStep/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/app/src/modules/unified/navigators/VerifiedPersonStack.tsx b/app/src/modules/unified/navigators/VerifiedPersonStack.tsx index 38efc50e..8b57cce1 100644 --- a/app/src/modules/unified/navigators/VerifiedPersonStack.tsx +++ b/app/src/modules/unified/navigators/VerifiedPersonStack.tsx @@ -7,20 +7,20 @@ import { } from '@hyperledger/aries-bifold-core' import { createStackNavigator } from '@react-navigation/stack' import { useTranslation } from 'react-i18next' -import VerificationStep1 from '../screens/VerificationStep1' -import VerificationStep2 from '../screens/VerificationStep2' -import VerificationStep3 from '../screens/VerificationStep3' -import VerificationStep4 from '../screens/VerificationStep4' -import VerificationSteps from '../screens/VerificationSteps' +import EvidenceCollectionStep from '../screens/EvidenceCollectionStep' +import ResidentialAddressStep from '../screens/ResidentialAddressStep' +import EmailStep from '../screens/EmailStep' +import VerifyIdentityStep from '../screens/VerifyIdentityStep' +import VerificationSteps from '../screens/VerificationSteps' import { BCScreens } from '../../../types/navigators' export type BCVerifiedPersonStackParams = { [BCScreens.VerificationSteps]: undefined - [BCScreens.VerificationStep1]: undefined - [BCScreens.VerificationStep2]: undefined - [BCScreens.VerificationStep3]: undefined - [BCScreens.VerificationStep4]: undefined + [BCScreens.EvidenceCollectionStep]: undefined + [BCScreens.ResidentialAddressStep]: undefined + [BCScreens.EmailStep]: undefined + [BCScreens.VerifyIdentityStep]: undefined } const VerifiedPersonStack: React.FC = () => { @@ -48,10 +48,10 @@ const VerifiedPersonStack: React.FC = () => { }} /> ( { }} /> ( { }} /> ( { }} /> ( { +const EmailStepScreen: React.FC = () => { const styles = StyleSheet.create({ container: { flex: 1, @@ -18,4 +18,4 @@ const Step2Screen: React.FC = () => { ) } -export default Step2Screen +export default EmailStepScreen diff --git a/app/src/modules/unified/screens/VerificationStep1.tsx b/app/src/modules/unified/screens/EvidenceCollectionStep.tsx similarity index 86% rename from app/src/modules/unified/screens/VerificationStep1.tsx rename to app/src/modules/unified/screens/EvidenceCollectionStep.tsx index 6f642293..85f77e6b 100644 --- a/app/src/modules/unified/screens/VerificationStep1.tsx +++ b/app/src/modules/unified/screens/EvidenceCollectionStep.tsx @@ -4,11 +4,11 @@ import { HeaderBackButton, HeaderBackButtonProps } from '@react-navigation/eleme import { useCallback, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' -import ChooseContent from '../contents/VerificationStep1/Choose' -import InstructionsContent from '../contents/VerificationStep1/Instructions' -import ScanContent from '../contents/VerificationStep1/Scan' -import ManualSerialContent from '../contents/VerificationStep1/ManualSerial' -import BirthdateContent from '../contents/VerificationStep1/Birthdate' +import ChooseContent from '../contents/EvidenceCollectionStep/Choose' +import InstructionsContent from '../contents/EvidenceCollectionStep/Instructions' +import ScanContent from '../contents/EvidenceCollectionStep/Scan' +import ManualSerialContent from '../contents/EvidenceCollectionStep/ManualSerial' +import BirthdateContent from '../contents/EvidenceCollectionStep/Birthdate' const Stages = { Choose: 1, @@ -18,7 +18,7 @@ const Stages = { Birthdate: 5, } as const -const Step1Screen: React.FC = () => { +const EvidenceCollectionStepScreen: React.FC = () => { const [stage, setStage] = useState(1) const navigation = useNavigation() const { t } = useTranslation() @@ -26,7 +26,7 @@ const Step1Screen: React.FC = () => { const StageNavOptionsMap = useMemo( () => ({ 1: { - title: t('Screens.VerificationStep1.Stage1'), + title: t('Screens.EvidenceCollectionStep.Stage1'), headerLeft: (props: HeaderBackButtonProps) => ( { ), }, 2: { - title: t('Screens.VerificationStep1.Stage2'), + title: t('Screens.EvidenceCollectionStep.Stage2'), headerLeft: (props: HeaderBackButtonProps) => ( { ), }, 3: { - title: t('Screens.VerificationStep1.Stage3'), + title: t('Screens.EvidenceCollectionStep.Stage3'), headerLeft: (props: HeaderBackButtonProps) => ( { ), }, 4: { - title: t('Screens.VerificationStep1.Stage4'), + title: t('Screens.EvidenceCollectionStep.Stage4'), headerLeft: (props: HeaderBackButtonProps) => ( { ), }, 5: { - title: t('Screens.VerificationStep1.Stage5'), + title: t('Screens.EvidenceCollectionStep.Stage5'), headerLeft: (props: HeaderBackButtonProps) => ( { return } -export default Step1Screen +export default EvidenceCollectionStepScreen diff --git a/app/src/modules/unified/screens/VerificationStep3.tsx b/app/src/modules/unified/screens/ResidentialAddressStep.tsx similarity index 77% rename from app/src/modules/unified/screens/VerificationStep3.tsx rename to app/src/modules/unified/screens/ResidentialAddressStep.tsx index 9b216739..fd8474b9 100644 --- a/app/src/modules/unified/screens/VerificationStep3.tsx +++ b/app/src/modules/unified/screens/ResidentialAddressStep.tsx @@ -1,6 +1,6 @@ import { Text, View, StyleSheet } from 'react-native' -const Step3Screen: React.FC = () => { +const ResidentialAddressScreen: React.FC = () => { const styles = StyleSheet.create({ container: { flex: 1, @@ -18,4 +18,4 @@ const Step3Screen: React.FC = () => { ) } -export default Step3Screen +export default ResidentialAddressScreen diff --git a/app/src/modules/unified/screens/VerificationSteps.tsx b/app/src/modules/unified/screens/VerificationSteps.tsx index 573ee35f..74d43497 100644 --- a/app/src/modules/unified/screens/VerificationSteps.tsx +++ b/app/src/modules/unified/screens/VerificationSteps.tsx @@ -7,24 +7,29 @@ import VerificationStepsContent from '../contents/VerificationSteps/Steps' const VerificationStepsScreen: React.FC = () => { const navigation = useNavigation() - const goToStep1 = useCallback(() => { - navigation.navigate(BCScreens.VerificationStep1 as never) + const goToEvidenceCollectionStep = useCallback(() => { + navigation.navigate(BCScreens.EvidenceCollectionStep as never) }, [navigation]) - const goToStep2 = useCallback(() => { - navigation.navigate(BCScreens.VerificationStep2 as never) + const goToResidentialAddressStep = useCallback(() => { + navigation.navigate(BCScreens.ResidentialAddressStep as never) }, [navigation]) - const goToStep3 = useCallback(() => { - navigation.navigate(BCScreens.VerificationStep3 as never) + const goToEmailStep = useCallback(() => { + navigation.navigate(BCScreens.EmailStep as never) }, [navigation]) - const goToStep4 = useCallback(() => { - navigation.navigate(BCScreens.VerificationStep4 as never) + const goToVerifyIdentityStep = useCallback(() => { + navigation.navigate(BCScreens.VerifyIdentityStep as never) }, [navigation]) return ( - + ) } diff --git a/app/src/modules/unified/screens/VerificationStep4.tsx b/app/src/modules/unified/screens/VerifyIdentityStep.tsx similarity index 77% rename from app/src/modules/unified/screens/VerificationStep4.tsx rename to app/src/modules/unified/screens/VerifyIdentityStep.tsx index 29f8341f..fa105986 100644 --- a/app/src/modules/unified/screens/VerificationStep4.tsx +++ b/app/src/modules/unified/screens/VerifyIdentityStep.tsx @@ -1,6 +1,6 @@ import { Text, View, StyleSheet } from 'react-native' -const Step4Screen: React.FC = () => { +const VerifyIdentityStepScreen: React.FC = () => { const styles = StyleSheet.create({ container: { flex: 1, @@ -18,4 +18,4 @@ const Step4Screen: React.FC = () => { ) } -export default Step4Screen +export default VerifyIdentityStepScreen diff --git a/app/src/types/navigators.ts b/app/src/types/navigators.ts index 9a915456..b18df40f 100644 --- a/app/src/types/navigators.ts +++ b/app/src/types/navigators.ts @@ -1,7 +1,7 @@ export enum BCScreens { VerificationSteps = 'VerificationSteps', - VerificationStep1 = 'VerificationStep1', - VerificationStep2 = 'VerificationStep2', - VerificationStep3 = 'VerificationStep3', - VerificationStep4 = 'VerificationStep4', + EvidenceCollectionStep = 'EvidenceCollectionStep', + ResidentialAddressStep = 'ResidentialAddressStep', + EmailStep = 'EmailStep', + VerifyIdentityStep = 'VerifyIdentityStep', }