Skip to content

Commit

Permalink
docs(push): Add descriptions to push notification methods (#3036)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jun 2, 2020
1 parent 319bd8a commit a2ea9ce
Showing 1 changed file with 55 additions and 2 deletions.
57 changes: 55 additions & 2 deletions core/src/core-plugin-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1599,21 +1599,74 @@ export interface NotificationChannelList {
}

export interface PushNotificationsPlugin extends Plugin {
/**
* Register the app to receive push notifications.
* Will trigger registration event with the push token
* or registrationError if there was some problem.
* Doesn't prompt the user for notification permissions, use requestPermission() first.
*/
register(): Promise<void>;
/**
* On iOS it prompts the user to allow displaying notifications
* and return if the permission was granted or not.
* On Android there is no such prompt, so just return as granted.
*/
requestPermission(): Promise<NotificationPermissionResponse>;
/**
* Returns the notifications that are visible on the notifications screen.
*/
getDeliveredNotifications(): Promise<PushNotificationDeliveredList>;
/**
* Removes the specified notifications from the notifications screen.
* @param delivered list of delivered notifications.
*/
removeDeliveredNotifications(delivered: PushNotificationDeliveredList): Promise<void>;
/**
* Removes all the notifications from the notifications screen.
*/
removeAllDeliveredNotifications(): Promise<void>;
/**
* On Android O or newer (SDK 26+) creates a notification channel.
* @param channel to create.
*/
createChannel(channel: NotificationChannel): Promise<void>;
/**
* On Android O or newer (SDK 26+) deletes a notification channel.
* @param channel to delete.
*/
deleteChannel(channel: NotificationChannel): Promise<void>;
/**
* On Android O or newer (SDK 26+) list the available notification channels.

This comment has been minimized.

Copy link
@jcesarmobile

jcesarmobile Jun 11, 2020

Author Member

It’s an O of Oreo, that’s android 8, not 10. And in case of doubt, there is also the SDK level 26.

*/
listChannels(): Promise<NotificationChannelList>;
/**
* Event called when the push notification registration finished without problems.
* Provides the push notification token.
* @param eventName registration.
* @param listenerFunc callback with the push token.
*/
addListener(eventName: 'registration', listenerFunc: (token: PushNotificationToken) => void): PluginListenerHandle;
/**
* Event called when the push notification registration finished with problems.
* Provides an error with the registration problem.
* @param eventName registrationError.
* @param listenerFunc callback with the registration error.
*/
addListener(eventName: 'registrationError', listenerFunc: (error: any) => void): PluginListenerHandle;
/**
* Event called when the device receives a push notification.
* @param eventName pushNotificationReceived.
* @param listenerFunc callback with the received notification.
*/
addListener(eventName: 'pushNotificationReceived', listenerFunc: (notification: PushNotification) => void): PluginListenerHandle;
/**
* Event called when an action is performed on a pusn notification.
* @param eventName pushNotificationActionPerformed.
* @param listenerFunc callback with the notification action.
*/
addListener(eventName: 'pushNotificationActionPerformed', listenerFunc: (notification: PushNotificationActionPerformed) => void): PluginListenerHandle;

/**
* Remove all native listeners for this plugin
* Remove all native listeners for this plugin.
*/
removeAllListeners(): void;
}
Expand Down

0 comments on commit a2ea9ce

Please sign in to comment.