mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
integrate notification sender class into ETA notification scheduler
This commit is contained in:
@@ -7,12 +7,12 @@ interface APNsUrl {
|
||||
host: string;
|
||||
}
|
||||
|
||||
interface NotificationAlertArguments {
|
||||
export interface NotificationAlertArguments {
|
||||
title: string;
|
||||
body: string;
|
||||
}
|
||||
|
||||
class AppleNotificationSender {
|
||||
export class AppleNotificationSender {
|
||||
private apnsToken: string | undefined = undefined;
|
||||
private _lastRefreshedTimeMs: number | undefined = undefined;
|
||||
|
||||
@@ -60,6 +60,8 @@ class AppleNotificationSender {
|
||||
* notification was sent successfully.
|
||||
*/
|
||||
public async sendNotificationImmediately(deviceId: string, notificationAlertArguments: NotificationAlertArguments) {
|
||||
this.reloadAPNsTokenIfTimePassed();
|
||||
|
||||
const bundleId = process.env.APNS_BUNDLE_ID;
|
||||
if (typeof bundleId !== "string") {
|
||||
throw new Error("APNS_BUNDLE_ID environment variable is not set correctly");
|
||||
|
||||
Reference in New Issue
Block a user