From bff613de09e67409e730702f1b9c98c8f7df583c Mon Sep 17 00:00:00 2001 From: "Jason C. Leach" Date: Fri, 13 Dec 2024 13:38:59 -0800 Subject: [PATCH] feat: enable send video demo Signed-off-by: Jason C. Leach --- .../legacy/core/App/localization/index.ts | 9 +-- .../send-video/screens/VideoInstructions.tsx | 2 +- .../legacy/core/App/navigators/RootStack.tsx | 23 ++++---- packages/legacy/core/App/screens/Home.tsx | 59 +++++++++++-------- packages/legacy/core/App/types/navigators.ts | 1 + 5 files changed, 54 insertions(+), 40 deletions(-) diff --git a/packages/legacy/core/App/localization/index.ts b/packages/legacy/core/App/localization/index.ts index 7b557c35ad..0de6feb410 100644 --- a/packages/legacy/core/App/localization/index.ts +++ b/packages/legacy/core/App/localization/index.ts @@ -3,12 +3,13 @@ import { initReactI18next } from 'react-i18next' import * as RNLocalize from 'react-native-localize' import { PersistentStorage } from '../services/storage' import { LocalStorageKeys } from '../constants' +import { en as sendVideoEn, fr as sendVideoFr, ptBr as sendVideoPtBr } from '../modules/send-video/localization' import en from './en' import fr from './fr' import ptBr from './pt-br' -export type Translation = typeof en +export type Translation = typeof en & typeof sendVideoEn export type TranslationResources = { [key: string]: any @@ -16,13 +17,13 @@ export type TranslationResources = { export const translationResources: TranslationResources = { en: { - translation: en, + translation: { ...en, ...sendVideoEn }, }, fr: { - translation: fr, + translation: { ...fr, ...sendVideoFr }, }, 'pt-BR': { - translation: ptBr, + translation: { ...ptBr, ...sendVideoPtBr }, }, } diff --git a/packages/legacy/core/App/modules/send-video/screens/VideoInstructions.tsx b/packages/legacy/core/App/modules/send-video/screens/VideoInstructions.tsx index cdbc10a7a2..308a7fe877 100644 --- a/packages/legacy/core/App/modules/send-video/screens/VideoInstructions.tsx +++ b/packages/legacy/core/App/modules/send-video/screens/VideoInstructions.tsx @@ -21,7 +21,7 @@ import { useAgent } from '@credo-ts/react-hooks' type VideoInstructionsProps = StackScreenProps const sendVideoSvs = new SentVideoServices({ - sendVideoAgentInvitation: Config.VIDEO_VERIFIER_AGENT_INVITATION, + sendVideoAgentInvitation: Config.VIDEO_VERIFIER_AGENT_INVITATION ?? '', sendVideoAPIBaseUrl: Config.VIDEO_VERIFIER_HOST ?? '', }) diff --git a/packages/legacy/core/App/navigators/RootStack.tsx b/packages/legacy/core/App/navigators/RootStack.tsx index 2aaee95ac8..c9fd90c44d 100644 --- a/packages/legacy/core/App/navigators/RootStack.tsx +++ b/packages/legacy/core/App/navigators/RootStack.tsx @@ -1,11 +1,7 @@ import { ProofState } from '@credo-ts/core' import { useAgent, useProofByState } from '@credo-ts/react-hooks' import { ProofCustomMetadata, ProofMetadata } from '@hyperledger/aries-bifold-verifier' -import { - CardStyleInterpolators, - StackCardStyleInterpolator, - createStackNavigator, -} from '@react-navigation/stack' +import { CardStyleInterpolators, StackCardStyleInterpolator, createStackNavigator } from '@react-navigation/stack' import React, { useEffect } from 'react' import { useTranslation } from 'react-i18next' import { DeviceEventEmitter } from 'react-native' @@ -17,7 +13,8 @@ import { DispatchAction } from '../contexts/reducers/store' import { useStore } from '../contexts/store' import { useTheme } from '../contexts/theme' import { useDeepLinks } from '../hooks/deep-links' -import HistoryStack from '../modules/history/navigation/HistoryStack' +import HistoryStack from '../modules/history/navigators/HistoryStack' +import SendVideoStack from '../modules/send-video/navigators/SendVideoStack' import Chat from '../screens/Chat' import { BifoldError } from '../types/error' import { Screens, Stacks, TabStacks } from '../types/navigators' @@ -38,12 +35,7 @@ const RootStack: React.FC = () => { const { t } = useTranslation() const theme = useTheme() const defaultStackOptions = useDefaultStackOptions(theme) - const [ - splash, - OnboardingStack, - CustomNavStack1, - loadState, - ] = useServices([ + const [splash, OnboardingStack, CustomNavStack1, loadState] = useServices([ TOKENS.SCREEN_SPLASH, TOKENS.STACK_ONBOARDING, TOKENS.CUSTOM_NAV_STACK_1, @@ -136,6 +128,13 @@ const RootStack: React.FC = () => { cardStyleInterpolator: forFade, }} /> + {CustomNavStack1 ? : null} ) diff --git a/packages/legacy/core/App/screens/Home.tsx b/packages/legacy/core/App/screens/Home.tsx index ad946ed3ee..e90650e8ed 100644 --- a/packages/legacy/core/App/screens/Home.tsx +++ b/packages/legacy/core/App/screens/Home.tsx @@ -11,8 +11,10 @@ import { DispatchAction } from '../contexts/reducers/store' import { useStore } from '../contexts/store' import { useTheme } from '../contexts/theme' import { useTour } from '../contexts/tour/tour-context' -import { HomeStackParams, Screens } from '../types/navigators' +import { HomeStackParams, Screens, Stacks } from '../types/navigators' import { TourID } from '../types/tour' +import Button, { ButtonType } from '../components/buttons/Button' +import { useNavigation } from '@react-navigation/native' type HomeProps = StackScreenProps @@ -39,6 +41,7 @@ const Home: React.FC = () => { const { start, stop } = useTour() const [showTourPopup, setShowTourPopup] = useState(false) const screenIsFocused = useIsFocused() + const navigation = useNavigation() const styles = StyleSheet.create({ flatlist: { @@ -46,29 +49,32 @@ const Home: React.FC = () => { }, }) - const DisplayListItemType = useCallback((item: any): React.ReactNode => { - let component: React.ReactNode - if (item.type === 'BasicMessageRecord') { - component = - } else if (item.type === 'CredentialRecord') { - let notificationType = NotificationType.CredentialOffer - if (item.revocationNotification) { - notificationType = NotificationType.Revocation + const DisplayListItemType = useCallback( + (item: any): React.ReactNode => { + let component: React.ReactNode + if (item.type === 'BasicMessageRecord') { + component = + } else if (item.type === 'CredentialRecord') { + let notificationType = NotificationType.CredentialOffer + if (item.revocationNotification) { + notificationType = NotificationType.Revocation + } + component = + } else if (item.type === 'CustomNotification' && customNotification) { + component = ( + + ) + } else { + component = } - component = - } else if (item.type === 'CustomNotification' && customNotification) { - component = ( - - ) - } else { - component = - } - return component - }, [customNotification, NotificationListItem]) + return component + }, + [customNotification, NotificationListItem] + ) useEffect(() => { const shouldShowTour = enableToursConfig && store.tours.enableTours && !store.tours.seenHomeTour @@ -163,6 +169,13 @@ const Home: React.FC = () => { onDismissPressed={onDismissPressed} /> )} + +