Skip to content
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

docs(push): Add descriptions to push notification methods #3036

Merged
merged 1 commit into from
Jun 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
*/
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