Profile settings: add global Notification toggle

This commit is contained in:
10G Meow 2023-12-07 20:53:24 +02:00
parent 1ddedac0ef
commit 3ad766fe12
8 changed files with 128 additions and 79 deletions

View file

@ -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()
}
}