From 313b374c94e9ce25c1ce07bf87fc8815fee73131 Mon Sep 17 00:00:00 2001 From: ZouidiSamih Date: Thu, 23 Jan 2025 14:28:46 -0500 Subject: [PATCH] feat: export connection alert modal (#1408) Signed-off-by: ZouidiSamih --- packages/legacy/core/App/container-api.ts | 2 ++ packages/legacy/core/App/container-impl.ts | 2 ++ packages/legacy/core/App/screens/CredentialOffer.tsx | 6 +++--- packages/legacy/core/App/screens/ProofRequest.tsx | 6 +++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/legacy/core/App/container-api.ts b/packages/legacy/core/App/container-api.ts index 1438ee83f..a0e1cf342 100644 --- a/packages/legacy/core/App/container-api.ts +++ b/packages/legacy/core/App/container-api.ts @@ -65,6 +65,7 @@ export const COMPONENT_TOKENS = { COMPONENT_PIN_CREATE_HEADER: 'component.pin-create-header', COMPONENT_CONTACT_LIST_ITEM: 'component.contact-list-item', COMPONENT_CONTACT_DETAILS_CRED_LIST_ITEM: 'component.contact-details-cred-list-item', + COMPONENT_CONNECTION_ALERT: 'component.connection-alert', } as const export const NOTIFICATION_TOKENS = { @@ -195,6 +196,7 @@ export type TokenMapping = { [TOKENS.COMPONENT_CONTACT_DETAILS_CRED_LIST_ITEM]: React.FC [TOKENS.INLINE_ERRORS]: InlineErrorConfig [TOKENS.CUSTOM_NAV_STACK_1]: React.FC + [TOKENS.COMPONENT_CONNECTION_ALERT]: React.FC<{ connectionID?: string }> } export interface Container { diff --git a/packages/legacy/core/App/container-impl.ts b/packages/legacy/core/App/container-impl.ts index a42b44f78..eac2a0fd6 100644 --- a/packages/legacy/core/App/container-impl.ts +++ b/packages/legacy/core/App/container-impl.ts @@ -51,6 +51,7 @@ import ContactListItem from './components/listItems/ContactListItem' import ContactCredentialListItem from './components/listItems/ContactCredentialListItem' import { InlineErrorPosition } from './types/error' import { DefaultScreenLayoutOptions } from './navigators/defaultLayoutOptions' +import ConnectionAlert from './components/misc/ConnectionAlert' export const defaultConfig: Config = { PINSecurity: { rules: PINRules, displayHelper: false }, @@ -144,6 +145,7 @@ export class MainContainer implements Container { this._container.registerInstance(TOKENS.COMPONENT_RECORD, Record) this._container.registerInstance(TOKENS.COMPONENT_CONTACT_LIST_ITEM, ContactListItem) this._container.registerInstance(TOKENS.COMPONENT_CONTACT_DETAILS_CRED_LIST_ITEM, ContactCredentialListItem) + this._container.registerInstance(TOKENS.COMPONENT_CONNECTION_ALERT, ConnectionAlert) this._container.registerInstance(TOKENS.CACHE_CRED_DEFS, []) this._container.registerInstance(TOKENS.CACHE_SCHEMAS, []) this._container.registerInstance(TOKENS.INLINE_ERRORS, { diff --git a/packages/legacy/core/App/screens/CredentialOffer.tsx b/packages/legacy/core/App/screens/CredentialOffer.tsx index 5bddbe735..8f856319e 100644 --- a/packages/legacy/core/App/screens/CredentialOffer.tsx +++ b/packages/legacy/core/App/screens/CredentialOffer.tsx @@ -10,7 +10,6 @@ import { DeviceEventEmitter, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' import Button, { ButtonType } from '../components/buttons/Button' -import ConnectionAlert from '../components/misc/ConnectionAlert' import ConnectionImage from '../components/misc/ConnectionImage' import CredentialCard from '../components/misc/CredentialCard' import CommonRemoveModal from '../components/modals/CommonRemoveModal' @@ -75,6 +74,7 @@ const CredentialOffer: React.FC = ({ navigation, credentia const { start } = useTour() const screenIsFocused = useIsFocused() const goalCode = useOutOfBandByConnectionId(credential?.connectionId ?? '')?.outOfBandInvitation?.goalCode + const [ConnectionAlert] = useServices([TOKENS.COMPONENT_CONNECTION_ALERT]) const styles = StyleSheet.create({ headerTextContainer: { @@ -278,9 +278,9 @@ const CredentialOffer: React.FC = ({ navigation, credentia }} > {loading ? : null} - {credentialConnectionLabel && goalCode === 'aries.vc.issue' ? ( + {(credentialConnectionLabel && goalCode === 'aries.vc.issue') && ( - ) : null} + )}