@capacitor/push-notifications 5.0.0-alpha.1 → 5.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.0.0-beta.0](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/push-notifications@5.0.0-alpha.1...@capacitor/push-notifications@5.0.0-beta.0) (2023-03-31)
7
+
8
+
9
+ ### Features
10
+
11
+ * **push-notifications:** add unregister functions ([#1498](https://github.com/ionic-team/capacitor-plugins/issues/1498)) ([878e295](https://github.com/ionic-team/capacitor-plugins/commit/878e2950b4113af49d2856a11b6e02d01ba62bb6))
12
+
13
+
14
+
15
+
16
+
6
17
  # [5.0.0-alpha.1](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/push-notifications@4.1.2...@capacitor/push-notifications@5.0.0-alpha.1) (2023-03-16)
7
18
 
8
19
 
package/README.md CHANGED
@@ -159,6 +159,7 @@ const getDeliveredNotifications = async () => {
159
159
  <docgen-index>
160
160
 
161
161
  * [`register()`](#register)
162
+ * [`unregister()`](#unregister)
162
163
  * [`getDeliveredNotifications()`](#getdeliverednotifications)
163
164
  * [`removeDeliveredNotifications(...)`](#removedeliverednotifications)
164
165
  * [`removeAllDeliveredNotifications()`](#removealldeliverednotifications)
@@ -197,6 +198,21 @@ notification permissions, use `requestPermissions()` first.
197
198
  --------------------
198
199
 
199
200
 
201
+ ### unregister()
202
+
203
+ ```typescript
204
+ unregister() => Promise<void>
205
+ ```
206
+
207
+ Unregister the app from push notifications.
208
+
209
+ This will delete a firebase token on Android, and unregister APNS on iOS.
210
+
211
+ **Since:** 5.0.0
212
+
213
+ --------------------
214
+
215
+
200
216
  ### getDeliveredNotifications()
201
217
 
202
218
  ```typescript
@@ -16,7 +16,7 @@ buildscript {
16
16
  }
17
17
  }
18
18
  dependencies {
19
- classpath 'com.android.tools.build:gradle:7.2.1'
19
+ classpath 'com.android.tools.build:gradle:7.4.1'
20
20
  if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
21
21
  classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
22
22
  }
@@ -31,6 +31,7 @@ if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
31
31
  }
32
32
 
33
33
  android {
34
+ namespace "com.capacitorjs.plugins.pushnotifications"
34
35
  compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
35
36
  defaultConfig {
36
37
  minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
@@ -1,6 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.capacitorjs.plugins.pushnotifications">
3
-
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
4
2
  <application>
5
3
  <service android:name="com.capacitorjs.plugins.pushnotifications.MessagingService" android:exported="false">
6
4
  <intent-filter>
@@ -117,6 +117,13 @@ public class PushNotificationsPlugin extends Plugin {
117
117
  call.resolve();
118
118
  }
119
119
 
120
+ @PluginMethod
121
+ public void unregister(PluginCall call) {
122
+ FirebaseMessaging.getInstance().setAutoInitEnabled(false);
123
+ FirebaseMessaging.getInstance().deleteToken();
124
+ call.resolve();
125
+ }
126
+
120
127
  @PluginMethod
121
128
  public void getDeliveredNotifications(PluginCall call) {
122
129
  JSArray notifications = new JSArray();
package/dist/docs.json CHANGED
@@ -20,6 +20,21 @@
20
20
  "complexTypes": [],
21
21
  "slug": "register"
22
22
  },
23
+ {
24
+ "name": "unregister",
25
+ "signature": "() => Promise<void>",
26
+ "parameters": [],
27
+ "returns": "Promise<void>",
28
+ "tags": [
29
+ {
30
+ "name": "since",
31
+ "text": "5.0.0"
32
+ }
33
+ ],
34
+ "docs": "Unregister the app from push notifications.\n\nThis will delete a firebase token on Android, and unregister APNS on iOS.",
35
+ "complexTypes": [],
36
+ "slug": "unregister"
37
+ },
23
38
  {
24
39
  "name": "getDeliveredNotifications",
25
40
  "signature": "() => Promise<DeliveredNotifications>",
@@ -34,6 +34,14 @@ export interface PushNotificationsPlugin {
34
34
  * @since 1.0.0
35
35
  */
36
36
  register(): Promise<void>;
37
+ /**
38
+ * Unregister the app from push notifications.
39
+ *
40
+ * This will delete a firebase token on Android, and unregister APNS on iOS.
41
+ *
42
+ * @since 5.0.0
43
+ */
44
+ unregister(): Promise<void>;
37
45
  /**
38
46
  * Get a list of notifications that are visible on the notifications screen.
39
47
  *
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\nimport type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\nexport type PresentationOption = 'badge' | 'sound' | 'alert';\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * You can configure the way the push notifications are displayed when the app is in foreground.\n */\n PushNotifications?: {\n /**\n * This is an array of strings you can combine. Possible values in the array are:\n * - `badge`: badge count on the app icon is updated (default value)\n * - `sound`: the device will ring/vibrate when the push notification is received\n * - `alert`: the push notification is displayed in a native dialog\n *\n * An empty array can be provided if none of the options are desired.\n *\n * badge is only available for iOS.\n *\n * @since 1.0.0\n * @example [\"badge\", \"sound\", \"alert\"]\n */\n presentationOptions: PresentationOption[];\n };\n }\n}\n\nexport interface PushNotificationsPlugin {\n /**\n * Register the app to receive push notifications.\n *\n * This method will trigger the `'registration'` event with the push token or\n * `'registrationError'` if there was a problem. It does not prompt the user for\n * notification permissions, use `requestPermissions()` first.\n *\n * @since 1.0.0\n */\n register(): Promise<void>;\n\n /**\n * Get a list of notifications that are visible on the notifications screen.\n *\n * @since 1.0.0\n */\n getDeliveredNotifications(): Promise<DeliveredNotifications>;\n\n /**\n * Remove the specified notifications from the notifications screen.\n *\n * @since 1.0.0\n */\n removeDeliveredNotifications(\n delivered: DeliveredNotifications,\n ): Promise<void>;\n\n /**\n * Remove all the notifications from the notifications screen.\n *\n * @since 1.0.0\n */\n removeAllDeliveredNotifications(): Promise<void>;\n\n /**\n * Create a notification channel.\n *\n * Only available on Android O or newer (SDK 26+).\n *\n * @since 1.0.0\n */\n createChannel(channel: Channel): Promise<void>;\n\n /**\n * Delete a notification channel.\n *\n * Only available on Android O or newer (SDK 26+).\n *\n * @since 1.0.0\n */\n deleteChannel(args: { id: string }): Promise<void>;\n\n /**\n * List the available notification channels.\n *\n * Only available on Android O or newer (SDK 26+).\n *\n * @since 1.0.0\n */\n listChannels(): Promise<ListChannelsResult>;\n\n /**\n * Check permission to receive push notifications.\n *\n * On Android 12 and below the status is always granted because you can always\n * receive push notifications. If you need to check if the user allows\n * to display notifications, use local-notifications plugin.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request permission to receive push notifications.\n *\n * On Android 12 and below it doesn't prompt for permission because you can always\n * receive push notifications.\n *\n * On iOS, the first time you use the function, it will prompt the user\n * for push notification permission and return granted or denied based\n * on the user selection. On following calls it will get the current status of\n * the permission without prompting again.\n *\n * @since 1.0.0\n */\n requestPermissions(): Promise<PermissionStatus>;\n\n /**\n * Called when the push notification registration finishes without problems.\n *\n * Provides the push notification token.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'registration',\n listenerFunc: (token: Token) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Called when the push notification registration finished with problems.\n *\n * Provides an error with the registration problem.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'registrationError',\n listenerFunc: (error: RegistrationError) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Called when the device receives a push notification.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'pushNotificationReceived',\n listenerFunc: (notification: PushNotificationSchema) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Called when an action is performed on a push notification.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'pushNotificationActionPerformed',\n listenerFunc: (notification: ActionPerformed) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Remove all native listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n}\n\nexport interface PushNotificationSchema {\n /**\n * The notification title.\n *\n * @since 1.0.0\n */\n title?: string;\n\n /**\n * The notification subtitle.\n *\n * @since 1.0.0\n */\n subtitle?: string;\n\n /**\n * The main text payload for the notification.\n *\n * @since 1.0.0\n */\n body?: string;\n\n /**\n * The notification identifier.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The notification tag.\n *\n * Only available on Android (from push notifications).\n *\n * @since 4.0.0\n */\n tag?: string;\n\n /**\n * The number to display for the app icon badge.\n *\n * @since 1.0.0\n */\n badge?: number;\n\n /**\n * It's not being returned.\n *\n * @deprecated will be removed in next major version.\n * @since 1.0.0\n */\n notification?: any;\n\n /**\n * Any additional data that was included in the\n * push notification payload.\n *\n * @since 1.0.0\n */\n data: any;\n\n /**\n * The action to be performed on the user opening the notification.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n */\n click_action?: string;\n\n /**\n * Deep link from the notification.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n */\n link?: string;\n\n /**\n * Set the group identifier for notification grouping.\n *\n * Only available on Android. Works like `threadIdentifier` on iOS.\n *\n * @since 1.0.0\n */\n group?: string;\n\n /**\n * Designate this notification as the summary for an associated `group`.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n */\n groupSummary?: boolean;\n}\n\nexport interface ActionPerformed {\n /**\n * The action performed on the notification.\n *\n * @since 1.0.0\n */\n actionId: string;\n\n /**\n * Text entered on the notification action.\n *\n * Only available on iOS.\n *\n * @since 1.0.0\n */\n inputValue?: string;\n\n /**\n * The notification in which the action was performed.\n *\n * @since 1.0.0\n */\n notification: PushNotificationSchema;\n}\n\nexport interface Token {\n /**\n * On iOS it contains the APNS token.\n * On Android it contains the FCM token.\n *\n * @since 1.0.0\n */\n value: string;\n}\n\nexport interface RegistrationError {\n /**\n * Error message describing the registration failure.\n *\n * @since 4.0.0\n */\n error: string;\n}\n\nexport interface DeliveredNotifications {\n /**\n * List of notifications that are visible on the\n * notifications screen.\n *\n * @since 1.0.0\n */\n notifications: PushNotificationSchema[];\n}\n\nexport interface Channel {\n /**\n * The channel identifier.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The human-friendly name of this channel (presented to the user).\n *\n * @since 1.0.0\n */\n name: string;\n\n /**\n * The description of this channel (presented to the user).\n *\n * @since 1.0.0\n */\n description?: string;\n\n /**\n * The sound that should be played for notifications posted to this channel.\n *\n * Notification channels with an importance of at least `3` should have a\n * sound.\n *\n * The file name of a sound file should be specified relative to the android\n * app `res/raw` directory.\n *\n * @since 1.0.0\n * @example \"jingle.wav\"\n */\n sound?: string;\n\n /**\n * The level of interruption for notifications posted to this channel.\n *\n * @default `3`\n * @since 1.0.0\n */\n importance?: Importance;\n\n /**\n * The visibility of notifications posted to this channel.\n *\n * This setting is for whether notifications posted to this channel appear on\n * the lockscreen or not, and if so, whether they appear in a redacted form.\n *\n * @since 1.0.0\n */\n visibility?: Visibility;\n\n /**\n * Whether notifications posted to this channel should display notification\n * lights, on devices that support it.\n *\n * @since 1.0.0\n */\n lights?: boolean;\n\n /**\n * The light color for notifications posted to this channel.\n *\n * Only supported if lights are enabled on this channel and the device\n * supports it.\n *\n * Supported color formats are `#RRGGBB` and `#RRGGBBAA`.\n *\n * @since 1.0.0\n */\n lightColor?: string;\n\n /**\n * Whether notifications posted to this channel should vibrate.\n *\n * @since 1.0.0\n */\n vibration?: boolean;\n}\n\n/**\n * The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)\n * @since 1.0.0\n */\nexport type Importance = 1 | 2 | 3 | 4 | 5;\n\n/**\n * The notification visibility. For more details, see the [Android Developer Docs](https://developer.android.com/reference/androidx/core/app/NotificationCompat#VISIBILITY_PRIVATE)\n * @since 1.0.0\n */\nexport type Visibility = -1 | 0 | 1;\n\nexport interface ListChannelsResult {\n /**\n * List of all the Channels created by your app.\n *\n * @since 1.0.0\n */\n channels: Channel[];\n}\n\nexport interface PermissionStatus {\n /**\n * Permission state of receiving notifications.\n *\n * @since 1.0.0\n */\n receive: PermissionState;\n}\n\n/**\n * @deprecated Use 'Channel`.\n * @since 1.0.0\n */\nexport type NotificationChannel = Channel;\n\n/**\n * @deprecated Use `ListChannelsResult`.\n * @since 1.0.0\n */\nexport type NotificationChannelList = ListChannelsResult;\n\n/**\n * @deprecated Use `PushNotificationSchema`.\n * @since 1.0.0\n */\nexport type PushNotification = PushNotificationSchema;\n\n/**\n * @deprecated Use `ActionPerformed`.\n * @since 1.0.0\n */\nexport type PushNotificationActionPerformed = ActionPerformed;\n\n/**\n * @deprecated Use `DeliveredNotifications`.\n * @since 1.0.0\n */\nexport type PushNotificationDeliveredList = DeliveredNotifications;\n\n/**\n * @deprecated Use `Token`.\n * @since 1.0.0\n */\nexport type PushNotificationToken = Token;\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\nimport type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\nexport type PresentationOption = 'badge' | 'sound' | 'alert';\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * You can configure the way the push notifications are displayed when the app is in foreground.\n */\n PushNotifications?: {\n /**\n * This is an array of strings you can combine. Possible values in the array are:\n * - `badge`: badge count on the app icon is updated (default value)\n * - `sound`: the device will ring/vibrate when the push notification is received\n * - `alert`: the push notification is displayed in a native dialog\n *\n * An empty array can be provided if none of the options are desired.\n *\n * badge is only available for iOS.\n *\n * @since 1.0.0\n * @example [\"badge\", \"sound\", \"alert\"]\n */\n presentationOptions: PresentationOption[];\n };\n }\n}\n\nexport interface PushNotificationsPlugin {\n /**\n * Register the app to receive push notifications.\n *\n * This method will trigger the `'registration'` event with the push token or\n * `'registrationError'` if there was a problem. It does not prompt the user for\n * notification permissions, use `requestPermissions()` first.\n *\n * @since 1.0.0\n */\n register(): Promise<void>;\n\n /**\n * Unregister the app from push notifications.\n *\n * This will delete a firebase token on Android, and unregister APNS on iOS.\n *\n * @since 5.0.0\n */\n unregister(): Promise<void>;\n\n /**\n * Get a list of notifications that are visible on the notifications screen.\n *\n * @since 1.0.0\n */\n getDeliveredNotifications(): Promise<DeliveredNotifications>;\n\n /**\n * Remove the specified notifications from the notifications screen.\n *\n * @since 1.0.0\n */\n removeDeliveredNotifications(\n delivered: DeliveredNotifications,\n ): Promise<void>;\n\n /**\n * Remove all the notifications from the notifications screen.\n *\n * @since 1.0.0\n */\n removeAllDeliveredNotifications(): Promise<void>;\n\n /**\n * Create a notification channel.\n *\n * Only available on Android O or newer (SDK 26+).\n *\n * @since 1.0.0\n */\n createChannel(channel: Channel): Promise<void>;\n\n /**\n * Delete a notification channel.\n *\n * Only available on Android O or newer (SDK 26+).\n *\n * @since 1.0.0\n */\n deleteChannel(args: { id: string }): Promise<void>;\n\n /**\n * List the available notification channels.\n *\n * Only available on Android O or newer (SDK 26+).\n *\n * @since 1.0.0\n */\n listChannels(): Promise<ListChannelsResult>;\n\n /**\n * Check permission to receive push notifications.\n *\n * On Android 12 and below the status is always granted because you can always\n * receive push notifications. If you need to check if the user allows\n * to display notifications, use local-notifications plugin.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request permission to receive push notifications.\n *\n * On Android 12 and below it doesn't prompt for permission because you can always\n * receive push notifications.\n *\n * On iOS, the first time you use the function, it will prompt the user\n * for push notification permission and return granted or denied based\n * on the user selection. On following calls it will get the current status of\n * the permission without prompting again.\n *\n * @since 1.0.0\n */\n requestPermissions(): Promise<PermissionStatus>;\n\n /**\n * Called when the push notification registration finishes without problems.\n *\n * Provides the push notification token.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'registration',\n listenerFunc: (token: Token) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Called when the push notification registration finished with problems.\n *\n * Provides an error with the registration problem.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'registrationError',\n listenerFunc: (error: RegistrationError) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Called when the device receives a push notification.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'pushNotificationReceived',\n listenerFunc: (notification: PushNotificationSchema) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Called when an action is performed on a push notification.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'pushNotificationActionPerformed',\n listenerFunc: (notification: ActionPerformed) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Remove all native listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n}\n\nexport interface PushNotificationSchema {\n /**\n * The notification title.\n *\n * @since 1.0.0\n */\n title?: string;\n\n /**\n * The notification subtitle.\n *\n * @since 1.0.0\n */\n subtitle?: string;\n\n /**\n * The main text payload for the notification.\n *\n * @since 1.0.0\n */\n body?: string;\n\n /**\n * The notification identifier.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The notification tag.\n *\n * Only available on Android (from push notifications).\n *\n * @since 4.0.0\n */\n tag?: string;\n\n /**\n * The number to display for the app icon badge.\n *\n * @since 1.0.0\n */\n badge?: number;\n\n /**\n * It's not being returned.\n *\n * @deprecated will be removed in next major version.\n * @since 1.0.0\n */\n notification?: any;\n\n /**\n * Any additional data that was included in the\n * push notification payload.\n *\n * @since 1.0.0\n */\n data: any;\n\n /**\n * The action to be performed on the user opening the notification.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n */\n click_action?: string;\n\n /**\n * Deep link from the notification.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n */\n link?: string;\n\n /**\n * Set the group identifier for notification grouping.\n *\n * Only available on Android. Works like `threadIdentifier` on iOS.\n *\n * @since 1.0.0\n */\n group?: string;\n\n /**\n * Designate this notification as the summary for an associated `group`.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n */\n groupSummary?: boolean;\n}\n\nexport interface ActionPerformed {\n /**\n * The action performed on the notification.\n *\n * @since 1.0.0\n */\n actionId: string;\n\n /**\n * Text entered on the notification action.\n *\n * Only available on iOS.\n *\n * @since 1.0.0\n */\n inputValue?: string;\n\n /**\n * The notification in which the action was performed.\n *\n * @since 1.0.0\n */\n notification: PushNotificationSchema;\n}\n\nexport interface Token {\n /**\n * On iOS it contains the APNS token.\n * On Android it contains the FCM token.\n *\n * @since 1.0.0\n */\n value: string;\n}\n\nexport interface RegistrationError {\n /**\n * Error message describing the registration failure.\n *\n * @since 4.0.0\n */\n error: string;\n}\n\nexport interface DeliveredNotifications {\n /**\n * List of notifications that are visible on the\n * notifications screen.\n *\n * @since 1.0.0\n */\n notifications: PushNotificationSchema[];\n}\n\nexport interface Channel {\n /**\n * The channel identifier.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The human-friendly name of this channel (presented to the user).\n *\n * @since 1.0.0\n */\n name: string;\n\n /**\n * The description of this channel (presented to the user).\n *\n * @since 1.0.0\n */\n description?: string;\n\n /**\n * The sound that should be played for notifications posted to this channel.\n *\n * Notification channels with an importance of at least `3` should have a\n * sound.\n *\n * The file name of a sound file should be specified relative to the android\n * app `res/raw` directory.\n *\n * @since 1.0.0\n * @example \"jingle.wav\"\n */\n sound?: string;\n\n /**\n * The level of interruption for notifications posted to this channel.\n *\n * @default `3`\n * @since 1.0.0\n */\n importance?: Importance;\n\n /**\n * The visibility of notifications posted to this channel.\n *\n * This setting is for whether notifications posted to this channel appear on\n * the lockscreen or not, and if so, whether they appear in a redacted form.\n *\n * @since 1.0.0\n */\n visibility?: Visibility;\n\n /**\n * Whether notifications posted to this channel should display notification\n * lights, on devices that support it.\n *\n * @since 1.0.0\n */\n lights?: boolean;\n\n /**\n * The light color for notifications posted to this channel.\n *\n * Only supported if lights are enabled on this channel and the device\n * supports it.\n *\n * Supported color formats are `#RRGGBB` and `#RRGGBBAA`.\n *\n * @since 1.0.0\n */\n lightColor?: string;\n\n /**\n * Whether notifications posted to this channel should vibrate.\n *\n * @since 1.0.0\n */\n vibration?: boolean;\n}\n\n/**\n * The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)\n * @since 1.0.0\n */\nexport type Importance = 1 | 2 | 3 | 4 | 5;\n\n/**\n * The notification visibility. For more details, see the [Android Developer Docs](https://developer.android.com/reference/androidx/core/app/NotificationCompat#VISIBILITY_PRIVATE)\n * @since 1.0.0\n */\nexport type Visibility = -1 | 0 | 1;\n\nexport interface ListChannelsResult {\n /**\n * List of all the Channels created by your app.\n *\n * @since 1.0.0\n */\n channels: Channel[];\n}\n\nexport interface PermissionStatus {\n /**\n * Permission state of receiving notifications.\n *\n * @since 1.0.0\n */\n receive: PermissionState;\n}\n\n/**\n * @deprecated Use 'Channel`.\n * @since 1.0.0\n */\nexport type NotificationChannel = Channel;\n\n/**\n * @deprecated Use `ListChannelsResult`.\n * @since 1.0.0\n */\nexport type NotificationChannelList = ListChannelsResult;\n\n/**\n * @deprecated Use `PushNotificationSchema`.\n * @since 1.0.0\n */\nexport type PushNotification = PushNotificationSchema;\n\n/**\n * @deprecated Use `ActionPerformed`.\n * @since 1.0.0\n */\nexport type PushNotificationActionPerformed = ActionPerformed;\n\n/**\n * @deprecated Use `DeliveredNotifications`.\n * @since 1.0.0\n */\nexport type PushNotificationDeliveredList = DeliveredNotifications;\n\n/**\n * @deprecated Use `Token`.\n * @since 1.0.0\n */\nexport type PushNotificationToken = Token;\n"]}
@@ -5,6 +5,7 @@
5
5
  // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
6
  CAP_PLUGIN(PushNotificationsPlugin, "PushNotifications",
7
7
  CAP_PLUGIN_METHOD(register, CAPPluginReturnPromise);
8
+ CAP_PLUGIN_METHOD(unregister, CAPPluginReturnPromise);
8
9
  CAP_PLUGIN_METHOD(checkPermissions, CAPPluginReturnPromise);
9
10
  CAP_PLUGIN_METHOD(requestPermissions, CAPPluginReturnPromise);
10
11
  CAP_PLUGIN_METHOD(getDeliveredNotifications, CAPPluginReturnPromise);
@@ -47,6 +47,16 @@ public class PushNotificationsPlugin: CAPPlugin {
47
47
  call.resolve()
48
48
  }
49
49
 
50
+ /**
51
+ * Unregister for remote notifications
52
+ */
53
+ @objc func unregister(_ call: CAPPluginCall) {
54
+ DispatchQueue.main.async {
55
+ UIApplication.shared.unregisterForRemoteNotifications()
56
+ call.resolve()
57
+ }
58
+ }
59
+
50
60
  /**
51
61
  * Request notification permission
52
62
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/push-notifications",
3
- "version": "5.0.0-alpha.1",
3
+ "version": "5.0.0-beta.0",
4
4
  "description": "The Push Notifications API provides access to native push notifications.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -80,5 +80,5 @@
80
80
  "publishConfig": {
81
81
  "access": "public"
82
82
  },
83
- "gitHead": "b980c4d862b72610560a6cedc69238021c5367cc"
83
+ "gitHead": "d53b649da594ee7e30d7cff4f7cdb87ba6a436b5"
84
84
  }