@capacitor/local-notifications 1.0.10 → 4.0.0-beta.2

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/CapacitorLocalNotifications.podspec +1 -1
  3. package/README.md +126 -30
  4. package/android/build.gradle +10 -11
  5. package/android/src/main/java/com/capacitorjs/plugins/localnotifications/DateMatch.java +45 -10
  6. package/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationManager.java +48 -32
  7. package/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationRestoreReceiver.java +2 -1
  8. package/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationSchedule.java +3 -1
  9. package/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationsPlugin.java +79 -0
  10. package/android/src/main/java/com/capacitorjs/plugins/localnotifications/NotificationChannelManager.java +2 -6
  11. package/android/src/main/java/com/capacitorjs/plugins/localnotifications/TimedNotificationPublisher.java +6 -1
  12. package/android/src/main/res/drawable/ic_transparent.xml +12 -0
  13. package/dist/docs.json +305 -23
  14. package/dist/esm/definitions.d.ts +141 -4
  15. package/dist/esm/definitions.js +13 -1
  16. package/dist/esm/definitions.js.map +1 -1
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/web.d.ts +5 -1
  19. package/dist/esm/web.js +33 -0
  20. package/dist/esm/web.js.map +1 -1
  21. package/dist/plugin.cjs.js +48 -0
  22. package/dist/plugin.cjs.js.map +1 -1
  23. package/dist/plugin.js +48 -0
  24. package/dist/plugin.js.map +1 -1
  25. package/ios/Plugin/LocalNotificationsPlugin.m +4 -1
  26. package/ios/Plugin/LocalNotificationsPlugin.swift +43 -1
  27. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -3,6 +3,83 @@
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.2](https://github.com/ionic-team/capacitor-plugins/compare/4.0.0-beta.0...4.0.0-beta.2) (2022-07-08)
7
+
8
+
9
+ ### Features
10
+
11
+ * **local-notifications:** Add delivered notification handling ([#1060](https://github.com/ionic-team/capacitor-plugins/issues/1060)) ([0a89dc9](https://github.com/ionic-team/capacitor-plugins/commit/0a89dc97407685a7f1ec97532af304115fea7a0f))
12
+
13
+
14
+
15
+
16
+
17
+ # 4.0.0-beta.0 (2022-06-27)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **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))
23
+ * **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))
24
+ * correct addListeners links ([#655](https://github.com/ionic-team/capacitor-plugins/issues/655)) ([f9871e7](https://github.com/ionic-team/capacitor-plugins/commit/f9871e7bd53478addb21155e148829f550c0e457))
25
+ * 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))
26
+ * 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))
27
+ * remove postpublish scripts ([#656](https://github.com/ionic-team/capacitor-plugins/issues/656)) ([ed6ac49](https://github.com/ionic-team/capacitor-plugins/commit/ed6ac499ebf4a47525071ccbfc36c27503e11f60))
28
+ * **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))
29
+ * **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))
30
+ * **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))
31
+ * **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))
32
+ * **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))
33
+ * **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))
34
+ * **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))
35
+ * **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))
36
+ * **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))
37
+ * **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))
38
+ * **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))
39
+ * **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))
40
+ * 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))
41
+ * **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))
42
+ * 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))
43
+ * 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))
44
+
45
+
46
+ ### Features
47
+
48
+ * 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))
49
+ * 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))
50
+ * 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))
51
+ * Use java 11 ([#910](https://github.com/ionic-team/capacitor-plugins/issues/910)) ([5acb2a2](https://github.com/ionic-team/capacitor-plugins/commit/5acb2a288a413492b163e4e97da46a085d9e4be0))
52
+ * **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))
53
+ * **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))
54
+ * **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))
55
+ * **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))
56
+ * **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))
57
+ * **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))
58
+ * **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))
59
+ * **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))
60
+ * add commonjs output format ([#179](https://github.com/ionic-team/capacitor-plugins/issues/179)) ([8e9e098](https://github.com/ionic-team/capacitor-plugins/commit/8e9e09862064b3f6771d7facbc4008e995d9b463))
61
+ * Local Notifications plugin ([#94](https://github.com/ionic-team/capacitor-plugins/issues/94)) ([e59ba9c](https://github.com/ionic-team/capacitor-plugins/commit/e59ba9ceea78a26ec60e521825f228baa9d74577))
62
+
63
+
64
+
65
+
66
+
67
+ # [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)
68
+
69
+
70
+ ### Bug Fixes
71
+
72
+ * 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))
73
+
74
+
75
+ ### Features
76
+
77
+ * **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))
78
+
79
+
80
+
81
+
82
+
6
83
  ## [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)
7
84
 
8
85
  **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 = '12.0'
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>
@@ -73,6 +83,9 @@ If the device has entered [Doze](https://developer.android.com/training/monitori
73
83
  * [`registerActionTypes(...)`](#registeractiontypes)
74
84
  * [`cancel(...)`](#cancel)
75
85
  * [`areEnabled()`](#areenabled)
86
+ * [`getDeliveredNotifications()`](#getdeliverednotifications)
87
+ * [`removeDeliveredNotifications(...)`](#removedeliverednotifications)
88
+ * [`removeAllDeliveredNotifications()`](#removealldeliverednotifications)
76
89
  * [`createChannel(...)`](#createchannel)
77
90
  * [`deleteChannel(...)`](#deletechannel)
78
91
  * [`listChannels()`](#listchannels)
@@ -83,6 +96,7 @@ If the device has entered [Doze](https://developer.android.com/training/monitori
83
96
  * [`removeAllListeners()`](#removealllisteners)
84
97
  * [Interfaces](#interfaces)
85
98
  * [Type Aliases](#type-aliases)
99
+ * [Enums](#enums)
86
100
 
87
101
  </docgen-index>
88
102
 
@@ -174,10 +188,55 @@ Check if notifications are enabled or not.
174
188
  --------------------
175
189
 
176
190
 
191
+ ### getDeliveredNotifications()
192
+
193
+ ```typescript
194
+ getDeliveredNotifications() => Promise<DeliveredNotifications>
195
+ ```
196
+
197
+ Get a list of notifications that are visible on the notifications screen.
198
+
199
+ **Returns:** <code>Promise&lt;<a href="#deliverednotifications">DeliveredNotifications</a>&gt;</code>
200
+
201
+ **Since:** 4.0.0
202
+
203
+ --------------------
204
+
205
+
206
+ ### removeDeliveredNotifications(...)
207
+
208
+ ```typescript
209
+ removeDeliveredNotifications(delivered: DeliveredNotifications) => Promise<void>
210
+ ```
211
+
212
+ Remove the specified notifications from the notifications screen.
213
+
214
+ | Param | Type |
215
+ | --------------- | ------------------------------------------------------------------------- |
216
+ | **`delivered`** | <code><a href="#deliverednotifications">DeliveredNotifications</a></code> |
217
+
218
+ **Since:** 4.0.0
219
+
220
+ --------------------
221
+
222
+
223
+ ### removeAllDeliveredNotifications()
224
+
225
+ ```typescript
226
+ removeAllDeliveredNotifications() => Promise<void>
227
+ ```
228
+
229
+ Remove all the notifications from the notifications screen.
230
+
231
+ **Since:** 4.0.0
232
+
233
+ --------------------
234
+
235
+
177
236
  ### createChannel(...)
178
237
 
179
238
  ```typescript
180
- createChannel(channel: NotificationChannel) => Promise<void>
239
+ createChannel(channel: Channel) => Promise<void>
181
240
  ```
182
241
 
183
242
  Create a notification channel.
@@ -196,16 +255,16 @@ Only available for Android.
196
255
  ### deleteChannel(...)
197
256
 
198
257
  ```typescript
199
- deleteChannel(channel: NotificationChannel) => Promise<void>
258
+ deleteChannel(args: { id: string; }) => Promise<void>
200
259
  ```
201
260
 
202
261
  Delete a notification channel.
203
262
 
204
263
  Only available for Android.
205
264
 
206
- | Param | Type |
207
- | ------------- | ------------------------------------------- |
208
- | **`channel`** | <code><a href="#channel">Channel</a></code> |
265
+ | Param | Type |
266
+ | ---------- | ---------------------------- |
267
+ | **`args`** | <code>{ id: string; }</code> |
209
268
 
210
269
  **Since:** 1.0.0
211
270
 
@@ -356,7 +415,7 @@ The object that describes a local notification.
356
415
  | **`actionTypeId`** | <code>string</code> | Associate an action type with this notification. | 1.0.0 |
357
416
  | **`extra`** | <code>any</code> | Set extra data to store within this notification. | 1.0.0 |
358
417
  | **`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 |
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+. | 1.0.0 |
418
+ | **`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. | 1.0.0 |
360
419
  | **`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 |
361
420
  | **`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 |
362
421
  | **`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 |
@@ -434,14 +493,15 @@ Enables basic storage and retrieval of dates and times.
434
493
 
435
494
  #### ScheduleOn
436
495
 
437
- | Prop | Type |
438
- | ------------ | ------------------- |
439
- | **`year`** | <code>number</code> |
440
- | **`month`** | <code>number</code> |
441
- | **`day`** | <code>number</code> |
442
- | **`hour`** | <code>number</code> |
443
- | **`minute`** | <code>number</code> |
444
- | **`second`** | <code>number</code> |
496
+ | Prop | Type |
497
+ | ------------- | ------------------------------------------- |
498
+ | **`year`** | <code>number</code> |
499
+ | **`month`** | <code>number</code> |
500
+ | **`day`** | <code>number</code> |
501
+ | **`weekday`** | <code><a href="#weekday">Weekday</a></code> |
502
+ | **`hour`** | <code>number</code> |
503
+ | **`minute`** | <code>number</code> |
504
+ | **`second`** | <code>number</code> |
445
505
 
446
506
 
447
507
  #### Attachment
@@ -535,19 +595,44 @@ An action that can be taken when a notification is displayed.
535
595
  | **`value`** | <code>boolean</code> | Whether or not the device has local notifications enabled. | 1.0.0 |
536
596
 
537
597
 
598
+ #### DeliveredNotifications
599
+
600
+ | Prop | Type | Description | Since |
601
+ | ------------------- | ------------------------------------------ | ------------------------------------------------------------------- | ----- |
602
+ | **`notifications`** | <code>DeliveredNotificationSchema[]</code> | List of notifications that are visible on the notifications screen. | 1.0.0 |
603
+
604
+
605
+ #### DeliveredNotificationSchema
606
+
607
+ | Prop | Type | Description | Since |
608
+ | ------------------ | --------------------------------------------- | ---------------------------------------------------------------------------------------------- | ----- |
609
+ | **`id`** | <code>number</code> | The notification identifier. | 4.0.0 |
610
+ | **`tag`** | <code>string</code> | The notification tag. Only available on Android. | 4.0.0 |
611
+ | **`title`** | <code>string</code> | The title of the notification. | 4.0.0 |
612
+ | **`body`** | <code>string</code> | The body of the notification, shown below the title. | 4.0.0 |
613
+ | **`group`** | <code>string</code> | The configured group of the notification. Only available for Android. | 4.0.0 |
614
+ | **`groupSummary`** | <code>boolean</code> | If this notification is the summary for a group of notifications. Only available for Android. | 4.0.0 |
615
+ | **`data`** | <code>any</code> | Any additional data that was included in the notification payload. Only available for Android. | 4.0.0 |
616
+ | **`extra`** | <code>any</code> | Extra data to store within this notification. Only available for iOS. | 4.0.0 |
617
+ | **`attachments`** | <code>Attachment[]</code> | The attachments for this notification. Only available for iOS. | 1.0.0 |
618
+ | **`actionTypeId`** | <code>string</code> | <a href="#action">Action</a> type ssociated with this notification. Only available for iOS. | 4.0.0 |
619
+ | **`schedule`** | <code><a href="#schedule">Schedule</a></code> | <a href="#schedule">Schedule</a> used to fire this notification. Only available for iOS. | 4.0.0 |
620
+ | **`sound`** | <code>string</code> | Sound that was used when the notification was displayed. Only available for iOS. | 4.0.0 |
621
+
622
+
538
623
  #### Channel
539
624
 
540
- | Prop | Type | Description | Since |
541
- | ----------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
542
- | **`id`** | <code>string</code> | The channel identifier. | 1.0.0 |
543
- | **`name`** | <code>string</code> | The human-friendly name of this channel (presented to the user). | 1.0.0 |
544
- | **`description`** | <code>string</code> | The description of this channel (presented to the user). | 1.0.0 |
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. If the sound is not provided, or the sound file is not found no sound will be used. | 1.0.0 |
546
- | **`importance`** | <code><a href="#importance">Importance</a></code> | The level of interruption for notifications posted to this channel. | 1.0.0 |
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. | 1.0.0 |
548
- | **`lights`** | <code>boolean</code> | Whether notifications posted to this channel should display notification lights, on devices that support it. | 1.0.0 |
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`. | 1.0.0 |
550
- | **`vibration`** | <code>boolean</code> | Whether notifications posted to this channel should vibrate. | 1.0.0 |
625
+ | Prop | Type | Description | Default | Since |
626
+ | ----------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ----- |
627
+ | **`id`** | <code>string</code> | The channel identifier. | | 1.0.0 |
628
+ | **`name`** | <code>string</code> | The human-friendly name of this channel (presented to the user). | | 1.0.0 |
629
+ | **`description`** | <code>string</code> | The description of this channel (presented to the user). | | 1.0.0 |
630
+ | **`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 |
631
+ | **`importance`** | <code><a href="#importance">Importance</a></code> | The level of interruption for notifications posted to this channel. | <code>`3`</code> | 1.0.0 |
632
+ | **`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 |
633
+ | **`lights`** | <code>boolean</code> | Whether notifications posted to this channel should display notification lights, on devices that support it. | | 1.0.0 |
634
+ | **`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 |
635
+ | **`vibration`** | <code>boolean</code> | Whether notifications posted to this channel should vibrate. | | 1.0.0 |
551
636
 
552
637
 
553
638
  #### ListChannelsResult
@@ -588,11 +673,6 @@ An action that can be taken when a notification is displayed.
588
673
  <code>'year' | 'month' | 'two-weeks' | 'week' | 'day' | 'hour' | 'minute' | 'second'</code>
589
674
 
590
675
 
591
- #### NotificationChannel
592
-
593
- <code><a href="#channel">Channel</a></code>
594
-
595
-
596
676
  #### Importance
597
677
 
598
678
  The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)
@@ -611,4 +691,20 @@ The notification visibility. For more details, see the [Android Developer Docs](
611
691
 
612
692
  <code>'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'</code>
613
693
 
694
+
695
+ ### Enums
696
+
697
+
698
+ #### Weekday
699
+
700
+ | Members | Value |
701
+ | --------------- | -------------- |
702
+ | **`Sunday`** | <code>1</code> |
703
+ | **`Monday`** | <code>2</code> |
704
+ | **`Tuesday`** | <code>3</code> |
705
+ | **`Wednesday`** | <code>4</code> |
706
+ | **`Thursday`** | <code>5</code> |
707
+ | **`Friday`** | <code>6</code> |
708
+ | **`Saturday`** | <code>7</code> |
709
+
614
710
  </docgen-api>
@@ -1,8 +1,8 @@
1
1
  ext {
2
- junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2.0'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.2'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.3.0'
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:4.2.1'
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 : 29
21
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
22
  defaultConfig {
23
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
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.VERSION_1_8
40
- targetCompatibility JavaVersion.VERSION_1_8
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 + separator + month + separator + day + separator + hour + separator + minute + separator + second + separator + unit;
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 == 6) {
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.setHour(getValueFromCronElement(split[3]));
224
- date.setMinute(getValueFromCronElement(split[4]));
225
- date.setUnit(getValueFromCronElement(split[5]));
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 == 7) {
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.setHour(getValueFromCronElement(split[3]));
233
- date.setMinute(getValueFromCronElement(split[4]));
234
- date.setSecond(getValueFromCronElement(split[5]));
235
- date.setUnit(getValueFromCronElement(split[6]));
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;