From 73a1997fbf8a6426f86b62b9158114ead944882b Mon Sep 17 00:00:00 2001 From: Florian Friedrich Date: Fri, 29 Jul 2022 20:44:10 +0200 Subject: [PATCH 1/3] Update notification object in index.d.ts This adds `targetContentIdentifier` and `interruptionLevel` to the `Aps` interface and `Notification` class. They are currently missing but are there in the JavaScript implementation. --- index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.d.ts b/index.d.ts index 331b8f2d..58da9834 100644 --- a/index.d.ts +++ b/index.d.ts @@ -97,6 +97,8 @@ interface Aps { "mutable-content"?: undefined | 1 "url-args"?: string[] category?: string + targetContentIdentifier?: string + interruptionLevel?: string } export interface ResponseSent { @@ -209,6 +211,8 @@ export class Notification { public collapseId: string; public pushType: NotificationPushType; public threadId: string; + public targetContentIdentifier?: string; + public interruptionLevel?: string; /** * This Object is JSON encoded and sent as the notification payload. When properties have been set on notification.aps (either directly or with convenience setters) these are added to the payload just before it is sent. If payload already contains an aps property it is replaced. From 28a41334853dd69a684bfe6fa2c0591a6ca4c189 Mon Sep 17 00:00:00 2001 From: Florian Friedrich Date: Fri, 29 Jul 2022 20:45:22 +0200 Subject: [PATCH 2/3] Update index.d.ts --- index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 58da9834..e0b590c2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -211,8 +211,8 @@ export class Notification { public collapseId: string; public pushType: NotificationPushType; public threadId: string; - public targetContentIdentifier?: string; - public interruptionLevel?: string; + public targetContentIdentifier: string; + public interruptionLevel: string; /** * This Object is JSON encoded and sent as the notification payload. When properties have been set on notification.aps (either directly or with convenience setters) these are added to the payload just before it is sent. If payload already contains an aps property it is replaced. From 3ad49c48bbfeef4774b4157c8a4a34429a86ab4e Mon Sep 17 00:00:00 2001 From: Florian Friedrich Date: Fri, 29 Jul 2022 20:52:08 +0200 Subject: [PATCH 3/3] Update index.d.ts --- index.d.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index e0b590c2..16422aa8 100644 --- a/index.d.ts +++ b/index.d.ts @@ -71,6 +71,8 @@ export interface MultiProviderOptions extends ProviderOptions { clientCount?: number } +export type ApsNotificationInterruptionLevel = 'passive' | 'active' | 'time-sensitive' | 'critical'; + interface ApsAlert { body?: string "loc-key"?: string @@ -98,7 +100,7 @@ interface Aps { "url-args"?: string[] category?: string targetContentIdentifier?: string - interruptionLevel?: string + interruptionLevel?: ApsNotificationInterruptionLevel } export interface ResponseSent { @@ -212,7 +214,7 @@ export class Notification { public pushType: NotificationPushType; public threadId: string; public targetContentIdentifier: string; - public interruptionLevel: string; + public interruptionLevel: ApsNotificationInterruptionLevel; /** * This Object is JSON encoded and sent as the notification payload. When properties have been set on notification.aps (either directly or with convenience setters) these are added to the payload just before it is sent. If payload already contains an aps property it is replaced. @@ -236,7 +238,7 @@ export class Notification { /** * The value to specify for `payload.aps.alert` can be either a `String` or an `Object` as outlined by the payload documentation. */ - public alert: string|NotificationAlertOptions; + public alert: string | NotificationAlertOptions; /** * Setting this to true will specify "content-available" in the payload when it is compiled. */