Notifications Configurations added for web

This commit is contained in:
Eudes Inácio
2021-06-23 09:19:09 +01:00
parent dada970484
commit a6dbd09473
8 changed files with 254 additions and 76 deletions
+30
View File
@@ -9,6 +9,35 @@
<script src="assets/js/index.js"></script>
<script src="assets/js/wldirectudpate.js"></script>
<script>
if (navigator.serviceWorker) {
navigator.serviceWorker.register("assets/js/MFPPushServiceWorker.js").then(function(reg) {
window.pushReg = reg;
if (reg.installing) {
console.info('Service worker installing');
} else if (reg.waiting) {
console.info('Service worker installed');
} else if (reg.active) {
console.info('Service worker active');
}
if (!(reg.showNotification)) {
console.info('Notifications aren\'t supported on service workers.');
}
// Check if push messaging is supported
if (!('PushManager' in window)) {
console.info("Push messaging isn't supported.");
}
if (Notification.permission === 'denied') {
console.info('The user has blocked notifications.');
}
}).catch(err => {
console.error(JSON.stringify(err));
});
} else {
console.info("Service workers aren't supported in this browser.");
}
</script>
<meta name="color-scheme" content="light dark" />
<meta name="viewport" content="viewport-fit=cover, width=device-width, height=device-hight, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
@@ -19,6 +48,7 @@
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="assets/icon/favicon.png" />
<link rel="manifest" href="assets/json/manifest.json">
<!-- add to homescreen for ios -->
<meta name="apple-mobile-web-app-capable" content="yes" />