Skip to content

Commit 313ef5d

Browse files
feat(local-notifications): deprecate summaryArgument and add relevanceScore and interruptionLevel
1 parent 990987f commit 313ef5d

3 files changed

Lines changed: 20 additions & 22 deletions

File tree

local-notifications/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,8 @@ The object that describes a local notification.
470470
| **`extra`** | <code>any</code> | Set extra data to store within this notification. | 1.0.0 |
471471
| **`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 |
472472
| **`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 |
473-
| **`relevanceScore`** | <code>number</code> | The score the system uses to determine if the notification is the featured notification when the system groups the app's notifications. The value must be between 0 and 1, where 0 is the least relevant and 1 is the most relevant. The default value is 0. Sets `relevanceScore` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS 15+. | 8.1.0 |
474-
| **`interruptionLevel`** | <code><a href="#interruptionlevel">InterruptionLevel</a></code> | The interruption level that indicates the priority and delivery timing of a notification. Sets `interruptionLevel` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS 15+. | 8.1.0 |
473+
| **`relevanceScore`** | <code>number</code> | The score the system uses to determine if the notification is the featured notification when the system groups the app's notifications. The value must be between 0 and 1, where 0 is the least relevant and 1 is the most relevant. The default value is 0. Sets `relevanceScore` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS. | 8.1.0 |
474+
| **`interruptionLevel`** | <code><a href="#interruptionlevel">InterruptionLevel</a></code> | The interruption level that indicates the priority and delivery timing of a notification. Sets `interruptionLevel` on the [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent). Only available for iOS. | 8.1.0 |
475475
| **`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 |
476476
| **`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 |
477477
| **`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 8+. | 1.0.0 |

local-notifications/ios/Sources/LocalNotificationsPlugin/LocalNotificationsPlugin.swift

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -261,24 +261,22 @@ public class LocalNotificationsPlugin: CAPPlugin, CAPBridgedPlugin {
261261
}
262262
}
263263

264-
if #available(iOS 15.0, *) {
265-
if let relevanceScore = notification["relevanceScore"] as? Double {
266-
content.relevanceScore = relevanceScore
267-
}
268-
269-
if let interruptionLevelString = notification["interruptionLevel"] as? String {
270-
switch interruptionLevelString {
271-
case "active":
272-
content.interruptionLevel = .active
273-
case "critical":
274-
content.interruptionLevel = .critical
275-
case "passive":
276-
content.interruptionLevel = .passive
277-
case "timeSensitive":
278-
content.interruptionLevel = .timeSensitive
279-
default:
280-
break
281-
}
264+
if let relevanceScore = notification["relevanceScore"] as? Double {
265+
content.relevanceScore = relevanceScore
266+
}
267+
268+
if let interruptionLevelString = notification["interruptionLevel"] as? String {
269+
switch interruptionLevelString {
270+
case "active":
271+
content.interruptionLevel = .active
272+
case "critical":
273+
content.interruptionLevel = .critical
274+
case "passive":
275+
content.interruptionLevel = .passive
276+
case "timeSensitive":
277+
content.interruptionLevel = .timeSensitive
278+
default:
279+
break
282280
}
283281
}
284282

local-notifications/src/definitions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ export interface LocalNotificationSchema {
694694
* Sets `relevanceScore` on the
695695
* [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent).
696696
*
697-
* Only available for iOS 15+.
697+
* Only available for iOS.
698698
*
699699
* @since 8.1.0
700700
*/
@@ -706,7 +706,7 @@ export interface LocalNotificationSchema {
706706
* Sets `interruptionLevel` on the
707707
* [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent).
708708
*
709-
* Only available for iOS 15+.
709+
* Only available for iOS.
710710
*
711711
* @since 8.1.0
712712
*/

0 commit comments

Comments
 (0)