From 1cb498b1500599ef8dd1a1ec0a6df2243a06656c Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Tue, 22 Apr 2025 11:10:00 -0700 Subject: [PATCH] update custom keys to not be included in alert property --- src/notifications/senders/AppleNotificationSender.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/notifications/senders/AppleNotificationSender.ts b/src/notifications/senders/AppleNotificationSender.ts index 898bf05..2f458af 100644 --- a/src/notifications/senders/AppleNotificationSender.ts +++ b/src/notifications/senders/AppleNotificationSender.ts @@ -107,15 +107,21 @@ export class AppleNotificationSender { resolve(); }); + const customKeys = { + ...notificationAlertArguments.customKeys, + } + delete notificationAlertArguments.customKeys; + // See https://developer.apple.com/documentation/usernotifications/generating-a-remote-notification // for notification payload examples - req.write(JSON.stringify({ + const payload = JSON.stringify({ aps: { alert: notificationAlertArguments, sound: "default" }, - ...notificationAlertArguments.customKeys, - })); + customKeys, + }); + req.write(payload); req.end(); }); return true;