mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
use updated getAPNs... method
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user