Skip to content

Commit c99664c

Browse files
Revert "remove push API"
This reverts commit fdf7396.
1 parent 0bf3042 commit c99664c

19 files changed

+1578
-22
lines changed

.env.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ ELASTICSEARCH_USERNAME=
3131
ELASTICSEARCH_PASSWORD=
3232
SSL_VERIFY_PEER=true
3333
SECRET_REGISTER=
34+
VAPID_PUBLIC_KEY=
35+
VAPID_PRIVATE_KEY=
3436
SENDER_ADDRESS=
3537
###< app ###

.env.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ KERNEL_CLASS='App\Kernel'
33
APP_SECRET='$ecretf0rt3st'
44
SYMFONY_DEPRECATIONS_HELPER=999999
55
PANTHER_APP_ENV=panther
6+
VAPID_PUBLIC_KEY='test'
7+
VAPID_PRIVATE_KEY='test'
68
MAILER_DSN='test'
79
SENDER_ADDRESS='test'

assets/js/app.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ slug.charmap['?'] = '-';
1010
slug.charmap['='] = '-';
1111
global.slug = slug;
1212

13-
global.serviceWorkerAvailable = function serviceWorkerAvailable() {
14-
return 'serviceWorker' in navigator && 'https:' == window.location.protocol;
15-
}
16-
1713
global.sleep = function sleep(ms) {
1814
return new Promise(resolve => setTimeout(resolve, ms));
1915
}
@@ -31,7 +27,7 @@ global.createToast = function createToast(body) {
3127
}
3228

3329
function messageToServiceWorker(content) {
34-
if (true === serviceWorkerAvailable()) {
30+
if('serviceWorker' in navigator && 'https:' == window.location.protocol) {
3531
navigator.serviceWorker.ready.then(function() {
3632
return new Promise(function(resolve, reject) {
3733
var messageChannel = new MessageChannel();
@@ -57,9 +53,13 @@ if (buttonInstall) {
5753
});
5854
}
5955

60-
if (true === serviceWorkerAvailable()) {
56+
global.serviceWorkerEnabled = false;
57+
58+
if('serviceWorker' in navigator && 'https:' == window.location.protocol) {
6159
navigator.serviceWorker.register(app_base_url + 'serviceworker.js')
6260
.then(function(ServiceWorkerRegistration) {
61+
global.serviceWorkerEnabled = true;
62+
6363
if (buttonInstall) {
6464
var standalone = window.matchMedia('(display-mode: standalone)');
6565
if (false === standalone.matches) {

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"ext-ctype": "*",
1010
"ext-iconv": "*",
1111
"box/spout": "^3.1",
12+
"minishlink/web-push": "^6.0.1",
1213
"piwik/device-detector": "^3.12",
1314
"sensio/framework-extra-bundle": "^5.1",
1415
"symfony/asset": "5.1.*",

0 commit comments

Comments
 (0)