@capacitor/local-notifications 1.0.9 → 4.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 +74 -0
- package/CapacitorLocalNotifications.podspec +1 -1
- package/README.md +80 -57
- package/android/build.gradle +10 -11
- package/android/src/main/java/com/capacitorjs/plugins/localnotifications/DateMatch.java +45 -10
- package/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationManager.java +48 -32
- package/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationRestoreReceiver.java +2 -1
- package/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationSchedule.java +3 -1
- package/android/src/main/java/com/capacitorjs/plugins/localnotifications/NotificationChannelManager.java +2 -6
- package/android/src/main/java/com/capacitorjs/plugins/localnotifications/TimedNotificationPublisher.java +6 -1
- package/android/src/main/res/drawable/ic_transparent.xml +12 -0
- package/dist/docs.json +72 -25
- package/dist/esm/definitions.d.ts +28 -3
- package/dist/esm/definitions.js +13 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +15 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +15 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/LocalNotificationsPlugin.m +1 -1
- package/ios/Plugin/LocalNotificationsPlugin.swift +3 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,80 @@
|
|
|
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
|
+
# 4.0.0-beta.0 (2022-06-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **local-notifications:** Add FLAG_MUTABLE to pending intents for SDK 31 support ([#914](https://github.com/ionic-team/capacitor-plugins/issues/914)) ([9ad0ce6](https://github.com/ionic-team/capacitor-plugins/commit/9ad0ce6f1497f425db907908be1b125e6ed83dbc))
|
|
12
|
+
* **local-notifications:** Handle case of not allowed exact notifications ([#954](https://github.com/ionic-team/capacitor-plugins/issues/954)) ([5016996](https://github.com/ionic-team/capacitor-plugins/commit/5016996b3a4e9824d8dd2bc4c71892fc5dbc7365))
|
|
13
|
+
* correct addListeners links ([#655](https://github.com/ionic-team/capacitor-plugins/issues/655)) ([f9871e7](https://github.com/ionic-team/capacitor-plugins/commit/f9871e7bd53478addb21155e148829f550c0e457))
|
|
14
|
+
* inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
|
|
15
|
+
* Make removeAllListeners return a promise ([#895](https://github.com/ionic-team/capacitor-plugins/issues/895)) ([e5c49d6](https://github.com/ionic-team/capacitor-plugins/commit/e5c49d64445dca70286334e6a0441d8021197b13))
|
|
16
|
+
* remove postpublish scripts ([#656](https://github.com/ionic-team/capacitor-plugins/issues/656)) ([ed6ac49](https://github.com/ionic-team/capacitor-plugins/commit/ed6ac499ebf4a47525071ccbfc36c27503e11f60))
|
|
17
|
+
* **android:** fire localNotificationReceived event on Android ([#217](https://github.com/ionic-team/capacitor-plugins/issues/217)) ([d97682d](https://github.com/ionic-team/capacitor-plugins/commit/d97682d9f3d6f612993716c3bc35d3015c4e0c07))
|
|
18
|
+
* **local-notification:** Throw unavailable if Notification API not supported ([#285](https://github.com/ionic-team/capacitor-plugins/issues/285)) ([a90a88b](https://github.com/ionic-team/capacitor-plugins/commit/a90a88b217f5fa2a257416050afb476dd84d8051))
|
|
19
|
+
* **local-notifications:** Adding check for `new Notification` support ([#295](https://github.com/ionic-team/capacitor-plugins/issues/295)) ([a806f22](https://github.com/ionic-team/capacitor-plugins/commit/a806f22577209322bdc93ef7fe5490d3b0b6e42f))
|
|
20
|
+
* **local-notifications:** Checking for null schedule in notification JSObject ([#258](https://github.com/ionic-team/capacitor-plugins/issues/258)) ([73cb416](https://github.com/ionic-team/capacitor-plugins/commit/73cb4168329622bb5a6625c900090a01fc5eca99))
|
|
21
|
+
* **local-notifications:** don't store notifications if not scheduled ([#310](https://github.com/ionic-team/capacitor-plugins/issues/310)) ([c1445fd](https://github.com/ionic-team/capacitor-plugins/commit/c1445fddc69db27506f83b3ea56d8e90d4384346))
|
|
22
|
+
* **local-notifications:** extra not being returned on notification events ([#340](https://github.com/ionic-team/capacitor-plugins/issues/340)) ([5b03a7f](https://github.com/ionic-team/capacitor-plugins/commit/5b03a7fdbfd2e8293a9fc3726185b516d7efa9a9))
|
|
23
|
+
* **local-notifications:** Make getPending not return already fired notifications ([#256](https://github.com/ionic-team/capacitor-plugins/issues/256)) ([fb96f8a](https://github.com/ionic-team/capacitor-plugins/commit/fb96f8ab8c4776528e5825be6c2e19567462eef8))
|
|
24
|
+
* **local-notifications:** Opt out of Capacitor date serialization ([#264](https://github.com/ionic-team/capacitor-plugins/issues/264)) ([6e447d5](https://github.com/ionic-team/capacitor-plugins/commit/6e447d54aff3cac47df540addf2a0bf05238c158))
|
|
25
|
+
* **local-notifications:** requestPermissions and checkPermissions return if enabled ([#494](https://github.com/ionic-team/capacitor-plugins/issues/494)) ([555bb1f](https://github.com/ionic-team/capacitor-plugins/commit/555bb1f9bd02ccd999891a316e7ee0f8c1844e92))
|
|
26
|
+
* **local-notifications:** return schedule on as object ([#603](https://github.com/ionic-team/capacitor-plugins/issues/603)) ([ca34b01](https://github.com/ionic-team/capacitor-plugins/commit/ca34b01c73f14bb0ad14e8a501210e42a0e65b04))
|
|
27
|
+
* **local-notifications:** Throw errors if missing mandatory channel fields ([#577](https://github.com/ionic-team/capacitor-plugins/issues/577)) ([6bf3a4f](https://github.com/ionic-team/capacitor-plugins/commit/6bf3a4f0de8880588200ae60e73427fa6959ea20))
|
|
28
|
+
* **local-notifications:** use proper rollup config ([#528](https://github.com/ionic-team/capacitor-plugins/issues/528)) ([cd17daa](https://github.com/ionic-team/capacitor-plugins/commit/cd17daa02241f50299232212ad72722d8a35ee16))
|
|
29
|
+
* normalize use of integers for notification IDs ([#195](https://github.com/ionic-team/capacitor-plugins/issues/195)) ([b56e111](https://github.com/ionic-team/capacitor-plugins/commit/b56e1118227ee58d1872dbb32a18b8484290d3c7))
|
|
30
|
+
* **web:** fix scheduled notifications not being sent ([#220](https://github.com/ionic-team/capacitor-plugins/issues/220)) ([c8e92d6](https://github.com/ionic-team/capacitor-plugins/commit/c8e92d6a178f8b3278b1d3a9c364eb8120d28848))
|
|
31
|
+
* add es2017 lib to tsconfig ([#180](https://github.com/ionic-team/capacitor-plugins/issues/180)) ([2c3776c](https://github.com/ionic-team/capacitor-plugins/commit/2c3776c38ca025c5ee965dec10ccf1cdb6c02e2f))
|
|
32
|
+
* Use the event names from Capacitor 2 ([#215](https://github.com/ionic-team/capacitor-plugins/issues/215)) ([008fe9e](https://github.com/ionic-team/capacitor-plugins/commit/008fe9e9bf6a960b0ab7b6fc4d5014f10ba13df8))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* set targetSDK default value to 31 ([#824](https://github.com/ionic-team/capacitor-plugins/issues/824)) ([3ee10de](https://github.com/ionic-team/capacitor-plugins/commit/3ee10de98067984c1a4e75295d001c5a895c47f4))
|
|
38
|
+
* set targetSDK default value to 32 ([#970](https://github.com/ionic-team/capacitor-plugins/issues/970)) ([fa70d96](https://github.com/ionic-team/capacitor-plugins/commit/fa70d96f141af751aae53ceb5642c46b204f5958))
|
|
39
|
+
* Upgrade gradle to 7.4 ([#826](https://github.com/ionic-team/capacitor-plugins/issues/826)) ([5db0906](https://github.com/ionic-team/capacitor-plugins/commit/5db0906f6264287c4f8e69dbaecf19d4d387824b))
|
|
40
|
+
* Use java 11 ([#910](https://github.com/ionic-team/capacitor-plugins/issues/910)) ([5acb2a2](https://github.com/ionic-team/capacitor-plugins/commit/5acb2a288a413492b163e4e97da46a085d9e4be0))
|
|
41
|
+
* **android:** implements Activity Result API changes for permissions and activity results ([#222](https://github.com/ionic-team/capacitor-plugins/issues/222)) ([f671b9f](https://github.com/ionic-team/capacitor-plugins/commit/f671b9f4b472806ef43db6dcf302d4503cf1828c))
|
|
42
|
+
* **local-notifications:** add more info to pending notifications ([#211](https://github.com/ionic-team/capacitor-plugins/issues/211)) ([7c50487](https://github.com/ionic-team/capacitor-plugins/commit/7c50487d40836380a27bd4c8d3655d83e0c3a720))
|
|
43
|
+
* **local-notifications:** Add weekday scheduling support for Android and iOS ([#756](https://github.com/ionic-team/capacitor-plugins/issues/756)) ([430b485](https://github.com/ionic-team/capacitor-plugins/commit/430b48592ce59ccc967dd9a081873d7dc3937e93))
|
|
44
|
+
* **local-notifications:** Adding summary text to grouped notifications ([#296](https://github.com/ionic-team/capacitor-plugins/issues/296)) ([f625bd2](https://github.com/ionic-team/capacitor-plugins/commit/f625bd28bc00dbd0b51d7bdecf5e6f3077dcc7a9))
|
|
45
|
+
* **local-notifications:** Fire local notifications while app is idle ([#237](https://github.com/ionic-team/capacitor-plugins/issues/237)) ([43380ef](https://github.com/ionic-team/capacitor-plugins/commit/43380efa8901adf9d669d0c1ef20038a2fd7df8e))
|
|
46
|
+
* **local-notifications:** Support for Big Text and Inbox Notification Style ([#280](https://github.com/ionic-team/capacitor-plugins/issues/280)) ([dc96ef9](https://github.com/ionic-team/capacitor-plugins/commit/dc96ef923725f5b53346431d35f82d5ff13f4e17))
|
|
47
|
+
* **local-notifications:** Support setting seconds in Schedule "on" ([#253](https://github.com/ionic-team/capacitor-plugins/issues/253)) ([4ec8d06](https://github.com/ionic-team/capacitor-plugins/commit/4ec8d06e0cb52403e541a05e5c3518d4c5ea754e))
|
|
48
|
+
* **web:** implement ActionPerformed and Received events ([#219](https://github.com/ionic-team/capacitor-plugins/issues/219)) ([e062901](https://github.com/ionic-team/capacitor-plugins/commit/e062901fc2e55cf6b6dc1ab20258d80a0be8b2d9))
|
|
49
|
+
* add commonjs output format ([#179](https://github.com/ionic-team/capacitor-plugins/issues/179)) ([8e9e098](https://github.com/ionic-team/capacitor-plugins/commit/8e9e09862064b3f6771d7facbc4008e995d9b463))
|
|
50
|
+
* Local Notifications plugin ([#94](https://github.com/ionic-team/capacitor-plugins/issues/94)) ([e59ba9c](https://github.com/ionic-team/capacitor-plugins/commit/e59ba9ceea78a26ec60e521825f228baa9d74577))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# [1.1.0](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.10...@capacitor/local-notifications@1.1.0) (2022-01-19)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Bug Fixes
|
|
60
|
+
|
|
61
|
+
* inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Features
|
|
65
|
+
|
|
66
|
+
* **local-notifications:** Add weekday scheduling support for Android and iOS ([#756](https://github.com/ionic-team/capacitor-plugins/issues/756)) ([430b485](https://github.com/ionic-team/capacitor-plugins/commit/430b48592ce59ccc967dd9a081873d7dc3937e93))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## [1.0.10](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.9...@capacitor/local-notifications@1.0.10) (2022-01-10)
|
|
73
|
+
|
|
74
|
+
**Note:** Version bump only for package @capacitor/local-notifications
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
6
80
|
## [1.0.9](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.8...@capacitor/local-notifications@1.0.9) (2021-11-03)
|
|
7
81
|
|
|
8
82
|
**Note:** Version bump only for package @capacitor/local-notifications
|
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'local-notifications/ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target = '
|
|
14
|
+
s.ios.deployment_target = '13.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
|
17
17
|
end
|
package/README.md
CHANGED
|
@@ -9,6 +9,16 @@ npm install @capacitor/local-notifications
|
|
|
9
9
|
npx cap sync
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
+
## Android
|
|
13
|
+
|
|
14
|
+
Starting on Android 12, scheduled notifications won't be exact unless this permission is added to your `AndroidManifest.xml`:
|
|
15
|
+
|
|
16
|
+
```xml
|
|
17
|
+
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Note that even if the permission is present, users can still disable exact notifications from the app settings.
|
|
21
|
+
|
|
12
22
|
## Configuration
|
|
13
23
|
|
|
14
24
|
<docgen-config>
|
|
@@ -16,11 +26,11 @@ npx cap sync
|
|
|
16
26
|
|
|
17
27
|
On Android, the Local Notifications can be configured with the following options:
|
|
18
28
|
|
|
19
|
-
| Prop | Type | Description
|
|
20
|
-
| --------------- | ------------------- |
|
|
21
|
-
| **`smallIcon`** | <code>string</code> | Set the default status bar icon for notifications. Icons should be placed in your app's `res/drawable` folder. The value for this option should be the drawable resource ID, which is the filename without an extension. Only available for Android.
|
|
22
|
-
| **`iconColor`** | <code>string</code> | Set the default color of status bar icons for notifications. Only available for Android.
|
|
23
|
-
| **`sound`** | <code>string</code> | Set the default notification sound for notifications. On Android 26+ it sets the default channel sound and can't be changed unless the app is uninstalled. Only available for Android.
|
|
29
|
+
| Prop | Type | Description | Since |
|
|
30
|
+
| --------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
31
|
+
| **`smallIcon`** | <code>string</code> | Set the default status bar icon for notifications. Icons should be placed in your app's `res/drawable` folder. The value for this option should be the drawable resource ID, which is the filename without an extension. Only available for Android. | 1.0.0 |
|
|
32
|
+
| **`iconColor`** | <code>string</code> | Set the default color of status bar icons for notifications. Only available for Android. | 1.0.0 |
|
|
33
|
+
| **`sound`** | <code>string</code> | Set the default notification sound for notifications. On Android 26+ it sets the default channel sound and can't be changed unless the app is uninstalled. If the audio file is not found, it will result in the default system sound being played on Android 21-25 and no sound on Android 26+. Only available for Android. | 1.0.0 |
|
|
24
34
|
|
|
25
35
|
### Examples
|
|
26
36
|
|
|
@@ -83,6 +93,7 @@ If the device has entered [Doze](https://developer.android.com/training/monitori
|
|
|
83
93
|
* [`removeAllListeners()`](#removealllisteners)
|
|
84
94
|
* [Interfaces](#interfaces)
|
|
85
95
|
* [Type Aliases](#type-aliases)
|
|
96
|
+
* [Enums](#enums)
|
|
86
97
|
|
|
87
98
|
</docgen-index>
|
|
88
99
|
|
|
@@ -177,7 +188,7 @@ Check if notifications are enabled or not.
|
|
|
177
188
|
### createChannel(...)
|
|
178
189
|
|
|
179
190
|
```typescript
|
|
180
|
-
createChannel(channel:
|
|
191
|
+
createChannel(channel: Channel) => Promise<void>
|
|
181
192
|
```
|
|
182
193
|
|
|
183
194
|
Create a notification channel.
|
|
@@ -196,16 +207,16 @@ Only available for Android.
|
|
|
196
207
|
### deleteChannel(...)
|
|
197
208
|
|
|
198
209
|
```typescript
|
|
199
|
-
deleteChannel(
|
|
210
|
+
deleteChannel(args: { id: string; }) => Promise<void>
|
|
200
211
|
```
|
|
201
212
|
|
|
202
213
|
Delete a notification channel.
|
|
203
214
|
|
|
204
215
|
Only available for Android.
|
|
205
216
|
|
|
206
|
-
| Param
|
|
207
|
-
|
|
|
208
|
-
| **`
|
|
217
|
+
| Param | Type |
|
|
218
|
+
| ---------- | ---------------------------- |
|
|
219
|
+
| **`args`** | <code>{ id: string; }</code> |
|
|
209
220
|
|
|
210
221
|
**Since:** 1.0.0
|
|
211
222
|
|
|
@@ -340,29 +351,29 @@ The object that describes a local notification.
|
|
|
340
351
|
|
|
341
352
|
#### LocalNotificationSchema
|
|
342
353
|
|
|
343
|
-
| Prop | Type | Description
|
|
344
|
-
| ---------------------- | --------------------------------------------- |
|
|
345
|
-
| **`title`** | <code>string</code> | The title of the notification.
|
|
346
|
-
| **`body`** | <code>string</code> | The body of the notification, shown below the title.
|
|
347
|
-
| **`largeBody`** | <code>string</code> | Sets a multiline text block for display in a big text notification style.
|
|
348
|
-
| **`summaryText`** | <code>string</code> | Used to set the summary text detail in inbox and big text notification styles. Only available for Android.
|
|
349
|
-
| **`id`** | <code>number</code> | The notification identifier.
|
|
350
|
-
| **`schedule`** | <code><a href="#schedule">Schedule</a></code> | <a href="#schedule">Schedule</a> this notification for a later time.
|
|
351
|
-
| **`sound`** | <code>string</code> | Name of the audio file to play when this notification is displayed. Include the file extension with the filename. On iOS, the file should be in the app bundle. On Android, the file should be in res/raw folder. Recommended format is `.wav` because is supported by both iOS and Android. Only available for iOS and Android < 26. For Android 26+ use channelId of a channel configured with the desired sound. | 1.0.0 |
|
|
352
|
-
| **`smallIcon`** | <code>string</code> | Set a custom status bar icon. If set, this overrides the `smallIcon` option from Capacitor configuration. Icons should be placed in your app's `res/drawable` folder. The value for this option should be the drawable resource ID, which is the filename without an extension. Only available for Android.
|
|
353
|
-
| **`largeIcon`** | <code>string</code> | Set a large icon for notifications. Icons should be placed in your app's `res/drawable` folder. The value for this option should be the drawable resource ID, which is the filename without an extension. Only available for Android.
|
|
354
|
-
| **`iconColor`** | <code>string</code> | Set the color of the notification icon. Only available for Android.
|
|
355
|
-
| **`attachments`** | <code>Attachment[]</code> | Set attachments for this notification.
|
|
356
|
-
| **`actionTypeId`** | <code>string</code> | Associate an action type with this notification.
|
|
357
|
-
| **`extra`** | <code>any</code> | Set extra data to store within this notification.
|
|
358
|
-
| **`threadIdentifier`** | <code>string</code> | Used to group multiple notifications. Sets `threadIdentifier` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS.
|
|
359
|
-
| **`summaryArgument`** | <code>string</code> | The string this notification adds to the category's summary format string. Sets `summaryArgument` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS 12+.
|
|
360
|
-
| **`group`** | <code>string</code> | Used to group multiple notifications. Calls `setGroup()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android.
|
|
361
|
-
| **`groupSummary`** | <code>boolean</code> | If true, this notification becomes the summary for a group of notifications. Calls `setGroupSummary()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android when using `group`.
|
|
362
|
-
| **`channelId`** | <code>string</code> | Specifies the channel the notification should be delivered on. If channel with the given name does not exist then the notification will not fire. If not provided, it will use the default channel. Calls `setChannelId()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android 26+.
|
|
363
|
-
| **`ongoing`** | <code>boolean</code> | If true, the notification can't be swiped away. Calls `setOngoing()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android.
|
|
364
|
-
| **`autoCancel`** | <code>boolean</code> | If true, the notification is canceled when the user clicks on it. Calls `setAutoCancel()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android.
|
|
365
|
-
| **`inboxList`** | <code>string[]</code> | Sets a list of strings for display in an inbox style notification. Up to 5 strings are allowed. Only available for Android.
|
|
354
|
+
| Prop | Type | Description | Since |
|
|
355
|
+
| ---------------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
356
|
+
| **`title`** | <code>string</code> | The title of the notification. | 1.0.0 |
|
|
357
|
+
| **`body`** | <code>string</code> | The body of the notification, shown below the title. | 1.0.0 |
|
|
358
|
+
| **`largeBody`** | <code>string</code> | Sets a multiline text block for display in a big text notification style. | 1.0.0 |
|
|
359
|
+
| **`summaryText`** | <code>string</code> | Used to set the summary text detail in inbox and big text notification styles. Only available for Android. | 1.0.0 |
|
|
360
|
+
| **`id`** | <code>number</code> | The notification identifier. | 1.0.0 |
|
|
361
|
+
| **`schedule`** | <code><a href="#schedule">Schedule</a></code> | <a href="#schedule">Schedule</a> this notification for a later time. | 1.0.0 |
|
|
362
|
+
| **`sound`** | <code>string</code> | Name of the audio file to play when this notification is displayed. Include the file extension with the filename. On iOS, the file should be in the app bundle. On Android, the file should be in res/raw folder. Recommended format is `.wav` because is supported by both iOS and Android. Only available for iOS and Android < 26. For Android 26+ use channelId of a channel configured with the desired sound. If the sound file is not found, (i.e. empty string or wrong name) the default system notification sound will be used. If not provided, it will produce the default sound on Android and no sound on iOS. | 1.0.0 |
|
|
363
|
+
| **`smallIcon`** | <code>string</code> | Set a custom status bar icon. If set, this overrides the `smallIcon` option from Capacitor configuration. Icons should be placed in your app's `res/drawable` folder. The value for this option should be the drawable resource ID, which is the filename without an extension. Only available for Android. | 1.0.0 |
|
|
364
|
+
| **`largeIcon`** | <code>string</code> | Set a large icon for notifications. Icons should be placed in your app's `res/drawable` folder. The value for this option should be the drawable resource ID, which is the filename without an extension. Only available for Android. | 1.0.0 |
|
|
365
|
+
| **`iconColor`** | <code>string</code> | Set the color of the notification icon. Only available for Android. | 1.0.0 |
|
|
366
|
+
| **`attachments`** | <code>Attachment[]</code> | Set attachments for this notification. | 1.0.0 |
|
|
367
|
+
| **`actionTypeId`** | <code>string</code> | Associate an action type with this notification. | 1.0.0 |
|
|
368
|
+
| **`extra`** | <code>any</code> | Set extra data to store within this notification. | 1.0.0 |
|
|
369
|
+
| **`threadIdentifier`** | <code>string</code> | Used to group multiple notifications. Sets `threadIdentifier` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS. | 1.0.0 |
|
|
370
|
+
| **`summaryArgument`** | <code>string</code> | The string this notification adds to the category's summary format string. Sets `summaryArgument` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS 12+. | 1.0.0 |
|
|
371
|
+
| **`group`** | <code>string</code> | Used to group multiple notifications. Calls `setGroup()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android. | 1.0.0 |
|
|
372
|
+
| **`groupSummary`** | <code>boolean</code> | If true, this notification becomes the summary for a group of notifications. Calls `setGroupSummary()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android when using `group`. | 1.0.0 |
|
|
373
|
+
| **`channelId`** | <code>string</code> | Specifies the channel the notification should be delivered on. If channel with the given name does not exist then the notification will not fire. If not provided, it will use the default channel. Calls `setChannelId()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android 26+. | 1.0.0 |
|
|
374
|
+
| **`ongoing`** | <code>boolean</code> | If true, the notification can't be swiped away. Calls `setOngoing()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android. | 1.0.0 |
|
|
375
|
+
| **`autoCancel`** | <code>boolean</code> | If true, the notification is canceled when the user clicks on it. Calls `setAutoCancel()` on [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder) with the provided value. Only available for Android. | 1.0.0 |
|
|
376
|
+
| **`inboxList`** | <code>string[]</code> | Sets a list of strings for display in an inbox style notification. Up to 5 strings are allowed. Only available for Android. | 1.0.0 |
|
|
366
377
|
|
|
367
378
|
|
|
368
379
|
#### Schedule
|
|
@@ -434,14 +445,15 @@ Enables basic storage and retrieval of dates and times.
|
|
|
434
445
|
|
|
435
446
|
#### ScheduleOn
|
|
436
447
|
|
|
437
|
-
| Prop
|
|
438
|
-
|
|
|
439
|
-
| **`year`**
|
|
440
|
-
| **`month`**
|
|
441
|
-
| **`day`**
|
|
442
|
-
| **`
|
|
443
|
-
| **`
|
|
444
|
-
| **`
|
|
448
|
+
| Prop | Type |
|
|
449
|
+
| ------------- | ------------------------------------------- |
|
|
450
|
+
| **`year`** | <code>number</code> |
|
|
451
|
+
| **`month`** | <code>number</code> |
|
|
452
|
+
| **`day`** | <code>number</code> |
|
|
453
|
+
| **`weekday`** | <code><a href="#weekday">Weekday</a></code> |
|
|
454
|
+
| **`hour`** | <code>number</code> |
|
|
455
|
+
| **`minute`** | <code>number</code> |
|
|
456
|
+
| **`second`** | <code>number</code> |
|
|
445
457
|
|
|
446
458
|
|
|
447
459
|
#### Attachment
|
|
@@ -537,17 +549,17 @@ An action that can be taken when a notification is displayed.
|
|
|
537
549
|
|
|
538
550
|
#### Channel
|
|
539
551
|
|
|
540
|
-
| Prop | Type | Description
|
|
541
|
-
| ----------------- | ------------------------------------------------- |
|
|
542
|
-
| **`id`** | <code>string</code> | The channel identifier.
|
|
543
|
-
| **`name`** | <code>string</code> | The human-friendly name of this channel (presented to the user).
|
|
544
|
-
| **`description`** | <code>string</code> | The description of this channel (presented to the user).
|
|
545
|
-
| **`sound`** | <code>string</code> | The sound that should be played for notifications posted to this channel. Notification channels with an importance of at least `3` should have a sound. The file name of a sound file should be specified relative to the android app `res/raw` directory. | 1.0.0 |
|
|
546
|
-
| **`importance`** | <code><a href="#importance">Importance</a></code> | The level of interruption for notifications posted to this channel.
|
|
547
|
-
| **`visibility`** | <code><a href="#visibility">Visibility</a></code> | The visibility of notifications posted to this channel. This setting is for whether notifications posted to this channel appear on the lockscreen or not, and if so, whether they appear in a redacted form.
|
|
548
|
-
| **`lights`** | <code>boolean</code> | Whether notifications posted to this channel should display notification lights, on devices that support it.
|
|
549
|
-
| **`lightColor`** | <code>string</code> | The light color for notifications posted to this channel. Only supported if lights are enabled on this channel and the device supports it. Supported color formats are `#RRGGBB` and `#RRGGBBAA`.
|
|
550
|
-
| **`vibration`** | <code>boolean</code> | Whether notifications posted to this channel should vibrate.
|
|
552
|
+
| Prop | Type | Description | Default | Since |
|
|
553
|
+
| ----------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ----- |
|
|
554
|
+
| **`id`** | <code>string</code> | The channel identifier. | | 1.0.0 |
|
|
555
|
+
| **`name`** | <code>string</code> | The human-friendly name of this channel (presented to the user). | | 1.0.0 |
|
|
556
|
+
| **`description`** | <code>string</code> | The description of this channel (presented to the user). | | 1.0.0 |
|
|
557
|
+
| **`sound`** | <code>string</code> | The sound that should be played for notifications posted to this channel. Notification channels with an importance of at least `3` should have a sound. The file name of a sound file should be specified relative to the android app `res/raw` directory. If the sound is not provided, or the sound file is not found no sound will be used. | | 1.0.0 |
|
|
558
|
+
| **`importance`** | <code><a href="#importance">Importance</a></code> | The level of interruption for notifications posted to this channel. | <code>`3`</code> | 1.0.0 |
|
|
559
|
+
| **`visibility`** | <code><a href="#visibility">Visibility</a></code> | The visibility of notifications posted to this channel. This setting is for whether notifications posted to this channel appear on the lockscreen or not, and if so, whether they appear in a redacted form. | | 1.0.0 |
|
|
560
|
+
| **`lights`** | <code>boolean</code> | Whether notifications posted to this channel should display notification lights, on devices that support it. | | 1.0.0 |
|
|
561
|
+
| **`lightColor`** | <code>string</code> | The light color for notifications posted to this channel. Only supported if lights are enabled on this channel and the device supports it. Supported color formats are `#RRGGBB` and `#RRGGBBAA`. | | 1.0.0 |
|
|
562
|
+
| **`vibration`** | <code>boolean</code> | Whether notifications posted to this channel should vibrate. | | 1.0.0 |
|
|
551
563
|
|
|
552
564
|
|
|
553
565
|
#### ListChannelsResult
|
|
@@ -588,11 +600,6 @@ An action that can be taken when a notification is displayed.
|
|
|
588
600
|
<code>'year' | 'month' | 'two-weeks' | 'week' | 'day' | 'hour' | 'minute' | 'second'</code>
|
|
589
601
|
|
|
590
602
|
|
|
591
|
-
#### NotificationChannel
|
|
592
|
-
|
|
593
|
-
<code><a href="#channel">Channel</a></code>
|
|
594
|
-
|
|
595
|
-
|
|
596
603
|
#### Importance
|
|
597
604
|
|
|
598
605
|
The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)
|
|
@@ -611,4 +618,20 @@ The notification visibility. For more details, see the [Android Developer Docs](
|
|
|
611
618
|
|
|
612
619
|
<code>'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'</code>
|
|
613
620
|
|
|
621
|
+
|
|
622
|
+
### Enums
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
#### Weekday
|
|
626
|
+
|
|
627
|
+
| Members | Value |
|
|
628
|
+
| --------------- | -------------- |
|
|
629
|
+
| **`Sunday`** | <code>1</code> |
|
|
630
|
+
| **`Monday`** | <code>2</code> |
|
|
631
|
+
| **`Tuesday`** | <code>3</code> |
|
|
632
|
+
| **`Wednesday`** | <code>4</code> |
|
|
633
|
+
| **`Thursday`** | <code>5</code> |
|
|
634
|
+
| **`Friday`** | <code>6</code> |
|
|
635
|
+
| **`Saturday`** | <code>7</code> |
|
|
636
|
+
|
|
614
637
|
</docgen-api>
|
package/android/build.gradle
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
ext {
|
|
2
|
-
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
@@ -11,17 +11,17 @@ buildscript {
|
|
|
11
11
|
mavenCentral()
|
|
12
12
|
}
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:
|
|
14
|
+
classpath 'com.android.tools.build:gradle:7.2.1'
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
apply plugin: 'com.android.library'
|
|
19
19
|
|
|
20
20
|
android {
|
|
21
|
-
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
21
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
|
|
22
22
|
defaultConfig {
|
|
23
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
24
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
23
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
24
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
|
|
25
25
|
versionCode 1
|
|
26
26
|
versionName "1.0"
|
|
27
27
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -36,14 +36,13 @@ android {
|
|
|
36
36
|
abortOnError false
|
|
37
37
|
}
|
|
38
38
|
compileOptions {
|
|
39
|
-
sourceCompatibility JavaVersion.
|
|
40
|
-
targetCompatibility JavaVersion.
|
|
39
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
40
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
repositories {
|
|
45
45
|
google()
|
|
46
|
-
jcenter()
|
|
47
46
|
mavenCentral()
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -14,6 +14,7 @@ public class DateMatch {
|
|
|
14
14
|
private Integer year;
|
|
15
15
|
private Integer month;
|
|
16
16
|
private Integer day;
|
|
17
|
+
private Integer weekday;
|
|
17
18
|
private Integer hour;
|
|
18
19
|
private Integer minute;
|
|
19
20
|
private Integer second;
|
|
@@ -48,6 +49,14 @@ public class DateMatch {
|
|
|
48
49
|
this.day = day;
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
public Integer getWeekday() {
|
|
53
|
+
return weekday;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public void setWeekday(Integer weekday) {
|
|
57
|
+
this.weekday = weekday;
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
public Integer getHour() {
|
|
52
61
|
return hour;
|
|
53
62
|
}
|
|
@@ -106,6 +115,8 @@ public class DateMatch {
|
|
|
106
115
|
incrementUnit = Calendar.YEAR;
|
|
107
116
|
} else if (unit == Calendar.DAY_OF_MONTH) {
|
|
108
117
|
incrementUnit = Calendar.MONTH;
|
|
118
|
+
} else if (unit == Calendar.DAY_OF_WEEK) {
|
|
119
|
+
incrementUnit = Calendar.WEEK_OF_MONTH;
|
|
109
120
|
} else if (unit == Calendar.HOUR_OF_DAY) {
|
|
110
121
|
incrementUnit = Calendar.DAY_OF_MONTH;
|
|
111
122
|
} else if (unit == Calendar.MINUTE) {
|
|
@@ -135,6 +146,10 @@ public class DateMatch {
|
|
|
135
146
|
next.set(Calendar.DAY_OF_MONTH, day);
|
|
136
147
|
if (unit == -1) unit = Calendar.DAY_OF_MONTH;
|
|
137
148
|
}
|
|
149
|
+
if (weekday != null) {
|
|
150
|
+
next.set(Calendar.DAY_OF_WEEK, weekday);
|
|
151
|
+
if (unit == -1) unit = Calendar.DAY_OF_WEEK;
|
|
152
|
+
}
|
|
138
153
|
if (hour != null) {
|
|
139
154
|
next.set(Calendar.HOUR_OF_DAY, hour);
|
|
140
155
|
if (unit == -1) unit = Calendar.HOUR_OF_DAY;
|
|
@@ -160,6 +175,8 @@ public class DateMatch {
|
|
|
160
175
|
month +
|
|
161
176
|
", day=" +
|
|
162
177
|
day +
|
|
178
|
+
", weekday=" +
|
|
179
|
+
weekday +
|
|
163
180
|
", hour=" +
|
|
164
181
|
hour +
|
|
165
182
|
", minute=" +
|
|
@@ -180,6 +197,7 @@ public class DateMatch {
|
|
|
180
197
|
if (year != null ? !year.equals(dateMatch.year) : dateMatch.year != null) return false;
|
|
181
198
|
if (month != null ? !month.equals(dateMatch.month) : dateMatch.month != null) return false;
|
|
182
199
|
if (day != null ? !day.equals(dateMatch.day) : dateMatch.day != null) return false;
|
|
200
|
+
if (weekday != null ? !weekday.equals(dateMatch.weekday) : dateMatch.weekday != null) return false;
|
|
183
201
|
if (hour != null ? !hour.equals(dateMatch.hour) : dateMatch.hour != null) return false;
|
|
184
202
|
if (minute != null ? !minute.equals(dateMatch.minute) : dateMatch.minute != null) return false;
|
|
185
203
|
return second != null ? second.equals(dateMatch.second) : dateMatch.second == null;
|
|
@@ -190,6 +208,7 @@ public class DateMatch {
|
|
|
190
208
|
int result = year != null ? year.hashCode() : 0;
|
|
191
209
|
result = 31 * result + (month != null ? month.hashCode() : 0);
|
|
192
210
|
result = 31 * result + (day != null ? day.hashCode() : 0);
|
|
211
|
+
result = 31 * result + (weekday != null ? weekday.hashCode() : 0);
|
|
193
212
|
result = 31 * result + (hour != null ? hour.hashCode() : 0);
|
|
194
213
|
result = 31 * result + (minute != null ? minute.hashCode() : 0);
|
|
195
214
|
result = 31 + result + (second != null ? second.hashCode() : 0);
|
|
@@ -203,7 +222,21 @@ public class DateMatch {
|
|
|
203
222
|
*/
|
|
204
223
|
public String toMatchString() {
|
|
205
224
|
String matchString =
|
|
206
|
-
year +
|
|
225
|
+
year +
|
|
226
|
+
separator +
|
|
227
|
+
month +
|
|
228
|
+
separator +
|
|
229
|
+
day +
|
|
230
|
+
separator +
|
|
231
|
+
weekday +
|
|
232
|
+
separator +
|
|
233
|
+
hour +
|
|
234
|
+
separator +
|
|
235
|
+
minute +
|
|
236
|
+
separator +
|
|
237
|
+
second +
|
|
238
|
+
separator +
|
|
239
|
+
unit;
|
|
207
240
|
return matchString.replace("null", "*");
|
|
208
241
|
}
|
|
209
242
|
|
|
@@ -216,23 +249,25 @@ public class DateMatch {
|
|
|
216
249
|
public static DateMatch fromMatchString(String matchString) {
|
|
217
250
|
DateMatch date = new DateMatch();
|
|
218
251
|
String[] split = matchString.split(separator);
|
|
219
|
-
if (split != null && split.length ==
|
|
252
|
+
if (split != null && split.length == 7) {
|
|
220
253
|
date.setYear(getValueFromCronElement(split[0]));
|
|
221
254
|
date.setMonth(getValueFromCronElement(split[1]));
|
|
222
255
|
date.setDay(getValueFromCronElement(split[2]));
|
|
223
|
-
date.
|
|
224
|
-
date.
|
|
225
|
-
date.
|
|
256
|
+
date.setWeekday(getValueFromCronElement(split[3]));
|
|
257
|
+
date.setHour(getValueFromCronElement(split[4]));
|
|
258
|
+
date.setMinute(getValueFromCronElement(split[5]));
|
|
259
|
+
date.setUnit(getValueFromCronElement(split[6]));
|
|
226
260
|
}
|
|
227
261
|
|
|
228
|
-
if (split != null && split.length ==
|
|
262
|
+
if (split != null && split.length == 8) {
|
|
229
263
|
date.setYear(getValueFromCronElement(split[0]));
|
|
230
264
|
date.setMonth(getValueFromCronElement(split[1]));
|
|
231
265
|
date.setDay(getValueFromCronElement(split[2]));
|
|
232
|
-
date.
|
|
233
|
-
date.
|
|
234
|
-
date.
|
|
235
|
-
date.
|
|
266
|
+
date.setWeekday(getValueFromCronElement(split[3]));
|
|
267
|
+
date.setHour(getValueFromCronElement(split[4]));
|
|
268
|
+
date.setMinute(getValueFromCronElement(split[5]));
|
|
269
|
+
date.setSecond(getValueFromCronElement(split[6]));
|
|
270
|
+
date.setUnit(getValueFromCronElement(split[7]));
|
|
236
271
|
}
|
|
237
272
|
|
|
238
273
|
return date;
|