diff --git a/packages/legacy/app/ios/Podfile.lock b/packages/legacy/app/ios/Podfile.lock index e362e478d..f50b1213c 100644 --- a/packages/legacy/app/ios/Podfile.lock +++ b/packages/legacy/app/ios/Podfile.lock @@ -735,14 +735,14 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: anoncreds: 8e6ab626d5250ae6301c3e96d6fc739186e083f0 aries-askar: 738c677e194913ed3c256adc953db3fe0494f8f8 - boost: 57d2868c099736d80fcd648bf211b4431e51a558 + boost: a7c83b31436843459a1961bfd74b96033dc77234 CatCrypto: a477899b6be4954e75be4897e732da098cc0a5a8 CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 - DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 + DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 FBLazyVector: 71803c074f6325f10b5ec891c443b6bbabef0ca7 FBReactNativeSpec: 448e08a759d29a96e15725ae532445bf4343567c fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b + glog: 5337263514dd6f09803962437687240c5dc39aa4 hermes-engine: f6cf92a471053245614d9d8097736f6337d5b86c indy-vdr: 85cd66089f151256581323440e78988891f4082e libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 @@ -806,4 +806,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 91c24b25407631a4023c96a168470f60d473e28f -COCOAPODS: 1.13.0 +COCOAPODS: 1.15.2 diff --git a/packages/legacy/core/App/container-api.ts b/packages/legacy/core/App/container-api.ts index bc9aad23a..12830fd6d 100644 --- a/packages/legacy/core/App/container-api.ts +++ b/packages/legacy/core/App/container-api.ts @@ -6,7 +6,7 @@ import { Button } from './components/buttons/Button-api' import { ReducerAction } from './contexts/reducers/store' import Onboarding from './screens/Onboarding' import { GenericFn } from './types/fn' -import { AuthenticateStackParams } from './types/navigators' +import { AuthenticateStackParams, ScreenOptionsType } from './types/navigators' export enum SCREEN_TOKENS { SCREEN_PREFACE = 'screen.preface', @@ -30,7 +30,18 @@ export enum SERVICE_TOKENS { SERVICE_TERMS = 'screen.terms', } -export const TOKENS = { ...SCREEN_TOKENS, ...SERVICE_TOKENS, ...STACK_TOKENS, ...FN_TOKENS, ...COMP_TOKENS } +export enum OBJECT_TOKENS { + OBJECT_ONBOARDINGCONFIG = 'object.onboarding-config', +} + +export const TOKENS = { + ...SCREEN_TOKENS, + ...SERVICE_TOKENS, + ...STACK_TOKENS, + ...FN_TOKENS, + ...COMP_TOKENS, + ...OBJECT_TOKENS, +} export type FN_ONBOARDING_DONE = ( dispatch: React.Dispatch>, @@ -45,6 +56,7 @@ export interface TokenMapping { [TOKENS.SCREEN_ONBOARDING]: typeof Onboarding [TOKENS.FN_ONBOARDING_DONE]: FN_ONBOARDING_DONE [TOKENS.COMP_BUTTON]: Button + [TOKENS.OBJECT_ONBOARDINGCONFIG]: ScreenOptionsType } export interface Container { diff --git a/packages/legacy/core/App/container-impl.ts b/packages/legacy/core/App/container-impl.ts index 0ab059978..8e08a4347 100644 --- a/packages/legacy/core/App/container-impl.ts +++ b/packages/legacy/core/App/container-impl.ts @@ -6,6 +6,7 @@ import Button from './components/buttons/Button' import { TOKENS, Container, TokenMapping } from './container-api' import { DispatchAction, ReducerAction } from './contexts/reducers/store' import OnboardingStack from './navigators/OnboardingStack' +import { DefaultScreenOptionsDictionary } from './navigators/defaultStackOptions' import Developer from './screens/Developer' import Onboarding from './screens/Onboarding' import Preface from './screens/Preface' @@ -27,6 +28,7 @@ export class MainContainer implements Container { this.container.registerInstance(TOKENS.SCREEN_ONBOARDING, Onboarding) this.container.registerInstance(TOKENS.STACK_ONBOARDING, OnboardingStack) this.container.registerInstance(TOKENS.COMP_BUTTON, Button) + this.container.registerInstance(TOKENS.OBJECT_ONBOARDINGCONFIG, DefaultScreenOptionsDictionary) this.container.registerInstance( TOKENS.FN_ONBOARDING_DONE, diff --git a/packages/legacy/core/App/navigators/OnboardingStack.tsx b/packages/legacy/core/App/navigators/OnboardingStack.tsx index e6c36c288..293cd48ae 100644 --- a/packages/legacy/core/App/navigators/OnboardingStack.tsx +++ b/packages/legacy/core/App/navigators/OnboardingStack.tsx @@ -20,7 +20,6 @@ import { createCarouselStyle } from '../screens/OnboardingPages' import PINCreate from '../screens/PINCreate' import PushNotification from '../screens/PushNotification' import { AuthenticateStackParams, Screens } from '../types/navigators' -import { testIdWithKey } from '../utils/testable' import { createDefaultStackOptions } from './defaultStackOptions' @@ -49,6 +48,7 @@ const OnboardingStack: React.FC = () => { const onTutorialCompleted = container.resolve(TOKENS.FN_ONBOARDING_DONE)(dispatch, navigation) const { screen: Terms } = container.resolve(TOKENS.SCREEN_TERMS) const Developer = container.resolve(TOKENS.SCREEN_DEVELOPER) + const ScreenOptionsDictionary = container.resolve(TOKENS.OBJECT_ONBOARDINGCONFIG) const Preface = container.resolve(TOKENS.SCREEN_PREFACE) const onAuthenticated = (status: boolean): void => { @@ -83,38 +83,31 @@ const OnboardingStack: React.FC = () => { component: Preface, options: () => { return { + ...ScreenOptionsDictionary[Screens.Preface], title: t('Screens.Preface'), - headerTintColor: OnboardingTheme.headerTintColor, - headerShown: true, - headerLeft: () => false, } }, }, { name: Screens.Splash, component: splash, + options: ScreenOptionsDictionary[Screens.Splash], }, { name: Screens.Onboarding, component: OnBoardingScreen, options: () => { return { + ...ScreenOptionsDictionary[Screens.Onboarding], title: t('Screens.Onboarding'), - headerTintColor: OnboardingTheme.headerTintColor, - headerShown: true, - gestureEnabled: false, - headerLeft: () => false, } }, }, { name: Screens.Terms, options: () => ({ + ...ScreenOptionsDictionary[Screens.Terms], title: t('Screens.Terms'), - headerTintColor: OnboardingTheme.headerTintColor, - headerShown: true, - headerLeft: () => false, - rightLeft: () => false, }), component: Terms, }, @@ -123,42 +116,31 @@ const OnboardingStack: React.FC = () => { component: CreatePINScreen, initialParams: {}, options: () => ({ + ...ScreenOptionsDictionary[Screens.CreatePIN], title: t('Screens.CreatePIN'), - headerShown: true, - headerLeft: () => false, - rightLeft: () => false, }), }, { name: Screens.NameWallet, options: () => ({ + ...ScreenOptionsDictionary[Screens.CreatePIN], title: t('Screens.NameWallet'), - headerTintColor: OnboardingTheme.headerTintColor, - headerShown: true, - headerLeft: () => false, - rightLeft: () => false, }), component: NameWallet, }, { name: Screens.UseBiometry, options: () => ({ + ...ScreenOptionsDictionary[Screens.CreatePIN], title: t('Screens.Biometry'), - headerTintColor: OnboardingTheme.headerTintColor, - headerShown: true, - headerLeft: () => false, - rightLeft: () => false, }), component: useBiometry, }, { name: Screens.UsePushNotifications, options: () => ({ + ...ScreenOptionsDictionary[Screens.CreatePIN], title: t('Screens.UsePushNotifications'), - headerTintColor: OnboardingTheme.headerTintColor, - headerShown: true, - headerLeft: () => false, - rightLeft: () => false, }), component: PushNotification, }, @@ -167,18 +149,16 @@ const OnboardingStack: React.FC = () => { component: Developer, options: () => { return { + ...ScreenOptionsDictionary[Screens.Developer], title: t('Screens.Developer'), - headerTintColor: OnboardingTheme.headerTintColor, - headerShown: true, headerBackAccessibilityLabel: t('Global.Back'), - headerBackTestID: testIdWithKey('Back'), } }, }, ] return ( - + {screens.map((item) => { return })} diff --git a/packages/legacy/core/App/navigators/defaultStackOptions.tsx b/packages/legacy/core/App/navigators/defaultStackOptions.tsx index f6550e44c..10a366ab1 100644 --- a/packages/legacy/core/App/navigators/defaultStackOptions.tsx +++ b/packages/legacy/core/App/navigators/defaultStackOptions.tsx @@ -4,7 +4,48 @@ import { useTranslation } from 'react-i18next' import HeaderTitle from '../components/texts/HeaderTitle' import { useConfiguration } from '../contexts/configuration' -import { ITheme } from '../theme' +import { ITheme, OnboardingTheme } from '../theme' +import { ScreenOptionsType, Screens } from '../types/navigators' +import { testIdWithKey } from '../utils/testable' + +export const DefaultScreenOptionsDictionary: ScreenOptionsType = { + [Screens.Preface]: { + headerTintColor: OnboardingTheme.headerTintColor, + headerLeft: () => false, + }, + [Screens.Splash]: { + headerShown: false, + }, + [Screens.Onboarding]: { + headerTintColor: OnboardingTheme.headerTintColor, + gestureEnabled: false, + headerLeft: () => false, + }, + [Screens.Terms]: { + headerTintColor: OnboardingTheme.headerTintColor, + headerLeft: () => false, + }, + [Screens.CreatePIN]: { + headerLeft: () => false, + }, + [Screens.NameWallet]: { + headerTintColor: OnboardingTheme.headerTintColor, + headerLeft: () => false, + }, + [Screens.UseBiometry]: { + headerTintColor: OnboardingTheme.headerTintColor, + headerLeft: () => false, + }, + [Screens.Developer]: { + headerTintColor: OnboardingTheme.headerTintColor, + headerShown: false, + headerBackTestID: testIdWithKey('Back'), + }, + [Screens.UsePushNotifications]: { + headerTintColor: OnboardingTheme.headerTintColor, + headerLeft: () => false, + }, +} export function createDefaultStackOptions({ ColorPallet }: ITheme): StackNavigationOptions { const { t } = useTranslation() diff --git a/packages/legacy/core/App/types/navigators.ts b/packages/legacy/core/App/types/navigators.ts index 521a94e28..3ebbfc654 100644 --- a/packages/legacy/core/App/types/navigators.ts +++ b/packages/legacy/core/App/types/navigators.ts @@ -1,5 +1,6 @@ import { CredentialExchangeRecord } from '@aries-framework/core' import { NavigatorScreenParams } from '@react-navigation/core' +import { StackNavigationOptions } from '@react-navigation/stack' export enum Screens { AttemptLockout = 'Temporarily Locked', @@ -164,3 +165,5 @@ export type DeliveryStackParams = { [Screens.Declined]: { credentialId: string } [Screens.Chat]: { connectionId: string } } + +export type ScreenOptionsType = Partial>