Profile settings: add global Notification toggle
This commit is contained in:
parent
1ddedac0ef
commit
3ad766fe12
8 changed files with 128 additions and 79 deletions
|
|
@ -33,6 +33,7 @@
|
|||
import stickers from "./plugins/stickers";
|
||||
import { registerServiceWorker, notificationCount, windowNotificationPermission } from "./plugins/notificationAndServiceWorker.js"
|
||||
import logoMixin from "./components/logoMixin";
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: "App",
|
||||
|
|
@ -175,13 +176,16 @@ export default {
|
|||
}
|
||||
return favicon;
|
||||
},
|
||||
...mapState([
|
||||
'globalNotification'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
notificationCount: {
|
||||
handler(nCount) {
|
||||
// windowNotificationPermission
|
||||
// return value: 'granted', 'default', 'denied'
|
||||
if (nCount > 0 && this.windowNotificationPermission() === "granted") {
|
||||
if (this.globalNotification && nCount > 0 && this.windowNotificationPermission() === "granted") {
|
||||
this.showNotification()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue