diff --git a/push-notifications/README.md b/push-notifications/README.md index 93561d901..4f0f5a88b 100644 --- a/push-notifications/README.md +++ b/push-notifications/README.md @@ -260,6 +260,10 @@ checkPermissions() => Promise Check permission to receive push notifications. +On Android the status is always granted because you can always +receive push notifications. If you need to check if the user allows +to display notifications, use local-notifications plugin. + **Returns:** Promise<PermissionStatus> **Since:** 1.0.0 @@ -275,6 +279,14 @@ requestPermissions() => Promise Request permission to receive push notifications. +On Android it doesn't prompt for permission because you can always +receive push notifications. + +On iOS, the first time you use the function, it will prompt the user +for push notification permission and return granted or denied based +on the user selection. On following calls it will currect status of +the permission without prompting again. + **Returns:** Promise<PermissionStatus> **Since:** 1.0.0 @@ -384,26 +396,26 @@ Remove all native listeners for this plugin. #### DeliveredNotifications -| Prop | Type | Since | -| ------------------- | ------------------------------------- | ----- | -| **`notifications`** | PushNotificationSchema[] | 1.0.0 | +| Prop | Type | Description | Since | +| ------------------- | ------------------------------------- | ------------------------------------------------------------------- | ----- | +| **`notifications`** | PushNotificationSchema[] | List of notifications that are visible on the notifications screen. | 1.0.0 | #### PushNotificationSchema -| Prop | Type | Description | Since | -| ------------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------- | ----- | -| **`title`** | string | The notification title. | 1.0.0 | -| **`subtitle`** | string | The notification subtitle. | 1.0.0 | -| **`body`** | string | The main text payload for the notification. | 1.0.0 | -| **`id`** | string | The notification identifier. | 1.0.0 | -| **`badge`** | number | The number to display for the app icon badge. | 1.0.0 | -| **`notification`** | any | | 1.0.0 | -| **`data`** | any | | 1.0.0 | -| **`click_action`** | string | | 1.0.0 | -| **`link`** | string | | 1.0.0 | -| **`group`** | string | Set the group identifier for notification grouping Only available on Android. Works like `threadIdentifier` on iOS. | 1.0.0 | -| **`groupSummary`** | boolean | Designate this notification as the summary for an associated `group`. Only available on Android. | 1.0.0 | +| Prop | Type | Description | Since | +| ------------------ | -------------------- | -------------------------------------------------------------------------------------------------------------------- | ----- | +| **`title`** | string | The notification title. | 1.0.0 | +| **`subtitle`** | string | The notification subtitle. | 1.0.0 | +| **`body`** | string | The main text payload for the notification. | 1.0.0 | +| **`id`** | string | The notification identifier. | 1.0.0 | +| **`badge`** | number | The number to display for the app icon badge. | 1.0.0 | +| **`notification`** | any | It's not being returned. | 1.0.0 | +| **`data`** | any | Any additional data that was included in the push notification payload. | 1.0.0 | +| **`click_action`** | string | The action to be performed on the user opening the notification. Only available on Android. | 1.0.0 | +| **`link`** | string | Deep link from the notification. Only available on Android. | 1.0.0 | +| **`group`** | string | Set the group identifier for notification grouping. Only available on Android. Works like `threadIdentifier` on iOS. | 1.0.0 | +| **`groupSummary`** | boolean | Designate this notification as the summary for an associated `group`. Only available on Android. | 1.0.0 | #### Channel @@ -423,16 +435,16 @@ Remove all native listeners for this plugin. #### ListChannelsResult -| Prop | Type | Since | -| -------------- | ---------------------- | ----- | -| **`channels`** | Channel[] | 1.0.0 | +| Prop | Type | Description | Since | +| -------------- | ---------------------- | --------------------------------------------- | ----- | +| **`channels`** | Channel[] | List of all the Channels created by your app. | 1.0.0 | #### PermissionStatus -| Prop | Type | Since | -| ------------- | ----------------------------------------------------------- | ----- | -| **`receive`** | PermissionState | 1.0.0 | +| Prop | Type | Description | Since | +| ------------- | ----------------------------------------------------------- | -------------------------------------------- | ----- | +| **`receive`** | PermissionState | Permission state of receiving notifications. | 1.0.0 | #### PluginListenerHandle @@ -444,18 +456,18 @@ Remove all native listeners for this plugin. #### Token -| Prop | Type | Since | -| ----------- | ------------------- | ----- | -| **`value`** | string | 1.0.0 | +| Prop | Type | Description | Since | +| ----------- | ------------------- | ------------------------------------------------------------------------ | ----- | +| **`value`** | string | On iOS it contains the APNS token. On Android it contains the FCM token. | 1.0.0 | #### ActionPerformed -| Prop | Type | Since | -| ------------------ | ------------------------------------------------------------------------- | ----- | -| **`actionId`** | string | 1.0.0 | -| **`inputValue`** | string | 1.0.0 | -| **`notification`** | PushNotificationSchema | 1.0.0 | +| Prop | Type | Description | Since | +| ------------------ | ------------------------------------------------------------------------- | --------------------------------------------------------------- | ----- | +| **`actionId`** | string | The action performed on the notification. | 1.0.0 | +| **`inputValue`** | string | Text entered on the notification action. Only available on iOS. | 1.0.0 | +| **`notification`** | PushNotificationSchema | The notification in which the action was performed. | 1.0.0 | ### Type Aliases diff --git a/push-notifications/src/definitions.ts b/push-notifications/src/definitions.ts index 31c60abc6..bce8b0482 100644 --- a/push-notifications/src/definitions.ts +++ b/push-notifications/src/definitions.ts @@ -93,6 +93,10 @@ export interface PushNotificationsPlugin { /** * Check permission to receive push notifications. * + * On Android the status is always granted because you can always + * receive push notifications. If you need to check if the user allows + * to display notifications, use local-notifications plugin. + * * @since 1.0.0 */ checkPermissions(): Promise; @@ -100,6 +104,14 @@ export interface PushNotificationsPlugin { /** * Request permission to receive push notifications. * + * On Android it doesn't prompt for permission because you can always + * receive push notifications. + * + * On iOS, the first time you use the function, it will prompt the user + * for push notification permission and return granted or denied based + * on the user selection. On following calls it will currect status of + * the permission without prompting again. + * * @since 1.0.0 */ requestPermissions(): Promise; @@ -193,27 +205,41 @@ export interface PushNotificationSchema { badge?: number; /** + * It's not being returned. + * + * @deprecated will be removed in next major version. * @since 1.0.0 */ notification?: any; /** + * Any additional data that was included in the + * push notification payload. + * * @since 1.0.0 */ data: any; /** + * The action to be performed on the user opening the notification. + * + * Only available on Android. + * * @since 1.0.0 */ click_action?: string; /** + * Deep link from the notification. + * + * Only available on Android. + * * @since 1.0.0 */ link?: string; /** - * Set the group identifier for notification grouping + * Set the group identifier for notification grouping. * * Only available on Android. Works like `threadIdentifier` on iOS. * @@ -233,16 +259,24 @@ export interface PushNotificationSchema { export interface ActionPerformed { /** + * The action performed on the notification. + * * @since 1.0.0 */ actionId: string; /** + * Text entered on the notification action. + * + * Only available on iOS. + * * @since 1.0.0 */ inputValue?: string; /** + * The notification in which the action was performed. + * * @since 1.0.0 */ notification: PushNotificationSchema; @@ -250,6 +284,9 @@ export interface ActionPerformed { export interface Token { /** + * On iOS it contains the APNS token. + * On Android it contains the FCM token. + * * @since 1.0.0 */ value: string; @@ -257,6 +294,9 @@ export interface Token { export interface DeliveredNotifications { /** + * List of notifications that are visible on the + * notifications screen. + * * @since 1.0.0 */ notifications: PushNotificationSchema[]; @@ -348,6 +388,8 @@ export type Visibility = -1 | 0 | 1; export interface ListChannelsResult { /** + * List of all the Channels created by your app. + * * @since 1.0.0 */ channels: Channel[]; @@ -355,6 +397,8 @@ export interface ListChannelsResult { export interface PermissionStatus { /** + * Permission state of receiving notifications. + * * @since 1.0.0 */ receive: PermissionState;