@capacitor/push-notifications 1.0.2 → 1.0.7
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 +49 -0
- package/CapacitorPushNotifications.podspec +3 -3
- package/README.md +50 -34
- package/android/src/main/java/com/capacitorjs/plugins/pushnotifications/NotificationChannelManager.java +18 -3
- package/dist/docs.json +24 -20
- package/dist/esm/definitions.d.ts +53 -1
- package/dist/plugin.js +1 -1
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,55 @@
|
|
|
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
|
+
## [1.0.7](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/push-notifications@1.0.6...@capacitor/push-notifications@1.0.7) (2021-11-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @capacitor/push-notifications
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.0.6](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/push-notifications@1.0.5...@capacitor/push-notifications@1.0.6) (2021-10-14)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* remove postpublish scripts ([#656](https://github.com/ionic-team/capacitor-plugins/issues/656)) ([ed6ac49](https://github.com/ionic-team/capacitor-plugins/commit/ed6ac499ebf4a47525071ccbfc36c27503e11f60))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [1.0.5](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/push-notifications@1.0.4...@capacitor/push-notifications@1.0.5) (2021-10-13)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* correct addListeners links ([#655](https://github.com/ionic-team/capacitor-plugins/issues/655)) ([f9871e7](https://github.com/ionic-team/capacitor-plugins/commit/f9871e7bd53478addb21155e148829f550c0e457))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## [1.0.4](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/push-notifications@1.0.3...@capacitor/push-notifications@1.0.4) (2021-09-01)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **push-notifications:** Throw errors if missing mandatory channel fields ([#576](https://github.com/ionic-team/capacitor-plugins/issues/576)) ([50f4e70](https://github.com/ionic-team/capacitor-plugins/commit/50f4e7026e5cae5f0871d4863bfab36989208064))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## [1.0.3](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/push-notifications@1.0.2...@capacitor/push-notifications@1.0.3) (2021-07-07)
|
|
48
|
+
|
|
49
|
+
**Note:** Version bump only for package @capacitor/push-notifications
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
6
55
|
## [1.0.2](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/push-notifications@1.0.1...@capacitor/push-notifications@1.0.2) (2021-06-23)
|
|
7
56
|
|
|
8
57
|
**Note:** Version bump only for package @capacitor/push-notifications
|
|
@@ -7,10 +7,10 @@ Pod::Spec.new do |s|
|
|
|
7
7
|
s.version = package['version']
|
|
8
8
|
s.summary = package['description']
|
|
9
9
|
s.license = package['license']
|
|
10
|
-
s.homepage =
|
|
10
|
+
s.homepage = 'https://capacitorjs.com'
|
|
11
11
|
s.author = package['author']
|
|
12
|
-
s.source = { :git => package['
|
|
13
|
-
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
12
|
+
s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
|
|
13
|
+
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'push-notifications/ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
14
|
s.ios.deployment_target = '12.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
package/README.md
CHANGED
|
@@ -122,10 +122,10 @@ On Android, there are various system and app states that can affect the delivery
|
|
|
122
122
|
* [`listChannels()`](#listchannels)
|
|
123
123
|
* [`checkPermissions()`](#checkpermissions)
|
|
124
124
|
* [`requestPermissions()`](#requestpermissions)
|
|
125
|
-
* [`addListener('registration', ...)`](#addlistenerregistration
|
|
126
|
-
* [`addListener('registrationError', ...)`](#addlistenerregistrationerror
|
|
127
|
-
* [`addListener('pushNotificationReceived', ...)`](#addlistenerpushnotificationreceived
|
|
128
|
-
* [`addListener('pushNotificationActionPerformed', ...)`](#addlistenerpushnotificationactionperformed
|
|
125
|
+
* [`addListener('registration', ...)`](#addlistenerregistration)
|
|
126
|
+
* [`addListener('registrationError', ...)`](#addlistenerregistrationerror)
|
|
127
|
+
* [`addListener('pushNotificationReceived', ...)`](#addlistenerpushnotificationreceived)
|
|
128
|
+
* [`addListener('pushNotificationActionPerformed', ...)`](#addlistenerpushnotificationactionperformed)
|
|
129
129
|
* [`removeAllListeners()`](#removealllisteners)
|
|
130
130
|
* [Interfaces](#interfaces)
|
|
131
131
|
* [Type Aliases](#type-aliases)
|
|
@@ -260,6 +260,10 @@ checkPermissions() => Promise<PermissionStatus>
|
|
|
260
260
|
|
|
261
261
|
Check permission to receive push notifications.
|
|
262
262
|
|
|
263
|
+
On Android the status is always granted because you can always
|
|
264
|
+
receive push notifications. If you need to check if the user allows
|
|
265
|
+
to display notifications, use local-notifications plugin.
|
|
266
|
+
|
|
263
267
|
**Returns:** <code>Promise<<a href="#permissionstatus">PermissionStatus</a>></code>
|
|
264
268
|
|
|
265
269
|
**Since:** 1.0.0
|
|
@@ -275,6 +279,14 @@ requestPermissions() => Promise<PermissionStatus>
|
|
|
275
279
|
|
|
276
280
|
Request permission to receive push notifications.
|
|
277
281
|
|
|
282
|
+
On Android it doesn't prompt for permission because you can always
|
|
283
|
+
receive push notifications.
|
|
284
|
+
|
|
285
|
+
On iOS, the first time you use the function, it will prompt the user
|
|
286
|
+
for push notification permission and return granted or denied based
|
|
287
|
+
on the user selection. On following calls it will currect status of
|
|
288
|
+
the permission without prompting again.
|
|
289
|
+
|
|
278
290
|
**Returns:** <code>Promise<<a href="#permissionstatus">PermissionStatus</a>></code>
|
|
279
291
|
|
|
280
292
|
**Since:** 1.0.0
|
|
@@ -384,26 +396,26 @@ Remove all native listeners for this plugin.
|
|
|
384
396
|
|
|
385
397
|
#### DeliveredNotifications
|
|
386
398
|
|
|
387
|
-
| Prop | Type | Since |
|
|
388
|
-
| ------------------- | ------------------------------------- | ----- |
|
|
389
|
-
| **`notifications`** | <code>PushNotificationSchema[]</code> | 1.0.0 |
|
|
399
|
+
| Prop | Type | Description | Since |
|
|
400
|
+
| ------------------- | ------------------------------------- | ------------------------------------------------------------------- | ----- |
|
|
401
|
+
| **`notifications`** | <code>PushNotificationSchema[]</code> | List of notifications that are visible on the notifications screen. | 1.0.0 |
|
|
390
402
|
|
|
391
403
|
|
|
392
404
|
#### PushNotificationSchema
|
|
393
405
|
|
|
394
|
-
| Prop | Type | Description
|
|
395
|
-
| ------------------ | -------------------- |
|
|
396
|
-
| **`title`** | <code>string</code> | The notification title.
|
|
397
|
-
| **`subtitle`** | <code>string</code> | The notification subtitle.
|
|
398
|
-
| **`body`** | <code>string</code> | The main text payload for the notification.
|
|
399
|
-
| **`id`** | <code>string</code> | The notification identifier.
|
|
400
|
-
| **`badge`** | <code>number</code> | The number to display for the app icon badge.
|
|
401
|
-
| **`notification`** | <code>any</code> |
|
|
402
|
-
| **`data`** | <code>any</code> |
|
|
403
|
-
| **`click_action`** | <code>string</code> |
|
|
404
|
-
| **`link`** | <code>string</code> |
|
|
405
|
-
| **`group`** | <code>string</code> | Set the group identifier for notification grouping Only available on Android. Works like `threadIdentifier` on iOS. | 1.0.0 |
|
|
406
|
-
| **`groupSummary`** | <code>boolean</code> | Designate this notification as the summary for an associated `group`. Only available on Android.
|
|
406
|
+
| Prop | Type | Description | Since |
|
|
407
|
+
| ------------------ | -------------------- | -------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
408
|
+
| **`title`** | <code>string</code> | The notification title. | 1.0.0 |
|
|
409
|
+
| **`subtitle`** | <code>string</code> | The notification subtitle. | 1.0.0 |
|
|
410
|
+
| **`body`** | <code>string</code> | The main text payload for the notification. | 1.0.0 |
|
|
411
|
+
| **`id`** | <code>string</code> | The notification identifier. | 1.0.0 |
|
|
412
|
+
| **`badge`** | <code>number</code> | The number to display for the app icon badge. | 1.0.0 |
|
|
413
|
+
| **`notification`** | <code>any</code> | It's not being returned. | 1.0.0 |
|
|
414
|
+
| **`data`** | <code>any</code> | Any additional data that was included in the push notification payload. | 1.0.0 |
|
|
415
|
+
| **`click_action`** | <code>string</code> | The action to be performed on the user opening the notification. Only available on Android. | 1.0.0 |
|
|
416
|
+
| **`link`** | <code>string</code> | Deep link from the notification. Only available on Android. | 1.0.0 |
|
|
417
|
+
| **`group`** | <code>string</code> | Set the group identifier for notification grouping. Only available on Android. Works like `threadIdentifier` on iOS. | 1.0.0 |
|
|
418
|
+
| **`groupSummary`** | <code>boolean</code> | Designate this notification as the summary for an associated `group`. Only available on Android. | 1.0.0 |
|
|
407
419
|
|
|
408
420
|
|
|
409
421
|
#### Channel
|
|
@@ -423,16 +435,16 @@ Remove all native listeners for this plugin.
|
|
|
423
435
|
|
|
424
436
|
#### ListChannelsResult
|
|
425
437
|
|
|
426
|
-
| Prop | Type | Since |
|
|
427
|
-
| -------------- | ---------------------- | ----- |
|
|
428
|
-
| **`channels`** | <code>Channel[]</code> | 1.0.0 |
|
|
438
|
+
| Prop | Type | Description | Since |
|
|
439
|
+
| -------------- | ---------------------- | --------------------------------------------- | ----- |
|
|
440
|
+
| **`channels`** | <code>Channel[]</code> | List of all the Channels created by your app. | 1.0.0 |
|
|
429
441
|
|
|
430
442
|
|
|
431
443
|
#### PermissionStatus
|
|
432
444
|
|
|
433
|
-
| Prop | Type | Since |
|
|
434
|
-
| ------------- | ----------------------------------------------------------- | ----- |
|
|
435
|
-
| **`receive`** | <code><a href="#permissionstate">PermissionState</a></code> | 1.0.0 |
|
|
445
|
+
| Prop | Type | Description | Since |
|
|
446
|
+
| ------------- | ----------------------------------------------------------- | -------------------------------------------- | ----- |
|
|
447
|
+
| **`receive`** | <code><a href="#permissionstate">PermissionState</a></code> | Permission state of receiving notifications. | 1.0.0 |
|
|
436
448
|
|
|
437
449
|
|
|
438
450
|
#### PluginListenerHandle
|
|
@@ -444,18 +456,18 @@ Remove all native listeners for this plugin.
|
|
|
444
456
|
|
|
445
457
|
#### Token
|
|
446
458
|
|
|
447
|
-
| Prop | Type | Since |
|
|
448
|
-
| ----------- | ------------------- | ----- |
|
|
449
|
-
| **`value`** | <code>string</code> | 1.0.0 |
|
|
459
|
+
| Prop | Type | Description | Since |
|
|
460
|
+
| ----------- | ------------------- | ------------------------------------------------------------------------ | ----- |
|
|
461
|
+
| **`value`** | <code>string</code> | On iOS it contains the APNS token. On Android it contains the FCM token. | 1.0.0 |
|
|
450
462
|
|
|
451
463
|
|
|
452
464
|
#### ActionPerformed
|
|
453
465
|
|
|
454
|
-
| Prop | Type | Since |
|
|
455
|
-
| ------------------ | ------------------------------------------------------------------------- | ----- |
|
|
456
|
-
| **`actionId`** | <code>string</code> | 1.0.0 |
|
|
457
|
-
| **`inputValue`** | <code>string</code> | 1.0.0 |
|
|
458
|
-
| **`notification`** | <code><a href="#pushnotificationschema">PushNotificationSchema</a></code> | 1.0.0 |
|
|
466
|
+
| Prop | Type | Description | Since |
|
|
467
|
+
| ------------------ | ------------------------------------------------------------------------- | --------------------------------------------------------------- | ----- |
|
|
468
|
+
| **`actionId`** | <code>string</code> | The action performed on the notification. | 1.0.0 |
|
|
469
|
+
| **`inputValue`** | <code>string</code> | Text entered on the notification action. Only available on iOS. | 1.0.0 |
|
|
470
|
+
| **`notification`** | <code><a href="#pushnotificationschema">PushNotificationSchema</a></code> | The notification in which the action was performed. | 1.0.0 |
|
|
459
471
|
|
|
460
472
|
|
|
461
473
|
### Type Aliases
|
|
@@ -463,11 +475,15 @@ Remove all native listeners for this plugin.
|
|
|
463
475
|
|
|
464
476
|
#### Importance
|
|
465
477
|
|
|
478
|
+
The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)
|
|
479
|
+
|
|
466
480
|
<code>1 | 2 | 3 | 4 | 5</code>
|
|
467
481
|
|
|
468
482
|
|
|
469
483
|
#### Visibility
|
|
470
484
|
|
|
485
|
+
The notification visibility. For more details, see the [Android Developer Docs](https://developer.android.com/reference/androidx/core/app/NotificationCompat#VISIBILITY_PRIVATE)
|
|
486
|
+
|
|
471
487
|
<code>-1 | 0 | 1</code>
|
|
472
488
|
|
|
473
489
|
|
|
@@ -38,11 +38,26 @@ public class NotificationChannelManager {
|
|
|
38
38
|
public void createChannel(PluginCall call) {
|
|
39
39
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
|
40
40
|
JSObject channel = new JSObject();
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
if (call.getString(CHANNEL_ID) != null) {
|
|
42
|
+
channel.put(CHANNEL_ID, call.getString(CHANNEL_ID));
|
|
43
|
+
} else {
|
|
44
|
+
call.reject("Channel missing identifier");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (call.getString(CHANNEL_NAME) != null) {
|
|
48
|
+
channel.put(CHANNEL_NAME, call.getString(CHANNEL_NAME));
|
|
49
|
+
} else {
|
|
50
|
+
call.reject("Channel missing name");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (call.getInt(CHANNEL_IMPORTANCE) != null) {
|
|
54
|
+
channel.put(CHANNEL_IMPORTANCE, call.getInt(CHANNEL_IMPORTANCE));
|
|
55
|
+
} else {
|
|
56
|
+
call.reject("Channel missing importance");
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
43
59
|
channel.put(CHANNEL_DESCRIPTION, call.getString(CHANNEL_DESCRIPTION, ""));
|
|
44
60
|
channel.put(CHANNEL_VISIBILITY, call.getInt(CHANNEL_VISIBILITY, NotificationCompat.VISIBILITY_PUBLIC));
|
|
45
|
-
channel.put(CHANNEL_IMPORTANCE, call.getInt(CHANNEL_IMPORTANCE));
|
|
46
61
|
channel.put(CHANNEL_SOUND, call.getString(CHANNEL_SOUND, null));
|
|
47
62
|
channel.put(CHANNEL_VIBRATE, call.getBoolean(CHANNEL_VIBRATE, false));
|
|
48
63
|
channel.put(CHANNEL_USE_LIGHTS, call.getBoolean(CHANNEL_USE_LIGHTS, false));
|
package/dist/docs.json
CHANGED
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"text": "1.0.0"
|
|
150
150
|
}
|
|
151
151
|
],
|
|
152
|
-
"docs": "Check permission to receive push notifications.",
|
|
152
|
+
"docs": "Check permission to receive push notifications.\n\nOn Android the status is always granted because you can always\nreceive push notifications. If you need to check if the user allows\nto display notifications, use local-notifications plugin.",
|
|
153
153
|
"complexTypes": [
|
|
154
154
|
"PermissionStatus"
|
|
155
155
|
],
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
"text": "1.0.0"
|
|
167
167
|
}
|
|
168
168
|
],
|
|
169
|
-
"docs": "Request permission to receive push notifications.",
|
|
169
|
+
"docs": "Request permission to receive push notifications.\n\nOn Android it doesn't prompt for permission because you can always\nreceive push notifications.\n\nOn iOS, the first time you use the function, it will prompt the user\nfor push notification permission and return granted or denied based\non the user selection. On following calls it will currect status of\nthe permission without prompting again.",
|
|
170
170
|
"complexTypes": [
|
|
171
171
|
"PermissionStatus"
|
|
172
172
|
],
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
"PluginListenerHandle",
|
|
200
200
|
"Token"
|
|
201
201
|
],
|
|
202
|
-
"slug": "addlistenerregistration
|
|
202
|
+
"slug": "addlistenerregistration"
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
"name": "addListener",
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
"complexTypes": [
|
|
228
228
|
"PluginListenerHandle"
|
|
229
229
|
],
|
|
230
|
-
"slug": "addlistenerregistrationerror
|
|
230
|
+
"slug": "addlistenerregistrationerror"
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
233
|
"name": "addListener",
|
|
@@ -256,7 +256,7 @@
|
|
|
256
256
|
"PluginListenerHandle",
|
|
257
257
|
"PushNotificationSchema"
|
|
258
258
|
],
|
|
259
|
-
"slug": "addlistenerpushnotificationreceived
|
|
259
|
+
"slug": "addlistenerpushnotificationreceived"
|
|
260
260
|
},
|
|
261
261
|
{
|
|
262
262
|
"name": "addListener",
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
"PluginListenerHandle",
|
|
286
286
|
"ActionPerformed"
|
|
287
287
|
],
|
|
288
|
-
"slug": "addlistenerpushnotificationactionperformed
|
|
288
|
+
"slug": "addlistenerpushnotificationactionperformed"
|
|
289
289
|
},
|
|
290
290
|
{
|
|
291
291
|
"name": "removeAllListeners",
|
|
@@ -321,7 +321,7 @@
|
|
|
321
321
|
"name": "since"
|
|
322
322
|
}
|
|
323
323
|
],
|
|
324
|
-
"docs": "",
|
|
324
|
+
"docs": "List of notifications that are visible on the\nnotifications screen.",
|
|
325
325
|
"complexTypes": [
|
|
326
326
|
"PushNotificationSchema"
|
|
327
327
|
],
|
|
@@ -399,12 +399,16 @@
|
|
|
399
399
|
{
|
|
400
400
|
"name": "notification",
|
|
401
401
|
"tags": [
|
|
402
|
+
{
|
|
403
|
+
"text": "will be removed in next major version.",
|
|
404
|
+
"name": "deprecated"
|
|
405
|
+
},
|
|
402
406
|
{
|
|
403
407
|
"text": "1.0.0",
|
|
404
408
|
"name": "since"
|
|
405
409
|
}
|
|
406
410
|
],
|
|
407
|
-
"docs": "",
|
|
411
|
+
"docs": "It's not being returned.",
|
|
408
412
|
"complexTypes": [],
|
|
409
413
|
"type": "any"
|
|
410
414
|
},
|
|
@@ -416,7 +420,7 @@
|
|
|
416
420
|
"name": "since"
|
|
417
421
|
}
|
|
418
422
|
],
|
|
419
|
-
"docs": "",
|
|
423
|
+
"docs": "Any additional data that was included in the\npush notification payload.",
|
|
420
424
|
"complexTypes": [],
|
|
421
425
|
"type": "any"
|
|
422
426
|
},
|
|
@@ -428,7 +432,7 @@
|
|
|
428
432
|
"name": "since"
|
|
429
433
|
}
|
|
430
434
|
],
|
|
431
|
-
"docs": "",
|
|
435
|
+
"docs": "The action to be performed on the user opening the notification.\n\nOnly available on Android.",
|
|
432
436
|
"complexTypes": [],
|
|
433
437
|
"type": "string | undefined"
|
|
434
438
|
},
|
|
@@ -440,7 +444,7 @@
|
|
|
440
444
|
"name": "since"
|
|
441
445
|
}
|
|
442
446
|
],
|
|
443
|
-
"docs": "",
|
|
447
|
+
"docs": "Deep link from the notification.\n\nOnly available on Android.",
|
|
444
448
|
"complexTypes": [],
|
|
445
449
|
"type": "string | undefined"
|
|
446
450
|
},
|
|
@@ -452,7 +456,7 @@
|
|
|
452
456
|
"name": "since"
|
|
453
457
|
}
|
|
454
458
|
],
|
|
455
|
-
"docs": "Set the group identifier for notification grouping
|
|
459
|
+
"docs": "Set the group identifier for notification grouping.\n\nOnly available on Android. Works like `threadIdentifier` on iOS.",
|
|
456
460
|
"complexTypes": [],
|
|
457
461
|
"type": "string | undefined"
|
|
458
462
|
},
|
|
@@ -610,7 +614,7 @@
|
|
|
610
614
|
"name": "since"
|
|
611
615
|
}
|
|
612
616
|
],
|
|
613
|
-
"docs": "",
|
|
617
|
+
"docs": "List of all the Channels created by your app.",
|
|
614
618
|
"complexTypes": [
|
|
615
619
|
"Channel"
|
|
616
620
|
],
|
|
@@ -633,7 +637,7 @@
|
|
|
633
637
|
"name": "since"
|
|
634
638
|
}
|
|
635
639
|
],
|
|
636
|
-
"docs": "",
|
|
640
|
+
"docs": "Permission state of receiving notifications.",
|
|
637
641
|
"complexTypes": [
|
|
638
642
|
"PermissionState"
|
|
639
643
|
],
|
|
@@ -672,7 +676,7 @@
|
|
|
672
676
|
"name": "since"
|
|
673
677
|
}
|
|
674
678
|
],
|
|
675
|
-
"docs": "",
|
|
679
|
+
"docs": "On iOS it contains the APNS token.\nOn Android it contains the FCM token.",
|
|
676
680
|
"complexTypes": [],
|
|
677
681
|
"type": "string"
|
|
678
682
|
}
|
|
@@ -693,7 +697,7 @@
|
|
|
693
697
|
"name": "since"
|
|
694
698
|
}
|
|
695
699
|
],
|
|
696
|
-
"docs": "",
|
|
700
|
+
"docs": "The action performed on the notification.",
|
|
697
701
|
"complexTypes": [],
|
|
698
702
|
"type": "string"
|
|
699
703
|
},
|
|
@@ -705,7 +709,7 @@
|
|
|
705
709
|
"name": "since"
|
|
706
710
|
}
|
|
707
711
|
],
|
|
708
|
-
"docs": "",
|
|
712
|
+
"docs": "Text entered on the notification action.\n\nOnly available on iOS.",
|
|
709
713
|
"complexTypes": [],
|
|
710
714
|
"type": "string | undefined"
|
|
711
715
|
},
|
|
@@ -717,7 +721,7 @@
|
|
|
717
721
|
"name": "since"
|
|
718
722
|
}
|
|
719
723
|
],
|
|
720
|
-
"docs": "",
|
|
724
|
+
"docs": "The notification in which the action was performed.",
|
|
721
725
|
"complexTypes": [
|
|
722
726
|
"PushNotificationSchema"
|
|
723
727
|
],
|
|
@@ -731,7 +735,7 @@
|
|
|
731
735
|
{
|
|
732
736
|
"name": "Importance",
|
|
733
737
|
"slug": "importance",
|
|
734
|
-
"docs": "",
|
|
738
|
+
"docs": "The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)",
|
|
735
739
|
"types": [
|
|
736
740
|
{
|
|
737
741
|
"text": "1",
|
|
@@ -758,7 +762,7 @@
|
|
|
758
762
|
{
|
|
759
763
|
"name": "Visibility",
|
|
760
764
|
"slug": "visibility",
|
|
761
|
-
"docs": "",
|
|
765
|
+
"docs": "The notification visibility. For more details, see the [Android Developer Docs](https://developer.android.com/reference/androidx/core/app/NotificationCompat#VISIBILITY_PRIVATE)",
|
|
762
766
|
"types": [
|
|
763
767
|
{
|
|
764
768
|
"text": "-1",
|
|
@@ -79,12 +79,24 @@ export interface PushNotificationsPlugin {
|
|
|
79
79
|
/**
|
|
80
80
|
* Check permission to receive push notifications.
|
|
81
81
|
*
|
|
82
|
+
* On Android the status is always granted because you can always
|
|
83
|
+
* receive push notifications. If you need to check if the user allows
|
|
84
|
+
* to display notifications, use local-notifications plugin.
|
|
85
|
+
*
|
|
82
86
|
* @since 1.0.0
|
|
83
87
|
*/
|
|
84
88
|
checkPermissions(): Promise<PermissionStatus>;
|
|
85
89
|
/**
|
|
86
90
|
* Request permission to receive push notifications.
|
|
87
91
|
*
|
|
92
|
+
* On Android it doesn't prompt for permission because you can always
|
|
93
|
+
* receive push notifications.
|
|
94
|
+
*
|
|
95
|
+
* On iOS, the first time you use the function, it will prompt the user
|
|
96
|
+
* for push notification permission and return granted or denied based
|
|
97
|
+
* on the user selection. On following calls it will currect status of
|
|
98
|
+
* the permission without prompting again.
|
|
99
|
+
*
|
|
88
100
|
* @since 1.0.0
|
|
89
101
|
*/
|
|
90
102
|
requestPermissions(): Promise<PermissionStatus>;
|
|
@@ -155,23 +167,37 @@ export interface PushNotificationSchema {
|
|
|
155
167
|
*/
|
|
156
168
|
badge?: number;
|
|
157
169
|
/**
|
|
170
|
+
* It's not being returned.
|
|
171
|
+
*
|
|
172
|
+
* @deprecated will be removed in next major version.
|
|
158
173
|
* @since 1.0.0
|
|
159
174
|
*/
|
|
160
175
|
notification?: any;
|
|
161
176
|
/**
|
|
177
|
+
* Any additional data that was included in the
|
|
178
|
+
* push notification payload.
|
|
179
|
+
*
|
|
162
180
|
* @since 1.0.0
|
|
163
181
|
*/
|
|
164
182
|
data: any;
|
|
165
183
|
/**
|
|
184
|
+
* The action to be performed on the user opening the notification.
|
|
185
|
+
*
|
|
186
|
+
* Only available on Android.
|
|
187
|
+
*
|
|
166
188
|
* @since 1.0.0
|
|
167
189
|
*/
|
|
168
190
|
click_action?: string;
|
|
169
191
|
/**
|
|
192
|
+
* Deep link from the notification.
|
|
193
|
+
*
|
|
194
|
+
* Only available on Android.
|
|
195
|
+
*
|
|
170
196
|
* @since 1.0.0
|
|
171
197
|
*/
|
|
172
198
|
link?: string;
|
|
173
199
|
/**
|
|
174
|
-
* Set the group identifier for notification grouping
|
|
200
|
+
* Set the group identifier for notification grouping.
|
|
175
201
|
*
|
|
176
202
|
* Only available on Android. Works like `threadIdentifier` on iOS.
|
|
177
203
|
*
|
|
@@ -189,26 +215,40 @@ export interface PushNotificationSchema {
|
|
|
189
215
|
}
|
|
190
216
|
export interface ActionPerformed {
|
|
191
217
|
/**
|
|
218
|
+
* The action performed on the notification.
|
|
219
|
+
*
|
|
192
220
|
* @since 1.0.0
|
|
193
221
|
*/
|
|
194
222
|
actionId: string;
|
|
195
223
|
/**
|
|
224
|
+
* Text entered on the notification action.
|
|
225
|
+
*
|
|
226
|
+
* Only available on iOS.
|
|
227
|
+
*
|
|
196
228
|
* @since 1.0.0
|
|
197
229
|
*/
|
|
198
230
|
inputValue?: string;
|
|
199
231
|
/**
|
|
232
|
+
* The notification in which the action was performed.
|
|
233
|
+
*
|
|
200
234
|
* @since 1.0.0
|
|
201
235
|
*/
|
|
202
236
|
notification: PushNotificationSchema;
|
|
203
237
|
}
|
|
204
238
|
export interface Token {
|
|
205
239
|
/**
|
|
240
|
+
* On iOS it contains the APNS token.
|
|
241
|
+
* On Android it contains the FCM token.
|
|
242
|
+
*
|
|
206
243
|
* @since 1.0.0
|
|
207
244
|
*/
|
|
208
245
|
value: string;
|
|
209
246
|
}
|
|
210
247
|
export interface DeliveredNotifications {
|
|
211
248
|
/**
|
|
249
|
+
* List of notifications that are visible on the
|
|
250
|
+
* notifications screen.
|
|
251
|
+
*
|
|
212
252
|
* @since 1.0.0
|
|
213
253
|
*/
|
|
214
254
|
notifications: PushNotificationSchema[];
|
|
@@ -285,16 +325,28 @@ export interface Channel {
|
|
|
285
325
|
*/
|
|
286
326
|
vibration?: boolean;
|
|
287
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)
|
|
330
|
+
* @since 1.0.0
|
|
331
|
+
*/
|
|
288
332
|
export declare type Importance = 1 | 2 | 3 | 4 | 5;
|
|
333
|
+
/**
|
|
334
|
+
* The notification visibility. For more details, see the [Android Developer Docs](https://developer.android.com/reference/androidx/core/app/NotificationCompat#VISIBILITY_PRIVATE)
|
|
335
|
+
* @since 1.0.0
|
|
336
|
+
*/
|
|
289
337
|
export declare type Visibility = -1 | 0 | 1;
|
|
290
338
|
export interface ListChannelsResult {
|
|
291
339
|
/**
|
|
340
|
+
* List of all the Channels created by your app.
|
|
341
|
+
*
|
|
292
342
|
* @since 1.0.0
|
|
293
343
|
*/
|
|
294
344
|
channels: Channel[];
|
|
295
345
|
}
|
|
296
346
|
export interface PermissionStatus {
|
|
297
347
|
/**
|
|
348
|
+
* Permission state of receiving notifications.
|
|
349
|
+
*
|
|
298
350
|
* @since 1.0.0
|
|
299
351
|
*/
|
|
300
352
|
receive: PermissionState;
|
package/dist/plugin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/push-notifications",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
34
34
|
"verify:web": "npm run build",
|
|
35
35
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
36
|
-
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint --
|
|
36
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
|
37
37
|
"eslint": "eslint . --ext ts",
|
|
38
38
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
39
39
|
"swiftlint": "node-swiftlint",
|
|
@@ -41,13 +41,14 @@
|
|
|
41
41
|
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
|
|
42
42
|
"clean": "rimraf ./dist",
|
|
43
43
|
"watch": "tsc --watch",
|
|
44
|
-
"prepublishOnly": "npm run build"
|
|
44
|
+
"prepublishOnly": "npm run build",
|
|
45
|
+
"publish:cocoapod": "pod trunk push ./CapacitorPushNotifications.podspec --allow-warnings"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@capacitor/android": "^3.0.0",
|
|
48
49
|
"@capacitor/cli": "^3.0.0",
|
|
49
50
|
"@capacitor/core": "^3.0.0",
|
|
50
|
-
"@capacitor/docgen": "0.0.
|
|
51
|
+
"@capacitor/docgen": "0.0.18",
|
|
51
52
|
"@capacitor/ios": "^3.0.0",
|
|
52
53
|
"@ionic/eslint-config": "^0.3.0",
|
|
53
54
|
"@ionic/prettier-config": "~1.0.1",
|
|
@@ -79,5 +80,5 @@
|
|
|
79
80
|
"publishConfig": {
|
|
80
81
|
"access": "public"
|
|
81
82
|
},
|
|
82
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "64df93225736e9dfad336562f5e53e5a2243052b"
|
|
83
84
|
}
|