-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
Conversation
…ommodate for snaps and updated NotificationServicesController tests
NotificationServicesController
to accommodate for Snaps NotificationsNotificationServicesController
to accommodate for Snaps Notifications & remove NotificationController
Removed dependencies detected. Learn more about Socket for GitHub ↗︎ 🚮 Removed packages: npm/@metamask/[email protected] |
CODEOWNER reviews are being triggered because I used the latest version of EDIT: Split the bumps into a different PR |
NotificationServicesController
to accommodate for Snaps Notifications & remove NotificationController
NotificationServicesController
to accommodate for Snaps 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.
Looks good, some initial comments.
I think we can move forward with this after our sync session.
...ion-services-controller/src/NotificationServicesController/NotificationServicesController.ts
Show resolved
Hide resolved
...tion-services-controller/src/NotificationServicesController/constants/notification-schema.ts
Show resolved
Hide resolved
...ion-services-controller/src/NotificationServicesController/NotificationServicesController.ts
Show resolved
Hide resolved
...ion-services-controller/src/NotificationServicesController/NotificationServicesController.ts
Show resolved
Hide resolved
...ion-services-controller/src/NotificationServicesController/NotificationServicesController.ts
Show resolved
Hide resolved
...ion-services-controller/src/NotificationServicesController/NotificationServicesController.ts
Show resolved
Hide resolved
...ion-services-controller/src/NotificationServicesController/NotificationServicesController.ts
Show resolved
Hide resolved
...vices-controller/src/NotificationServicesController/processors/process-notifications.test.ts
Show resolved
Hide resolved
...n-services-controller/src/NotificationServicesController/processors/process-notifications.ts
Outdated
Show resolved
Hide resolved
...on-services-controller/src/NotificationServicesController/types/notification/notification.ts
Show resolved
Hide resolved
## **Description** Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? Snap notifications were moved into the `NotificationServicesController` to reduce code duplication. 2. What is the improvement/solution? The `NotificationController` and associated code was deleted, as well as code that was written to process snap notifications. Parts of the codebase that expect snap notifications from the `NotificationController` source were also updated. See MetaMask/core#4809 for changes made to the `NotificationServicesController` ## **Screenshots/Recordings** ### **After** https://github.com/user-attachments/assets/e84f5209-20fa-4b1d-ace7-2eec08bb2329 ## **Manual testing steps** 1. Pull down https://github.com/hmalik88/swiss-knife-snap and run `yarn start` to serve the snap and site. 2. Build this branch using `yarn start:flask` 3. Install the snap from the local host site. 4. Trigger a notification with the "trigger a within limit notification" button and observe the results. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). 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.
Explanation
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.NotificationServicesController
updateMetamaskNotificationsList
function will be the gateway for snaps to add notifications to the controller.Changelog
@metamask/notification-services-controller
getNotificationsByType
to grab a list of notifications by type.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).fetchAndUpdateMetamaskNotifications
to grab snaps from state before repopulating with a new list of other notifications.markNotificaftionsAsRead
to account for snaps notifications.updateMetamaskNotificationsList
to assign a processed notification to state instead of the originally passed in notification as theprocessSnapNotification
function adds on extra properties to the raw notification.Checklist