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();