diff --git a/functions/src/dates/onDateHistoryCreated.ts b/functions/src/dates/onDateHistoryCreated.ts index 0c9af9b6..43ec9809 100644 --- a/functions/src/dates/onDateHistoryCreated.ts +++ b/functions/src/dates/onDateHistoryCreated.ts @@ -1,6 +1,7 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' import { recipientInQuietHours } from '../notifications/quietHours' +import { pruneDeadTokens } from '../notifications/pruneTokens' /** * Fires when a date is logged as completed (`couples/{coupleId}/date_history/{dateId}` created). Nudges @@ -58,4 +59,5 @@ export const onDateHistoryCreated = functions.firestore results.forEach((r, i) => { if (r.status === 'rejected') console.warn(`[onDateHistoryCreated] FCM failed for ${tokens[i]}:`, r.reason) }) + await pruneDeadTokens(db, partnerId, tokens, results) })