metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

feat: new metamask notifications

Open matteoscurati opened this issue 1 year ago • 1 comments

Description

This PR introduces new features within the MetaMask Extension:

Authentication -> Users can choose to authenticate using the new Profile Syncing feature. This functionality allows users to anonymously share data across different clients authenticated with the same account. MetaMask cannot decrypt this information. Notifications -> Users can decide whether to enable notifications to track their on-chain activities. Notifications can be viewed on a dedicated page or received via browser notifications. Users can choose to activate or deactivate these services at any time.

Four new controllers are managing the feature, already merged in previous PRs:

  1. Authentication Controller
  2. User Storage Controller
  3. Push Notification Controller
  4. MetaMask Notification Controller Open in GitHub Codespaces

Related issues

Manual testing steps

To test the function, it is necessary:

  1. Follow the onboarding procedure.
  2. In the menu, use the notifications option to enable notifications.

At this point, the user will have enabled notifications.

Screenshots/Recordings

Before

After

To see the entire flow, there is this Figma where the various steps used are described:

https://www.figma.com/design/c7GgNw2kScGrVyRGAPhwEd/Notifications

Pre-merge author checklist

  • [x] I’ve followed MetaMask Coding Standards.
  • [x] I've completed the PR template to the best of my ability
  • [ ] I’ve included tests if applicable
  • [x] I’ve documented my code using JSDoc format if applicable
  • [x] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • [x] 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.

matteoscurati avatar May 10 '24 13:05 matteoscurati

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

github-actions[bot] avatar May 10 '24 13:05 github-actions[bot]

Codecov Report

Attention: Patch coverage is 37.47801% with 1066 lines in your changes are missing coverage. Please review.

Project coverage is 65.91%. Comparing base (6bd968b) to head (1c53708).

:exclamation: Current head 1c53708 differs from pull request most recent head 0e5c10a

Please upload reports for the commit 0e5c10a to get more accurate results.

Files Patch % Lines
...s/metamask-notifications/metamask-notifications.ts 7.09% 118 Missing :warning:
ui/helpers/utils/notification.util.ts 6.82% 82 Missing :warning:
...ts/erc1155-sent-received/erc1155-sent-received.tsx 9.52% 57 Missing :warning:
...ents/erc721-sent-received/erc721-sent-received.tsx 11.11% 48 Missing :warning:
...components/eth-sent-received/eth-sent-received.tsx 12.73% 48 Missing :warning:
...ifications/notification-components/stake/stake.tsx 12.73% 48 Missing :warning:
...ation-components/swap-completed/swap-completed.tsx 8.89% 41 Missing :warning:
ui/store/actions.ts 72.03% 40 Missing :warning:
...onents/erc20-sent-received/erc20-sent-received.tsx 13.33% 39 Missing :warning:
...withdrawal-requested/lido-withdrawal-requested.tsx 10.53% 34 Missing :warning:
... and 46 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #24482      +/-   ##
===========================================
- Coverage    67.42%   65.91%   -1.51%     
===========================================
  Files         1295     1346      +51     
  Lines        50378    52534    +2156     
  Branches     13047    13484     +437     
===========================================
+ Hits         33964    34625     +661     
- Misses       16414    17909    +1495     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 21 '24 08:05 codecov[bot]

The notifications settings page seems to have a major perf issue:

Screen.Recording.2024-05-17.at.11.53.37.AM.mov

hey @darkwing , thank you very much. The bug you reported for the settings page is related to the issue highlighted in this PR https://github.com/MetaMask/metamask-extension/pull/24623. If you agree, we would like to have this PR ready to then merge the next one

matteoscurati avatar May 21 '24 08:05 matteoscurati

The notifications settings page seems to have a major perf issue: Screen.Recording.2024-05-17.at.11.53.37.AM.mov

hey @darkwing , thank you very much. The bug you reported for the settings page is related to the issue highlighted in this PR #24623. If you agree, we would like to have this PR ready to then merge the next one

For more context, the KDF used is taking a considerable amount of time which is blocking the UI on MV2. (This is not an issue on MV3 as the logic is ran in the service worker).

See image

image

That separate PR significantly improves the time taken and should reduce blocking the rendering on MV2.

Also I'll do some more investigation on why this is blocking (the logic is async, how is it blocking the main thread lol)

Prithpal-Sooriya avatar May 21 '24 08:05 Prithpal-Sooriya

Builds ready [26e1329]
Page Load Metrics (1229 ± 623 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint651741123617
domContentLoaded95420157
load52308312291297623
domInteractive95420157
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 43.96 KiB (1.29%)
  • ui: 156.35 KiB (2.37%)
  • common: 10.78 KiB (0.17%)

metamaskbot avatar May 21 '24 13:05 metamaskbot

Builds ready [06e037e]
Page Load Metrics (1620 ± 637 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint66103816320297
domContentLoaded10388378139
load58327616201327637
domInteractive10388378139
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 44 KiB (1.29%)
  • ui: 156.44 KiB (2.37%)
  • common: 11.14 KiB (0.18%)

metamaskbot avatar May 21 '24 18:05 metamaskbot

Builds ready [7e4f7e3]
Page Load Metrics (981 ± 608 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint671701013517
domContentLoaded878202010
load5531429811265608
domInteractive878202010
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 44 KiB (1.29%)
  • ui: 156.44 KiB (2.37%)
  • common: 11.14 KiB (0.18%)

metamaskbot avatar May 21 '24 19:05 metamaskbot

Builds ready [210baa9]
Page Load Metrics (904 ± 549 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint622601004321
domContentLoaded9106202211
load5027959041144549
domInteractive9106202211
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 44 KiB (1.27%)
  • ui: 156.44 KiB (2.37%)
  • common: 11.14 KiB (0.18%)

metamaskbot avatar May 22 '24 05:05 metamaskbot

Builds ready [7a6145f]
Page Load Metrics (765 ± 516 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint61229974120
domContentLoaded95518147
load5025287651075516
domInteractive95518147
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 44 KiB (1.27%)
  • ui: 156.44 KiB (2.36%)
  • common: 11.14 KiB (0.18%)

metamaskbot avatar May 22 '24 12:05 metamaskbot

Builds ready [1c53708]
Page Load Metrics (1169 ± 582 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint632371083919
domContentLoaded109421199
load51282811691212582
domInteractive109421199
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 44 KiB (1.27%)
  • ui: 156.44 KiB (2.36%)
  • common: 11.14 KiB (0.18%)

metamaskbot avatar May 22 '24 15:05 metamaskbot

Builds ready [1c53708]
Page Load Metrics (1169 ± 582 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint632371083919
domContentLoaded109421199
load51282811691212582
domInteractive109421199
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 44 KiB (1.27%)
  • ui: 156.44 KiB (2.36%)
  • common: 11.14 KiB (0.18%)

metamaskbot avatar May 22 '24 15:05 metamaskbot

"approved" in order to dismiss resolved "request for changes"

legobeat avatar May 22 '24 15:05 legobeat

Builds ready [1c53708]
Page Load Metrics (1169 ± 582 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint632371083919
domContentLoaded109421199
load51282811691212582
domInteractive109421199
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 44 KiB (1.27%)
  • ui: 156.44 KiB (2.36%)
  • common: 11.14 KiB (0.18%)

metamaskbot avatar May 22 '24 15:05 metamaskbot

Builds ready [0e5c10a]
Page Load Metrics (1037 ± 577 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint632911025225
domContentLoaded98518178
load52320210371201577
domInteractive98518178
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 44 KiB (1.27%)
  • ui: 156.44 KiB (2.36%)
  • common: 11.14 KiB (0.18%)

metamaskbot avatar May 22 '24 16:05 metamaskbot

Builds ready [341d8b7]
Page Load Metrics (303 ± 338 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6212486178
domContentLoaded9351363
load512427303703338
domInteractive9351263
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 43.43 KiB (1.24%)
  • ui: 159.42 KiB (2.40%)
  • common: 11.22 KiB (0.18%)

metamaskbot avatar May 23 '24 00:05 metamaskbot

Builds ready [636d009]
Page Load Metrics (619 ± 537 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint69163902613
domContentLoaded8221342
load5631296191119537
domInteractive8221342
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 43.43 KiB (1.24%)
  • ui: 159.8 KiB (2.41%)
  • common: 11.4 KiB (0.18%)

metamaskbot avatar May 23 '24 09:05 metamaskbot

Builds ready [3e1e984]
Page Load Metrics (284 ± 320 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint5512278157
domContentLoaded8431384
load442500284666320
domInteractive8431384
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 43.03 KiB (1.23%)
  • ui: 158.83 KiB (2.40%)
  • common: 11.19 KiB (0.18%)

metamaskbot avatar May 23 '24 12:05 metamaskbot