From cb71a7ea3a3787f44a06cd1155fe51505452cb1d Mon Sep 17 00:00:00 2001 From: Marc Rejohn Castillano Date: Tue, 24 Feb 2026 23:28:18 +0800 Subject: [PATCH] Web Firebase setup --- web/firebase-messaging-sw.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 web/firebase-messaging-sw.js diff --git a/web/firebase-messaging-sw.js b/web/firebase-messaging-sw.js new file mode 100644 index 00000000..268e16a5 --- /dev/null +++ b/web/firebase-messaging-sw.js @@ -0,0 +1,27 @@ +importScripts('https://www.gstatic.com/firebasejs/9.22.2/firebase-app-compat.js'); +importScripts('https://www.gstatic.com/firebasejs/9.22.2/firebase-messaging-compat.js'); + +// This file must be served with "Content-Type: application/javascript" and +// placed at the root of the `web/` build output. Flutter web does not copy it +// automatically, so ensure you add a manual copy step to your build script or +// include it in `web/` before building. + +firebase.initializeApp({ + // values must match `firebase_options.dart` generated by `flutterfire` + apiKey: 'AIzaSyBKGSaHYiqpZvbEgsvJJY45soiIkV6MV3M', + appId: '1:173359574734:web:f894a6b43a443e902baa9f', + messagingSenderId: '173359574734', + projectId: 'tasq-17fb3', + authDomain: 'tasq-17fb3.firebaseapp.com', + storageBucket: 'tasq-17fb3.firebasestorage.app', +}); + +const messaging = firebase.messaging(); + +messaging.onBackgroundMessage(function(payload) { + // display a notification using data in the payload + self.registration.showNotification(payload.notification.title, { + body: payload.notification.body, + data: payload.data, + }); +});