NotificationServicesPushController Actions
7 actions registered.
| Name | Deprecated |
|---|---|
addPushNotificationLinks | |
deletePushNotificationLinks | |
disablePushNotifications | |
enablePushNotifications | |
getState | |
subscribeToPushNotifications | |
updateTriggerPushNotifications | Yes |
NotificationServicesPushController:addPushNotificationLinks
Package: @metamask/notification-services-controller
Adds backend push notification links for the given addresses using the current FCM token. This is used when accounts are added after push notifications have already been enabled, so backend can link the existing device token to the newly added addresses.
Parameters:
| Name | Description |
|---|---|
addresses | Addresses that should be linked to push notifications. |
Returns: Whether the add request succeeded.
Handler signature:
(addresses: string[]) => Promise<boolean>
NotificationServicesPushController:deletePushNotificationLinks
Package: @metamask/notification-services-controller
Deletes backend push notification links for the given addresses on the current platform. This is used when accounts are removed (for example SRP removal), so backend can remove all associated FCM tokens for those address/platform pairs.
Parameters:
| Name | Description |
|---|---|
addresses | Addresses that should be unlinked from push notifications. |
Returns: Whether the delete request succeeded.
Handler signature:
(addresses: string[]) => Promise<boolean>
NotificationServicesPushController:disablePushNotifications
Package: @metamask/notification-services-controller
Disables push notifications for the application. This removes the registration token on this device, and ensures we unsubscribe from any listeners
Handler signature:
() => Promise<void>
NotificationServicesPushController:enablePushNotifications
Package: @metamask/notification-services-controller
Enables push notifications for the application.
This method sets up the necessary infrastructure for handling push notifications by:
- Registering the service worker to listen for messages.
- Fetching the Firebase Cloud Messaging (FCM) token from Firebase.
- Sending the FCM token to the server responsible for sending notifications, to register the device.
Parameters:
| Name | Description |
|---|---|
addresses | An array of addresses to enable push notifications for. |
Handler signature:
(addresses: string[]) => Promise<void>
NotificationServicesPushController:getState
Package: @metamask/notification-services-controller
Handler signature:
() => NotificationServicesPushControllerState
NotificationServicesPushController:subscribeToPushNotifications
Package: @metamask/notification-services-controller
Handler signature:
() => Promise<void>
NotificationServicesPushController:updateTriggerPushNotifications
Deprecated
Package: @metamask/notification-services-controller
Updates the triggers for push notifications. This method is responsible for updating the server with the new set of addresses that should trigger push notifications. It uses the current FCM token and a BearerToken for authentication. Deprecated: - this is not used anymore and will most likely be removed
Parameters:
| Name | Description |
|---|---|
addresses | An array of addresses that should trigger push notifications. |
Handler signature:
(addresses: string[]) => Promise<void>