-
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure push notifications are able to be subscribed to when the …
…wallet is locked (#4653) ## Explanation Push notifications currently are only able to be subscribed to when the wallet is unlocked on initialisation. So if a user closes and re-opens a browser, they will not attach the push subscription, and thus will receive silent push notifications. We now add an additional method that allows us to decouple the authenticated methods (create new registration token and send to server), which can only be done when the wallet is locked, from the subscription methods (which subscribe to the push listener). Now users who had closed their browser and re-opened will ensure that they receive the correct notification and not a silent notification. ## References ## Changelog <!-- If you're making any consumer-facing changes, list those changes here as if you were updating a changelog, using the template below as a guide. (CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or FIXED. For security-related issues, follow the Security Advisory process.) Please take care to name the exact pieces of the API you've added or changed (e.g. types, interfaces, functions, or methods). If there are any breaking changes, make sure to offer a solution for consumers to follow once they upgrade to the changes. Finally, if you're only making changes to development scripts or tests, you may replace the template below with "None". --> ### `@metamask/notification-services-controller` - **ADDED**: New method and allowed action `NotificationServicesPushController:subscribeToPushNotifications` to the `NotificationServicesController`. - **CHANGED**: Decoupled logic of creating new reg token and subscribing to push notifications in the `NotificationServicesPushController` `enablePushNotifications()` method. ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate --------- Co-authored-by: Prithpal Sooriya <[email protected]>
- Loading branch information
1 parent
815c5be
commit 00d4a6f
Showing
4 changed files
with
359 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.