From f1b9fb6824537993cc3a2704e2088e1371b1e09c Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Wed, 19 Feb 2025 11:14:48 -0800 Subject: [PATCH] add a flag to control whether the notification service should actually send notifications --- src/services/NotificationService.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/NotificationService.ts b/src/services/NotificationService.ts index 573e2fb..bb15e46 100644 --- a/src/services/NotificationService.ts +++ b/src/services/NotificationService.ts @@ -27,7 +27,7 @@ export class NotificationService { return this._lastRefreshedTimeMs; } - constructor(private repository: GetterRepository) { + constructor(private repository: GetterRepository, private shouldActuallySendNotifications = true) { this.etaSubscriberCallback = this.etaSubscriberCallback.bind(this); this.reloadAPNsTokenIfTimePassed = this.reloadAPNsTokenIfTimePassed.bind(this); this.lastReloadedTimeForAPNsIsTooRecent = this.lastReloadedTimeForAPNsIsTooRecent.bind(this); @@ -81,6 +81,10 @@ export class NotificationService { } private async sendEtaNotificationImmediately(notificationData: ScheduledNotificationData): Promise { + if (!this.shouldActuallySendNotifications) { + return true; // pretend that the notification sent + } + const { deviceId, shuttleId, stopId } = notificationData; this.reloadAPNsTokenIfTimePassed();