mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add system id to the notification payload for good measure
This commit is contained in:
@@ -71,6 +71,7 @@ export class InterchangeSystem {
|
||||
shuttleRepository,
|
||||
notificationRepository,
|
||||
new AppleNotificationSender(),
|
||||
args.id,
|
||||
);
|
||||
notificationScheduler.startListeningForUpdates();
|
||||
|
||||
@@ -115,6 +116,7 @@ export class InterchangeSystem {
|
||||
shuttleRepository,
|
||||
notificationRepository,
|
||||
new AppleNotificationSender(false),
|
||||
args.id,
|
||||
);
|
||||
notificationScheduler.startListeningForUpdates();
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ export class ETANotificationScheduler {
|
||||
constructor(
|
||||
private shuttleRepository: ShuttleGetterRepository,
|
||||
private notificationRepository: NotificationRepository = new InMemoryNotificationRepository(),
|
||||
private appleNotificationSender = new AppleNotificationSender()
|
||||
private appleNotificationSender = new AppleNotificationSender(),
|
||||
private interchangeSystemId: string,
|
||||
) {
|
||||
this.etaSubscriberCallback = this.etaSubscriberCallback.bind(this);
|
||||
this.sendEtaNotificationImmediately = this.sendEtaNotificationImmediately.bind(this);
|
||||
@@ -47,6 +48,7 @@ export class ETANotificationScheduler {
|
||||
body: `Shuttle is approaching ${stop.name} in ${Math.ceil(eta.secondsRemaining / 60)} minutes.`,
|
||||
customKeys: {
|
||||
shuttleId,
|
||||
systemId: this.interchangeSystemId,
|
||||
},
|
||||
}
|
||||
return this.appleNotificationSender.sendNotificationImmediately(deviceId, notificationAlertArguments);
|
||||
|
||||
@@ -40,7 +40,8 @@ describe("ETANotificationScheduler", () => {
|
||||
notificationService = new ETANotificationScheduler(
|
||||
shuttleRepository,
|
||||
notificationRepository,
|
||||
appleNotificationSender
|
||||
appleNotificationSender,
|
||||
"1",
|
||||
);
|
||||
notificationService.startListeningForUpdates();
|
||||
});
|
||||
@@ -127,7 +128,8 @@ describe("ETANotificationScheduler", () => {
|
||||
notificationService = new ETANotificationScheduler(
|
||||
shuttleRepository,
|
||||
notificationRepository,
|
||||
updatedNotificationSender
|
||||
updatedNotificationSender,
|
||||
"1",
|
||||
);
|
||||
notificationService.startListeningForUpdates();
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
AppleNotificationSender,
|
||||
NotificationAlertArguments
|
||||
} from "../../../src/notifications/senders/AppleNotificationSender";
|
||||
import { ETANotificationScheduler } from "../../../src/notifications/schedulers/ETANotificationScheduler";
|
||||
|
||||
jest.mock("http2");
|
||||
|
||||
@@ -13,7 +12,7 @@ const sampleKeyBase64 = "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JR1RBZ0VBTUJNR0J
|
||||
|
||||
function mockHttp2Connect(status: number) {
|
||||
class MockClient extends EventEmitter {
|
||||
request = jest.fn((headers: any) => {
|
||||
request = jest.fn((_) => {
|
||||
const mockRequest: any = new EventEmitter();
|
||||
mockRequest.setEncoding = jest.fn();
|
||||
mockRequest.write = jest.fn();
|
||||
|
||||
Reference in New Issue
Block a user