-
-
Notifications
You must be signed in to change notification settings - Fork 207
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: update notification services to support mobile. #5120
feat: update notification services to support mobile. #5120
Conversation
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
...ices-controller/src/NotificationServicesPushController/NotificationServicesPushController.ts
Show resolved
Hide resolved
...ion-services-controller/src/NotificationServicesPushController/__fixtures__/mockMessenger.ts
Show resolved
Hide resolved
...notification-services-controller/src/NotificationServicesPushController/services/services.ts
Show resolved
Hide resolved
.../notification-services-controller/src/NotificationServicesPushController/web/push-helpers.ts
Outdated
Show resolved
Hide resolved
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
29ca3da
to
21576f2
Compare
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
c4913ce
to
9f24308
Compare
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
...ion-services-controller/src/NotificationServicesController/NotificationServicesController.ts
Show resolved
Hide resolved
…ouple-push-logic-to-be-platform-agnostic
I'll double check the other notification methods in a separate PR.
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.
Perfect, thanks for addressing the changes! LGTM!!
Explanation
This is a large PR that enables support for push notifications on mobile.
Makes Push Notification Controller Platform Agnostic
The
NotificationServicesPushController
was highly tied to web and was not compatible for react-native.We now have isolated the web logic in
web/push-utils.ts
, and allow platforms to overwrite and inject a push service into the controller. E.g. Mobile can inject push services using react-native modules.Add support to toggle push notifications on/off in isolation
This allows us to decouple in-app notifications from push notifications. It is done by adding a
isPushEnabled
boolean inside theNotificationServicesPushController
.We have also added public methods
enablePushNotifications
anddisablePushNotifications
inside theNotificationServicesController
to allow us tie it to UI Actions.References
Changelog
@metamask/notification-services-controller
isPushEnabled
state toNotificationServicesPushControllerState
to enable and disable this controller/isUpdatingFCMToken
state toNotificationServicesPushControllerState
to track when the controller is updating for firebase registration token.PushService
interface and default web implementation for push notifciationsNotificationServicesPushController
config now allows injecting of aPushService
interface during controller creation./push-services/web
subpath export to import web specific push services./shared
folder including some shared utils used in controllers for this package.enablePushNotifications
anddisablePushNotifications
inNotificationServicesController
to enable and disable push notifications in isolation.Checklist