mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
add a flag to control whether the notification service should actually send notifications
This commit is contained in:
@@ -27,7 +27,7 @@ export class NotificationService {
|
|||||||
return this._lastRefreshedTimeMs;
|
return this._lastRefreshedTimeMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private repository: GetterRepository) {
|
constructor(private repository: GetterRepository, private shouldActuallySendNotifications = true) {
|
||||||
this.etaSubscriberCallback = this.etaSubscriberCallback.bind(this);
|
this.etaSubscriberCallback = this.etaSubscriberCallback.bind(this);
|
||||||
this.reloadAPNsTokenIfTimePassed = this.reloadAPNsTokenIfTimePassed.bind(this);
|
this.reloadAPNsTokenIfTimePassed = this.reloadAPNsTokenIfTimePassed.bind(this);
|
||||||
this.lastReloadedTimeForAPNsIsTooRecent = this.lastReloadedTimeForAPNsIsTooRecent.bind(this);
|
this.lastReloadedTimeForAPNsIsTooRecent = this.lastReloadedTimeForAPNsIsTooRecent.bind(this);
|
||||||
@@ -81,6 +81,10 @@ export class NotificationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async sendEtaNotificationImmediately(notificationData: ScheduledNotificationData): Promise<boolean> {
|
private async sendEtaNotificationImmediately(notificationData: ScheduledNotificationData): Promise<boolean> {
|
||||||
|
if (!this.shouldActuallySendNotifications) {
|
||||||
|
return true; // pretend that the notification sent
|
||||||
|
}
|
||||||
|
|
||||||
const { deviceId, shuttleId, stopId } = notificationData;
|
const { deviceId, shuttleId, stopId } = notificationData;
|
||||||
this.reloadAPNsTokenIfTimePassed();
|
this.reloadAPNsTokenIfTimePassed();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user