web-manager 3.0.1 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +14 -3
- package/package.json +1 -1
package/index.js
CHANGED
@@ -615,6 +615,9 @@ function Manager() {
|
|
615
615
|
This.properties.global.brand.name = configuration.global.brand.name;
|
616
616
|
This.properties.meta.environment = utilities.get(configuration, 'global.settings.debug.environment', This.properties.meta.environment);
|
617
617
|
|
618
|
+
// This.properties.global.cacheBreaker = This.properties.meta.environment === 'development'
|
619
|
+
// ? new Date().getTime()
|
620
|
+
// : This.properties.global.cacheBreaker;
|
618
621
|
// This.log('Config: ', options_user);
|
619
622
|
|
620
623
|
// parse query stringify
|
@@ -1082,7 +1085,8 @@ function Manager() {
|
|
1082
1085
|
dateSubscribed: {
|
1083
1086
|
timestamp: timestamp,
|
1084
1087
|
timestampUNIX: timestampUNIX
|
1085
|
-
}
|
1088
|
+
},
|
1089
|
+
url: window.location.href,
|
1086
1090
|
},
|
1087
1091
|
token: token,
|
1088
1092
|
link: {
|
@@ -1161,9 +1165,10 @@ function Manager() {
|
|
1161
1165
|
if (!('serviceWorker' in navigator) || !(typeof firebase.messaging !== 'undefined')) {return}
|
1162
1166
|
|
1163
1167
|
// service worker guide: https://developers.google.com/web/updates/2018/06/fresher-sw
|
1164
|
-
navigator.serviceWorker.register('/' + (options_user.serviceWorker.path || 'master-service-worker.js') + '?config=' + encodeURIComponent(JSON.stringify({name: This.properties.global.brand.name, env: This.properties.meta.environment, v: This.properties.global.version, firebase: options_user.libraries.firebase_app.config})) )
|
1168
|
+
navigator.serviceWorker.register('/' + (options_user.serviceWorker.path || 'master-service-worker.js') + '?config=' + encodeURIComponent(JSON.stringify({name: This.properties.global.brand.name, app: This.properties.global.app, env: This.properties.meta.environment, v: This.properties.global.version, cb: This.properties.global.cacheBreaker, firebase: options_user.libraries.firebase_app.config})) )
|
1165
1169
|
.then(function (registration) {
|
1166
1170
|
// firebase.messaging().useServiceWorker(registration);
|
1171
|
+
// console.log('----TEST registration', registration);
|
1167
1172
|
This.properties.references.serviceWorker = registration;
|
1168
1173
|
// console.log('====registration', registration);
|
1169
1174
|
// console.log('navigator.serviceWorker.controller', navigator.serviceWorker.controller);
|
@@ -1221,8 +1226,14 @@ function Manager() {
|
|
1221
1226
|
try {
|
1222
1227
|
// Normally, notifications are not displayed when user is ON PAGE but we will display it here anyway
|
1223
1228
|
firebase.messaging().onMessage(function (payload) {
|
1224
|
-
|
1229
|
+
// console.log('---payload', payload);
|
1230
|
+
new Notification(payload.notification.title, payload.notification)
|
1231
|
+
.onclick = function(event) {
|
1232
|
+
event.preventDefault(); // prevent the browser from focusing the Notification's tab
|
1233
|
+
window.open(payload.notification.click_action, '_blank');
|
1234
|
+
}
|
1225
1235
|
})
|
1236
|
+
// console.log('---SKIPPING ONMESSAGE');
|
1226
1237
|
} catch (e) {
|
1227
1238
|
console.error(e);
|
1228
1239
|
}
|
package/package.json
CHANGED