diff --git a/packages/legacy/core/App/constants.ts b/packages/legacy/core/App/constants.ts index 0682eb1dcb..3b06618b99 100644 --- a/packages/legacy/core/App/constants.ts +++ b/packages/legacy/core/App/constants.ts @@ -1,13 +1,11 @@ import { PINValidationRules } from './types/security' -const lengthOfhiddenAttributes = 10 +const lengthOfHiddenAttributes = 10 const unicodeForBulletCharacter = '\u2022' -export const whereToUseWalletUrl = 'http://example.com' - export const dateIntFormat = 'YYYYMMDD' -export const hiddenFieldValue = Array(lengthOfhiddenAttributes).fill(unicodeForBulletCharacter).join('') +export const hiddenFieldValue = Array(lengthOfHiddenAttributes).fill(unicodeForBulletCharacter).join('') // Used to property prefix TestIDs so they can be looked up // by on-device automated testing systems like SauceLabs. export const testIdPrefix = 'com.ariesbifold:id/' diff --git a/packages/legacy/core/App/contexts/configuration.tsx b/packages/legacy/core/App/contexts/configuration.tsx index 127ce6c72d..058446c071 100644 --- a/packages/legacy/core/App/contexts/configuration.tsx +++ b/packages/legacy/core/App/contexts/configuration.tsx @@ -34,13 +34,11 @@ export interface ConfigurationContext { OCABundleResolver: OCABundleResolverType proofTemplateBaseUrl?: string scan: React.FC - useBiometry: React.FC record: React.FC PINSecurity: PINSecurityParams indyLedgers: IndyVdrPoolConfig[] settings: SettingSection[] customNotification: NotificationConfiguration - useCustomNotifications: () => { total: number; notifications: any } supportedLanguages: Locales[] connectionTimerDelay?: number autoRedirectConnectionToHome?: boolean @@ -50,6 +48,9 @@ export interface ConfigurationContext { enableReuseConnections?: boolean showPreface?: boolean disableOnboardingSkip?: boolean + useBiometry: React.FC + useCustomNotifications: () => { total: number; notifications: any } + whereToUseWalletUrl: string } export const ConfigurationContext = createContext(null as unknown as ConfigurationContext) diff --git a/packages/legacy/core/App/defaultConfiguration.ts b/packages/legacy/core/App/defaultConfiguration.ts index da5c998244..ebe307d007 100644 --- a/packages/legacy/core/App/defaultConfiguration.ts +++ b/packages/legacy/core/App/defaultConfiguration.ts @@ -36,7 +36,6 @@ export const defaultConfiguration: ConfigurationContext = { brandingOverlayType: BrandingOverlayType.Branding10, }), scan: Scan, - useBiometry: UseBiometry, record: Record, PINSecurity: { rules: PINRules, displayHelper: false }, indyLedgers: defaultIndyLedgers, @@ -49,10 +48,12 @@ export const defaultConfiguration: ConfigurationContext = { buttonTitle: '', pageTitle: '', }, - useCustomNotifications: useNotifications, proofRequestTemplates: useProofRequestTemplates, enableTours: false, supportedLanguages: Object.keys(translationResources) as Locales[], showPreface: false, disableOnboardingSkip: false, + useCustomNotifications: useNotifications, + useBiometry: UseBiometry, + whereToUseWalletUrl: 'https://example.com', } diff --git a/packages/legacy/core/App/screens/ScanHelp.tsx b/packages/legacy/core/App/screens/ScanHelp.tsx index 61d00efc93..e4aeda0d2f 100644 --- a/packages/legacy/core/App/screens/ScanHelp.tsx +++ b/packages/legacy/core/App/screens/ScanHelp.tsx @@ -4,12 +4,13 @@ import { Linking, ScrollView, StyleSheet, Text } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' import Link from '../components/texts/Link' -import { whereToUseWalletUrl } from '../constants' +import { useConfiguration } from '../contexts/configuration' import { useTheme } from '../contexts/theme' import { testIdWithKey } from '../utils/testable' const ScanHelp: React.FC = () => { const { t } = useTranslation() + const { whereToUseWalletUrl } = useConfiguration() const { TextTheme } = useTheme() const style = StyleSheet.create({ diff --git a/packages/legacy/core/__tests__/contexts/configuration.ts b/packages/legacy/core/__tests__/contexts/configuration.ts index 84d4f41812..d584f58c46 100644 --- a/packages/legacy/core/__tests__/contexts/configuration.ts +++ b/packages/legacy/core/__tests__/contexts/configuration.ts @@ -6,7 +6,6 @@ import { useNotifications } from '../../App/hooks/notifications' import { useProofRequestTemplates } from '../../verifier/request-templates' import { Locales } from '../../App/localization' - const configurationContext: ConfigurationContext = { pages: () => [], terms: () => null, @@ -48,6 +47,7 @@ const configurationContext: ConfigurationContext = { useCustomNotifications: useNotifications, proofRequestTemplates: useProofRequestTemplates, supportedLanguages: [Locales.en, Locales.fr, Locales.ptBr], + whereToUseWalletUrl: 'https://example.com', } export default configurationContext diff --git a/packages/legacy/core/__tests__/screens/ScanHelp.test.tsx b/packages/legacy/core/__tests__/screens/ScanHelp.test.tsx index 90ccace27d..a6aa0e9f69 100644 --- a/packages/legacy/core/__tests__/screens/ScanHelp.test.tsx +++ b/packages/legacy/core/__tests__/screens/ScanHelp.test.tsx @@ -2,6 +2,8 @@ import { fireEvent, render } from '@testing-library/react-native' import React from 'react' import ScanHelp from '../../App/screens/ScanHelp' +import { ConfigurationContext } from '../../App/contexts/configuration' +import configurationContext from '../contexts/configuration' import { testIdWithKey } from '../../App/utils/testable' jest.mock('@react-navigation/core', () => { @@ -13,12 +15,20 @@ jest.mock('@react-navigation/native', () => { describe('ScanHelp Screen', () => { test('Renders correctly', async () => { - const tree = render() + const tree = render( + + + + ) expect(tree).toMatchSnapshot() }) test('Link button exists and is accessible', async () => { - const tree = render() + const tree = render( + + + + ) const { getByTestId } = tree const linkButton = getByTestId(testIdWithKey('WhereToUseLink'))