Skip to content
This repository was archived by the owner on May 2, 2021. It is now read-only.

Commit 6ed6210

Browse files
committed
refactor
1 parent c621379 commit 6ed6210

File tree

2 files changed

+16
-37
lines changed

2 files changed

+16
-37
lines changed

netlify_functions/deploy-succeeded/deploy-succeeded.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ exports.handler = async function ({ body = '{}' }) {
5353
included_segments: ['Active Users'],
5454
app_id: ONE_SIGNAL_APP_ID,
5555
headings: {
56-
en: 'Nuovo evento!',
56+
en: 'Pubblicato un nuovo evento!',
5757
},
5858
contents: {
59-
en: eventTitle,
59+
en: `"${eventTitle}"`,
6060
},
6161
web_url: 'https://www.fevr.it/',
6262
},

src/_js/main.js

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,19 @@ OneSignal.push(function () {
2222
});
2323
});
2424

25-
OneSignal.push([
26-
'getNotificationPermission',
27-
(permission) => {
28-
const isPushSupported = OneSignal.isPushNotificationsSupported();
29-
if (isPushSupported && permission === 'default') {
30-
// document.getElementById('notification-bar').hidden = false;
31-
}
32-
OneSignal.on('notificationPermissionChange', () => {
33-
// document.getElementById('notification-bar').hidden = true;
34-
});
35-
},
36-
]);
37-
38-
// function registerNotifier() {
39-
// const hideNotificationBar =
40-
// localStorage.getItem('notificationBar') === 'hide';
41-
// if (!hideNotificationBar) {
42-
// const bar = document.getElementById('notification-bar');
43-
44-
// const closeBar = () => {
45-
// bar.hidden = true;
46-
// localStorage.setItem('notificationBar', 'hide');
47-
// };
48-
49-
// bar.hidden = false;
50-
// bar.querySelector('button.close').addEventListener('click', closeBar);
51-
52-
// bar.querySelector('.btn.btn-link').addEventListener('click', async () => {
53-
// await Notification.requestPermission();
54-
// closeBar();
55-
// });
56-
// }
57-
// }
58-
5925
if ('serviceWorker' in navigator) {
60-
navigator.serviceWorker.register('/OneSignalSDKWorker.js');
26+
navigator.serviceWorker.register('/OneSignalSDKWorker.js').then(() => {
27+
OneSignal.push([
28+
'getNotificationPermission',
29+
(permission) => {
30+
const isPushSupported = OneSignal.isPushNotificationsSupported();
31+
if (isPushSupported && permission === 'default') {
32+
document.getElementById('notification-bar').hidden = false;
33+
}
34+
OneSignal.on('notificationPermissionChange', () => {
35+
document.getElementById('notification-bar').hidden = true;
36+
});
37+
},
38+
]);
39+
});
6140
}

0 commit comments

Comments
 (0)