Fixed safari scripts

This commit is contained in:
Eduard Urbach 2017-11-07 09:13:48 +01:00
parent c9849c5b16
commit 6c3babc934

View File

@ -267,18 +267,28 @@ export class AnimeNotifier {
} }
async updatePushUI() { async updatePushUI() {
if(!this.pushManager.pushSupported || !this.app.currentPath.includes("/settings/notifications")) { if(!this.app.currentPath.includes("/settings/notifications")) {
return
}
let enableButton = this.app.find("enable-notifications") as HTMLButtonElement
let disableButton = this.app.find("disable-notifications") as HTMLButtonElement
if(!this.pushManager.pushSupported) {
enableButton.disabled = true
enableButton.title = "Your browser doesn't support push notifications!"
disableButton.style.display = "none"
return return
} }
let subscription = await this.pushManager.subscription() let subscription = await this.pushManager.subscription()
if(subscription) { if(subscription) {
this.app.find("enable-notifications").style.display = "none" enableButton.style.display = "none"
this.app.find("disable-notifications").style.display = "flex" disableButton.style.display = "flex"
} else { } else {
this.app.find("enable-notifications").style.display = "flex" enableButton.style.display = "flex"
this.app.find("disable-notifications").style.display = "none" disableButton.style.display = "none"
} }
} }