Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | const firebaseConfig = function() { return { apiKey: process.env.FIREBASE_API_KEY, authDomain: process.env.FIREBASE_AUTH_DOMAIN, databaseURL: process.env.FIREBASE_DATABASE_URL, projectId: process.env.FIREBASE_PROJECT_ID, storageBucket: process.env.FIREBASE_STORAGE_BUCKET, messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID, appId: process.env.FIREBASE_APP_ID }; }; import firebase, { app } from "firebase/app"; import "firebase/auth"; import "firebase/firestore"; import "firebase/messaging"; import "firebase/storage"; import { Platform } from "quasar"; export default async ({ Vue, store }) => { // console("Initialize firebase"); // console.log('firebaseConfig'); // console.log(firebaseConfig()); Vue.prototype.$firebaseConfig = firebaseConfig(); firebase.initializeApp(firebaseConfig()); Vue.prototype.$firebase = firebase; const db = firebase.firestore(); Vue.prototype.$db = db; const messaging = firebase.messaging(); Vue.prototype.$messaging = messaging; // if (!Platform.is.ios) // db.enablePersistence({ // synchronizeTabs: true // }).catch(function (err) { // if (err.code == "failed-precondition") { // // Multiple tabs open, persistence can only be enabled // // in one tab at a a time. // // ... // // console.log("persistence disabled: multiple tabs open"); // } else if (err.code == "unimplemented") { // // The current browser does not support all of the // // features required to enable persistence // // ... // // console.log("persistence disabled: not available"); // } // }); if (navigator.serviceWorker) { navigator.serviceWorker .register("/statics/firebase-messaging-sw.js") .then(registration => { Vue.prototype.$messaging.useServiceWorker(registration); }) .catch(err => { console.log(err); }); } messaging.onMessage(payload => { console.log("received payload", payload); store.dispatch("messaging/addNotification", payload); }); }; |