diff --git a/public/firebase-messaging-sw.js b/public/firebase-messaging-sw.js index bccd5cb0..ee9fce8c 100644 --- a/public/firebase-messaging-sw.js +++ b/public/firebase-messaging-sw.js @@ -4,7 +4,17 @@ try { importScripts( "https://www.gstatic.com/firebasejs/9.0.0/firebase-messaging-compat.js" ); - // firebase.initializeApp(firebaseConfigObject); + var firebaseConfigObject = { + apiKey: "API_KEY", + authDomain: "PROJECT_ID.firebaseapp.com", + databaseURL: "https://DATABASE_NAME.firebaseio.com", + projectId: "PROJECT_ID", + storageBucket: "PROJECT_ID.appspot.com", + messagingSenderId: "SENDER_ID", + appId: "APP_ID", + measurementId: "G-MEASUREMENT_ID", + }; + firebase.initializeApp(firebaseConfigObject); } catch (e) { importScripts("/__/firebase/7.15.0/firebase-app.js"); importScripts("/__/firebase/7.15.0/firebase-messaging.js"); @@ -29,7 +39,7 @@ if (firebase.messaging.isSupported()) { image: payload.notification.image }; - const promiseChain = clients + const promiseChain = self.clients .matchAll({ type: "window", includeUncontrolled: true @@ -41,7 +51,7 @@ if (firebase.messaging.isSupported()) { } }) .then(() => { - return registration.showNotification( + return self.registration.showNotification( notificationTitle, notificationOptions );