From 52500fbfe0c29e80e6d00b5369b5447b33560273 Mon Sep 17 00:00:00 2001 From: Omridan159 Date: Mon, 20 Nov 2023 11:21:32 +0200 Subject: [PATCH 1/2] feat: display the dapp icon when connecting with sdk --- .../UI/SignatureRequest/ExpandedMessage/index.js | 8 +++++++- app/components/UI/SignatureRequest/index.js | 8 +++++++- app/components/UI/TransactionHeader/index.js | 4 ++-- app/core/SDKConnect/Connection.ts | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/components/UI/SignatureRequest/ExpandedMessage/index.js b/app/components/UI/SignatureRequest/ExpandedMessage/index.js index c968a2e4e5c..cce7cc87582 100644 --- a/app/components/UI/SignatureRequest/ExpandedMessage/index.js +++ b/app/components/UI/SignatureRequest/ExpandedMessage/index.js @@ -92,6 +92,7 @@ export default class ExpandedMessage extends PureComponent { const { currentPageInformation, renderMessage, toggleExpandedMessage } = this.props; const url = currentPageInformation.url; + const icon = currentPageInformation.icon; const title = getHost(url); const colors = this.context.colors || mockTheme.colors; const styles = createStyles(colors); @@ -113,7 +114,12 @@ export default class ExpandedMessage extends PureComponent { - + {strings('signature_request.message_from')} {title} diff --git a/app/components/UI/SignatureRequest/index.js b/app/components/UI/SignatureRequest/index.js index b8f51ad6c29..547d5261c34 100644 --- a/app/components/UI/SignatureRequest/index.js +++ b/app/components/UI/SignatureRequest/index.js @@ -243,6 +243,7 @@ class SignatureRequest extends PureComponent { } = this.props; const styles = this.getStyles(); const url = currentPageInformation.url; + const icon = currentPageInformation.icon; const title = getHost(url); const arrowIcon = truncateMessage ? this.renderArrowIcon() : null; return ( @@ -258,7 +259,12 @@ class SignatureRequest extends PureComponent { style={styles.children} onPress={truncateMessage ? toggleExpandedMessage : null} > - + {strings('signature_request.message')}: diff --git a/app/components/UI/TransactionHeader/index.js b/app/components/UI/TransactionHeader/index.js index 70faa5b4674..ac52320b18a 100644 --- a/app/components/UI/TransactionHeader/index.js +++ b/app/components/UI/TransactionHeader/index.js @@ -145,7 +145,7 @@ const TransactionHeader = (props) => { const renderTopIcon = () => { const { currentEnsName, icon, origin } = props.currentPageInformation; let url = props.currentPageInformation.url; - if (originIsDeeplink) { + if (originIsDeeplink && !icon) { return ( { viewStyle={styles.assetLogo} title={iconTitle} url={currentEnsName || url} - icon={icon?.uri} + icon={typeof icon === 'string' ? icon : icon?.uri} /> ); }; diff --git a/app/core/SDKConnect/Connection.ts b/app/core/SDKConnect/Connection.ts index 83aad217b36..0e7d9d412c0 100644 --- a/app/core/SDKConnect/Connection.ts +++ b/app/core/SDKConnect/Connection.ts @@ -682,7 +682,7 @@ export class Connection extends EventEmitter2 { title: { current: originatorInfo?.title, }, - icon: { current: undefined }, + icon: { current: originatorInfo?.icon }, // Bookmarks isHomepage: () => false, // Show autocomplete From 45e5fa5c9255c91456b587bf07912d615af04ec0 Mon Sep 17 00:00:00 2001 From: Omridan159 Date: Mon, 20 Nov 2023 15:31:47 +0200 Subject: [PATCH 2/2] fix: unit tests --- .../Root/__snapshots__/Root.test.tsx.snap | 41 +------------------ 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/app/components/UI/SignatureRequest/Root/__snapshots__/Root.test.tsx.snap b/app/components/UI/SignatureRequest/Root/__snapshots__/Root.test.tsx.snap index 0bd3f2faa89..b15a0924ca2 100644 --- a/app/components/UI/SignatureRequest/Root/__snapshots__/Root.test.tsx.snap +++ b/app/components/UI/SignatureRequest/Root/__snapshots__/Root.test.tsx.snap @@ -387,46 +387,7 @@ exports[`Root should match snapshot 1`] = ` } } > - - - - m - - - +