From 44a0f56b93818a83d9ee2fc2f85e3c9e72332db9 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Tue, 22 Apr 2025 11:00:53 -0700 Subject: [PATCH] add shuttleId as custom key in notification alert argument --- src/notifications/schedulers/ETANotificationScheduler.ts | 3 +++ src/notifications/senders/AppleNotificationSender.ts | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/notifications/schedulers/ETANotificationScheduler.ts b/src/notifications/schedulers/ETANotificationScheduler.ts index 97a2d4d..3eb57cb 100644 --- a/src/notifications/schedulers/ETANotificationScheduler.ts +++ b/src/notifications/schedulers/ETANotificationScheduler.ts @@ -45,6 +45,9 @@ export class ETANotificationScheduler { const notificationAlertArguments: NotificationAlertArguments = { title: "Shuttle is arriving", body: `Shuttle is approaching ${stop.name} in ${Math.ceil(eta.secondsRemaining / 60)} minutes.`, + customKeys: { + shuttleId, + }, } return this.appleNotificationSender.sendNotificationImmediately(deviceId, notificationAlertArguments); } diff --git a/src/notifications/senders/AppleNotificationSender.ts b/src/notifications/senders/AppleNotificationSender.ts index 8e5904a..012846f 100644 --- a/src/notifications/senders/AppleNotificationSender.ts +++ b/src/notifications/senders/AppleNotificationSender.ts @@ -10,6 +10,7 @@ interface APNsUrl { export interface NotificationAlertArguments { title: string; body: string; + customKeys?: any, } export class AppleNotificationSender { @@ -110,7 +111,8 @@ export class AppleNotificationSender { aps: { alert: notificationAlertArguments, sound: "default" - } + }, + ...notificationAlertArguments.customKeys, })); req.end(); });