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

Update NotificationServicesController to accommodate for Snaps Notifications #4809

Merged
merged 33 commits into from
Oct 21, 2024

Conversation

hmalik88
Copy link
Contributor

@hmalik88 hmalik88 commented Oct 17, 2024

Explanation

  • What is the current state of things and why does it need to change? We currently have snap types living in the extension, which should exist in this repo instead. Also, the extension is using two controllers to handle notifications, the NotificationController solely exists for the purpose of snap notifications. With the revamping of the notifications system, it is best to house all notifications in one place.
  • What is the solution your changes offer and how does it work? Add snap logic to the NotificationServicesController
  • Are there any changes whose purpose might not obvious to those unfamiliar with the domain? The updateMetamaskNotificationsList function will be the gateway for snaps to add notifications to the controller.

Changelog

@metamask/notification-services-controller

  • ADDED: getNotificationsByType to grab a list of notifications by type.
  • ADDED: deleteNotificationById to delete a notification in the controller's state (to be only used by notifications that live in this controller which currently is just snaps).
  • CHANGED: fetchAndUpdateMetamaskNotifications to grab snaps from state before repopulating with a new list of other notifications.
  • CHANGED: markNotificaftionsAsRead to account for snaps notifications.
  • CHANGED: updateMetamaskNotificationsList to assign a processed notification to state instead of the originally passed in notification as the processSnapNotification function adds on extra properties to the raw notification.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@hmalik88 hmalik88 requested a review from a team as a code owner October 17, 2024 17:50
@hmalik88 hmalik88 requested review from a team as code owners October 17, 2024 18:04
@hmalik88 hmalik88 requested review from a team as code owners October 17, 2024 18:23
@hmalik88 hmalik88 changed the title Update NotificationServicesController to accommodate for Snaps Notifications Update NotificationServicesController to accommodate for Snaps Notifications & remove NotificationController Oct 17, 2024
Copy link

socket-security bot commented Oct 17, 2024

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: npm/@metamask/[email protected]

View full report↗︎

@hmalik88
Copy link
Contributor Author

hmalik88 commented Oct 17, 2024

CODEOWNER reviews are being triggered because I used the latest version of @metamask/utils in the NotificationServicesController and was required to update the rest of the packages as well to be in parity. There are no breaking changes from 9.1.0 -> 9.3.0

EDIT: Split the bumps into a different PR

@hmalik88 hmalik88 changed the title Update NotificationServicesController to accommodate for Snaps Notifications & remove NotificationController Update NotificationServicesController to accommodate for Snaps Notifications Oct 17, 2024
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya left a comment

Choose a reason for hiding this comment

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

Looks good, some initial comments.

I think we can move forward with this after our sync session.

@hmalik88 hmalik88 merged commit d75a971 into main Oct 21, 2024
116 checks passed
@hmalik88 hmalik88 deleted the hm/add-snap-notifications branch October 21, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants