diff --git a/lib/client/web.js b/lib/client/web.js index 32df7bd..96236b4 100644 --- a/lib/client/web.js +++ b/lib/client/web.js @@ -51,6 +51,7 @@ class WebPushHandle extends EventState { // Otherwise register '/firebase-messaging-sw.js' which includes the sw.js pushSupported = firebase.messaging.isSupported() + noConfiguration = !configuration.firebase || !configuration.publicVapidKey const swSupported = 'serviceWorker' in navigator const doTabsRefresh = () => { @@ -64,11 +65,11 @@ class WebPushHandle extends EventState { } if (swSupported && !isFacebookApp()) { - if (noConfiguration) { + if (noConfiguration || !pushSupported) { this.log('Firebase configuration is required: \'messagingSenderId\' and a \'PublicVapidKey\'') navigator.serviceWorker.register('/sw.js') .then(registration => { - // console.log('SW') + console.log('sw-basic') }) .catch(err => { console.log('ServiceWorker registration failed: ', err) @@ -77,7 +78,7 @@ class WebPushHandle extends EventState { return false } - if (pushSupported) { + if (!noConfiguration && pushSupported) { const webApp = firebase.initializeApp(configuration.firebase) deviceStorage.setItem('pushSupport', true) diff --git a/package.js b/package.js index aacbfc6..28d5e1a 100755 --- a/package.js +++ b/package.js @@ -1,14 +1,14 @@ /* globals Package, Npm, Cordova */ Package.describe({ name: 'activitree:push', - version: '2.0.6', + version: '2.0.7', summary: 'Push Notifications for Cordova and Web/PWA with Firebase (FCM).', git: 'https://github.com/activitree/meteor-push.git' }) Npm.depends({ 'firebase-admin': '8.12.1', - firebase: '7.14.5' + firebase: '7.15.0' }) Cordova.depends({