Fix for browsers without SW (#805)

* Fix for browsers without SW

* Improve check
pull/817/head
Andrey 2018-01-18 03:10:15 +02:00 committed by Paulus Schoutsen
parent 9131a7c7e3
commit 8b8ba5875f
1 changed files with 2 additions and 1 deletions

View File

@ -25,7 +25,7 @@ class HaPushNotificationsToggle extends window.hassMixins.EventsMixin(Polymer.El
readOnly: true,
notify: true,
value: (
'PushManager' in window &&
'serviceWorker' in navigator && 'PushManager' in window &&
(document.location.protocol === 'https:' ||
document.location.hostname === 'localhost' ||
document.location.hostname === '127.0.0.1')
@ -61,6 +61,7 @@ class HaPushNotificationsToggle extends window.hassMixins.EventsMixin(Polymer.El
);
}
handlePushChange(pushChecked) {
if (!this.pushSupported) return;
if (pushChecked) {
this.subscribePushNotifications();
} else {