From 2d57e5949c2b8c60498ccaff679356a4a00eb2e5 Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 7 Apr 2026 22:06:46 +0100 Subject: [PATCH] chore: delete unused firebase-admin.ts No imports found anywhere in the codebase. Dead code left over from before expo-server-sdk migration. Co-Authored-By: Claude Sonnet 4.6 --- apps/web/src/lib/firebase-admin.ts | 72 ------------------------------ 1 file changed, 72 deletions(-) delete mode 100644 apps/web/src/lib/firebase-admin.ts diff --git a/apps/web/src/lib/firebase-admin.ts b/apps/web/src/lib/firebase-admin.ts deleted file mode 100644 index 7942a141b90..00000000000 --- a/apps/web/src/lib/firebase-admin.ts +++ /dev/null @@ -1,72 +0,0 @@ -import * as admin from 'firebase-admin'; - -if (!admin.apps.length) { - try { - const serviceAccount = JSON.parse( - process.env.FIREBASE_SERVICE_ACCOUNT || '{}' - ); - - if (serviceAccount.project_id) { - admin.initializeApp({ - credential: admin.credential.cert(serviceAccount), - }); - console.log('✅ Firebase Admin initialized'); - } else { - console.warn('⚠️ FIREBASE_SERVICE_ACCOUNT not configured correctly'); - } - } catch (error) { - console.error('❌ Firebase Admin init error:', error); - } -} - -export const messaging = admin.messaging(); - -/** - * Send a direct FCM notification (Elite 2025 Best Practice) - */ -export async function sendFCMNotification( - token: string, - title: string, - body: string, - data?: Record, - priority: 'high' | 'normal' = 'high' -) { - try { - const response = await messaging.send({ - token, - notification: { - title, - body, - }, - data: data || {}, - android: { - priority, - notification: { - sound: 'default', - channelId: 'orders', - }, - }, - apns: { - payload: { - aps: { - sound: 'default', - badge: 1, - 'mutable-content': 1, - }, - }, - }, - }); - return { success: true, messageId: response }; - } catch (error: unknown) { - const errorCode = (error as { code?: string })?.code; - const isUnregistered = - errorCode === 'messaging/registration-token-not-registered' || - errorCode === 'messaging/invalid-registration-token'; - - return { - success: false, - error: error instanceof Error ? error.message : 'Unknown error', - isUnregistered, - }; - } -}