diff --git a/src/services/NotificationService.ts b/src/services/NotificationService.ts index 2d9651f..3ecaf58 100644 --- a/src/services/NotificationService.ts +++ b/src/services/NotificationService.ts @@ -56,6 +56,15 @@ export class NotificationService { return this._lastRefreshedTimeMs && Date.now() - this._lastRefreshedTimeMs < thirtyMinutesMs; } + private sendEtaNotificationImmediately({ deviceId, shuttleId, stopId }: ScheduledNotificationData) { + // Construct the fetch request + + // Send the fetch request + + // Check whether it was successful + // Return the result + } + /** * Queue a notification to be sent. * @param deviceId The device ID to send the notification to. @@ -63,7 +72,13 @@ export class NotificationService { * @param stopId Stop ID of ETA object to check. */ public async scheduleNotification({ deviceId, shuttleId, stopId }: ScheduledNotificationData) { + // Associate TupleKey(shuttleId, stopId) with array of device IDs + // Refresh the subscriber with the updated array if needed + // In the subscriber callback: + // If the ETA matches, call sendNotification with the necessary parameters + // If it was successful, unsubscribe the callback + // If it wasn't, leave it until the next ETA update } /**