mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-16 05:46:35 +00:00
Fix Safari Profile page (#1619)
This commit is contained in:
parent
da19a1a9c6
commit
18a151c8e8
@ -45,10 +45,13 @@ class HaPushNotificationsToggle extends EventsMixin(PolymerElement) {
|
||||
async connectedCallback() {
|
||||
super.connectedCallback();
|
||||
|
||||
if (!('serviceWorker' in navigator)) return;
|
||||
if (!pushSupported) return;
|
||||
|
||||
try {
|
||||
const reg = await navigator.serviceWorker.ready;
|
||||
if (!reg.pushManager) {
|
||||
return;
|
||||
}
|
||||
reg.pushManager.getSubscription().then((subscription) => {
|
||||
this.loading = false;
|
||||
this.pushChecked = !!subscription;
|
||||
@ -59,6 +62,10 @@ class HaPushNotificationsToggle extends EventsMixin(PolymerElement) {
|
||||
}
|
||||
|
||||
handlePushChange(pushChecked) {
|
||||
// Somehow this is triggered on Safari on page load causing
|
||||
// it to get into a loop and crash the page.
|
||||
if (!pushSupported) return;
|
||||
|
||||
if (pushChecked) {
|
||||
this.subscribePushNotifications();
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user