Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add first time interaction warning #28435

Conversation

OGPoyraz
Copy link
Member

@OGPoyraz OGPoyraz commented Nov 13, 2024

Description

This PR implements first time interaction feature where it shows an alert if you interact with the address for the first time.
Information of the first time interaction is fetched in the transaction controller when the transaction is added to the state.

Core PR: MetaMask/core#4895

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3040

Manual testing steps

  1. Go to test dapp
  2. Use send legacy transaction - make sure you interact here with your account for the first time
  3. See warning

Screenshots/Recordings

Before

After

Screenshot 2024-11-13 at 11 51 14

Screenshot 2024-11-13 at 11 51 19

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@OGPoyraz OGPoyraz requested review from a team as code owners November 13, 2024 11:23
@metamaskbot metamaskbot added the team-confirmations Push issues to confirmations team label Nov 13, 2024
@OGPoyraz OGPoyraz changed the title Add firstTimeInteraction feat feat: Add first time interaction warning Nov 13, 2024
package.json Outdated
@@ -256,7 +256,8 @@
"@ledgerhq/evm-tools/axios": "^0.28.0",
"@ledgerhq/hw-app-eth/axios": "^0.28.0",
"@ledgerhq/hw-app-eth@npm:^6.39.0": "patch:@ledgerhq/hw-app-eth@npm%3A6.39.0#~/.yarn/patches/@ledgerhq-hw-app-eth-npm-6.39.0-866309bbbe.patch",
"@ledgerhq/evm-tools@npm:^1.2.3": "patch:@ledgerhq/evm-tools@npm%3A1.2.3#~/.yarn/patches/@ledgerhq-evm-tools-npm-1.2.3-414f44baa9.patch"
"@ledgerhq/evm-tools@npm:^1.2.3": "patch:@ledgerhq/evm-tools@npm%3A1.2.3#~/.yarn/patches/@ledgerhq-evm-tools-npm-1.2.3-414f44baa9.patch",
"@metamask/transaction-controller@^38.3.0": "npm:@metamask-previews/[email protected]"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to not forget to remove preview version

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@metamaskbot
Copy link
Collaborator

Builds ready [b1764e7]
Page Load Metrics (2157 ± 130 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint36530781889663318
domContentLoaded171528562101254122
load173530102157272130
domInteractive297943136
backgroundConnect9176453818
firstReactRender602941287737
getState482841296833
initialActions01000
loadScripts12752178159120498
setupStore679212612
uiStartup199435582608436209
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 89 Bytes (0.00%)
  • ui: 2.76 KiB (0.04%)
  • common: 6.78 KiB (0.08%)

matthewwalsh0
matthewwalsh0 previously approved these changes Nov 22, 2024
app/scripts/metamask-controller.js Show resolved Hide resolved
}}
>
{/* Intentional fragment */}
<></>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, can we make the children optional within ConfirmInfoAlertRow or does this force some kind of spacing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

const t = useI18nContext();
const { currentConfirmation } = useConfirmContext();

const { isFirstTimeInteraction } = currentConfirmation as TransactionMeta;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, useConfirmContext accepts a template so we can avoid the cast.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -2091,6 +2091,12 @@
"message": "File import not working? Click here!",
"description": "Helps user import their account from a JSON file"
},
"firstTimeInteractionReason": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, I think we try and standardise these with alertReasonX and alertMessageX.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up

).toEqual([]);
});

it('returns no alerts if firstTimeInteraction is false', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, is it worth an undefined test also?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@metamaskbot
Copy link
Collaborator

Builds ready [2285d3c]
Page Load Metrics (1829 ± 97 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint48222351752349168
domContentLoaded15372192178819795
load15562241182920297
domInteractive2588432110
backgroundConnect982442612
firstReactRender17100402512
getState56217178
initialActions01000
loadScripts10661696131517484
setupStore67512157
uiStartup168725692059257124
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 89 Bytes (0.00%)
  • ui: 1.72 KiB (0.02%)
  • common: 3.34 KiB (0.04%)

@metamaskbot
Copy link
Collaborator

Builds ready [8afa23c]
Page Load Metrics (1495 ± 41 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint36517581455266128
domContentLoaded1390167014748139
load1394169614958641
domInteractive216838188
backgroundConnect66623168
firstReactRender1572352311
getState45114157
initialActions01000
loadScripts995126110857134
setupStore66011157
uiStartup15351970165911053
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 89 Bytes (0.00%)
  • ui: 1.71 KiB (0.02%)
  • common: 3.34 KiB (0.04%)

style={{
flexDirection: FlexDirection.Column,
alignItems: AlignItems.flexStart,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this to be sure, this is not needed.

@metamaskbot
Copy link
Collaborator

Builds ready [42ce181]
Page Load Metrics (1706 ± 82 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14432179170517283
domContentLoaded14262112167016177
load14642178170617082
domInteractive258841199
backgroundConnect9125382813
firstReactRender1777432211
getState56918199
initialActions01000
loadScripts10291624123213264
setupStore65711115
uiStartup16382351189017383
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 89 Bytes (0.00%)
  • ui: 1.75 KiB (0.02%)
  • common: 3.34 KiB (0.04%)

@metamaskbot
Copy link
Collaborator

Builds ready [c60c010]
Page Load Metrics (1724 ± 68 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint15212150172714469
domContentLoaded14782083169113967
load15102096172414268
domInteractive247634126
backgroundConnect96934178
firstReactRender168027178
getState45921199
initialActions01000
loadScripts10621575123211656
setupStore65215168
uiStartup16792350191816680
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 89 Bytes (0.00%)
  • ui: 1.75 KiB (0.02%)
  • common: 3.34 KiB (0.04%)

@OGPoyraz OGPoyraz enabled auto-merge November 26, 2024 14:03
@OGPoyraz OGPoyraz added this pull request to the merge queue Nov 26, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [7801103]
Page Load Metrics (1699 ± 65 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint15062024170912660
domContentLoaded14891956167512359
load15042029169913465
domInteractive268745209
backgroundConnect87325189
firstReactRender1683402512
getState56019199
initialActions00000
loadScripts10781451123210249
setupStore66517189
uiStartup16792219191014971
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 89 Bytes (0.00%)
  • ui: 1.75 KiB (0.02%)
  • common: 3.34 KiB (0.04%)

Merged via the queue into develop with commit af9ebca Nov 26, 2024
75 checks passed
@OGPoyraz OGPoyraz deleted the 3040-alert-for-when-interacting-with-an-address-for-the-first-time branch November 26, 2024 15:04
@github-actions github-actions bot locked and limited conversation to collaborators Nov 26, 2024
@metamaskbot metamaskbot added the release-12.9.0 Issue or pull request that will be included in release 12.9.0 label Nov 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.9.0 Issue or pull request that will be included in release 12.9.0 team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants