integrate notification sender class into ETA notification scheduler

This commit is contained in:
2025-03-24 09:39:07 -07:00
parent 83766c90c5
commit 7f1bf005c1
2 changed files with 10 additions and 112 deletions

View File

@@ -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");