use updated getAPNs... method

This commit is contained in:
2025-02-10 13:34:48 -08:00
parent 5e186c643c
commit a880d71c87

View File

@@ -82,7 +82,6 @@ export class NotificationService {
private async sendEtaNotificationImmediately(notificationData: ScheduledNotificationData): Promise<boolean> {
const { deviceId, shuttleId, stopId } = notificationData;
this.reloadAPNsTokenIfTimePassed();
const url = NotificationService.getAPNsFullUrlToUse(deviceId);
const shuttle = await this.repository.getShuttleById(shuttleId);
const stop = await this.repository.getStopById(stopId);
@@ -109,9 +108,11 @@ export class NotificationService {
throw new Error("APNS_BUNDLE_ID environment variable is not set correctly");
}
const { path, host } = NotificationService.getAPNsFullUrlToUse(deviceId);
const headers = {
':method': 'POST',
':path': `/3/device/${deviceId}`,
':path': path,
'authorization': `bearer ${this.apnsToken}`,
"apns-push-type": "alert",
"apns-expiration": "0",
@@ -119,7 +120,7 @@ export class NotificationService {
"apns-topic": bundleId,
};
try {
const client = http2.connect('https://api.development.push.apple.com');
const client = http2.connect(host);
const req = client.request(headers);
req.setEncoding('utf8');