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: new metamask notifications #24482
Conversation
…ns controller states
ensures that snaps are still visible and not blocked by enabling wallet notifications
this is a small prompt to help guide users to the new feature if they have no notifications
… feat/new-metamask-notifications
Builds ready [341d8b7]
Page Load Metrics (303 ± 338 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
we can sync with snaps team to make sure that the new UI is aligned.
@@ -104,11 +104,11 @@ describe('Test Snap Notification', function () { | |||
|
|||
// look for the correct text in notifications (via xpath) | |||
await driver.waitForSelector({ | |||
css: '.notifications__item__details__message', | |||
css: '.snap-notifications__item__details__message', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
classname change - the corresponding scss classname has also been updated. We are retaining the original styles.
FUTURE - a separate PR will be made to see if we can get snap notifications to be in a "similar-ish" design to the other notifications. See Figma
snapNotification: SnapNotification; | ||
}; | ||
|
||
function NotificationItem({ snapNotification }: SnapComponentProps) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the original snap notification item. Mostly ported over from JS to TS (which found some bugs) - we kept as is (using @ts-expect-error
). These fixes, alongside a minor redesign that both teams are satisfied with, will come in a separate PR.
export type SnapNotification = { | ||
id: string; | ||
createdAt: string; | ||
isRead: boolean; | ||
type: typeof SNAP; | ||
data: RawSnapNotification; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new snap notification shape.
The data
field retains the original snap shape.
The reason for these additional fields are for Notification interface consistency & so we can figure out which notification is which (via the type
field acting as a discriminated union.)
import type { RawSnapNotification, SnapNotification } from '../types/types'; | ||
import { SNAP } from '../types/types'; | ||
|
||
export const processSnapNotifications = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an internal process to convert snap notifications into the new shape (which vibes with the rest of out notifications).
Builds ready [636d009]
Page Load Metrics (619 ± 537 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
app/scripts/controllers/metamask-notifications/metamask-notifications.ts
Outdated
Show resolved
Hide resolved
this includes removing the toggle and removing from our controller. If we need fine grain control, this will happen in a future PR
… feat/new-metamask-notifications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-approving the privacy snapshot changes (I also have reviewed most of the code in the app/
directory)
Builds ready [3e1e984]
Page Load Metrics (284 ± 320 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
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:
Related issues
Manual testing steps
To test the function, it is necessary:
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
Pre-merge reviewer checklist