@@ -1599,21 +1599,74 @@ export interface NotificationChannelList {
1599
1599
}
1600
1600
1601
1601
export interface PushNotificationsPlugin extends Plugin {
1602
+ /**
1603
+ * Register the app to receive push notifications.
1604
+ * Will trigger registration event with the push token
1605
+ * or registrationError if there was some problem.
1606
+ * Doesn't prompt the user for notification permissions, use requestPermission() first.
1607
+ */
1602
1608
register ( ) : Promise < void > ;
1609
+ /**
1610
+ * On iOS it prompts the user to allow displaying notifications
1611
+ * and return if the permission was granted or not.
1612
+ * On Android there is no such prompt, so just return as granted.
1613
+ */
1603
1614
requestPermission ( ) : Promise < NotificationPermissionResponse > ;
1615
+ /**
1616
+ * Returns the notifications that are visible on the notifications screen.
1617
+ */
1604
1618
getDeliveredNotifications ( ) : Promise < PushNotificationDeliveredList > ;
1619
+ /**
1620
+ * Removes the specified notifications from the notifications screen.
1621
+ * @param delivered list of delivered notifications.
1622
+ */
1605
1623
removeDeliveredNotifications ( delivered : PushNotificationDeliveredList ) : Promise < void > ;
1624
+ /**
1625
+ * Removes all the notifications from the notifications screen.
1626
+ */
1606
1627
removeAllDeliveredNotifications ( ) : Promise < void > ;
1628
+ /**
1629
+ * On Android O or newer (SDK 26+) creates a notification channel.
1630
+ * @param channel to create.
1631
+ */
1607
1632
createChannel ( channel : NotificationChannel ) : Promise < void > ;
1633
+ /**
1634
+ * On Android O or newer (SDK 26+) deletes a notification channel.
1635
+ * @param channel to delete.
1636
+ */
1608
1637
deleteChannel ( channel : NotificationChannel ) : Promise < void > ;
1638
+ /**
1639
+ * On Android O or newer (SDK 26+) list the available notification channels.
1640
+ */
1609
1641
listChannels ( ) : Promise < NotificationChannelList > ;
1642
+ /**
1643
+ * Event called when the push notification registration finished without problems.
1644
+ * Provides the push notification token.
1645
+ * @param eventName registration.
1646
+ * @param listenerFunc callback with the push token.
1647
+ */
1610
1648
addListener ( eventName : 'registration' , listenerFunc : ( token : PushNotificationToken ) => void ) : PluginListenerHandle ;
1649
+ /**
1650
+ * Event called when the push notification registration finished with problems.
1651
+ * Provides an error with the registration problem.
1652
+ * @param eventName registrationError.
1653
+ * @param listenerFunc callback with the registration error.
1654
+ */
1611
1655
addListener ( eventName : 'registrationError' , listenerFunc : ( error : any ) => void ) : PluginListenerHandle ;
1656
+ /**
1657
+ * Event called when the device receives a push notification.
1658
+ * @param eventName pushNotificationReceived.
1659
+ * @param listenerFunc callback with the received notification.
1660
+ */
1612
1661
addListener ( eventName : 'pushNotificationReceived' , listenerFunc : ( notification : PushNotification ) => void ) : PluginListenerHandle ;
1662
+ /**
1663
+ * Event called when an action is performed on a pusn notification.
1664
+ * @param eventName pushNotificationActionPerformed.
1665
+ * @param listenerFunc callback with the notification action.
1666
+ */
1613
1667
addListener ( eventName : 'pushNotificationActionPerformed' , listenerFunc : ( notification : PushNotificationActionPerformed ) => void ) : PluginListenerHandle ;
1614
-
1615
1668
/**
1616
- * Remove all native listeners for this plugin
1669
+ * Remove all native listeners for this plugin.
1617
1670
*/
1618
1671
removeAllListeners ( ) : void ;
1619
1672
}
0 commit comments