removed debug code and fixed missing import

This commit is contained in:
supertiger1234 2019-11-01 20:47:40 +00:00
parent 8594fc5cc5
commit 747abcb510
3 changed files with 49 additions and 43 deletions

View file

@ -1,86 +1,94 @@
<template> <template>
<div class="my-profile-panel"> <div class="my-profile-panel">
<div class="switches"> <div class="switches">
<div class="checkbox" <div class="checkbox" @click="toggleNotificationSounds">
@click="toggleNotificationSounds"> <div
<div class="checkbox-box" :class="{selected: !notificationSettings.disableNotificationSound}" /> class="checkbox-box"
<div class="checkbox-name"> :class="{selected: !notificationSettings.disableNotificationSound}"
Notification Sounds />
</div> <div class="checkbox-name">Notification Sounds</div>
</div> </div>
<div class="checkbox" <div class="checkbox" @click="toggleNotification()">
@click="toggleNotification()"> <div
<div class="checkbox-box" :class="{selected: !notificationSettings.disableDesktopNotification}" /> class="checkbox-box"
<div class="checkbox-name"> :class="{selected: !notificationSettings.disableDesktopNotification}"
Desktop Notifications />
</div> <div class="checkbox-name">Desktop Notifications</div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import config from "@/config.js"; import config from "@/config.js";
import SettingsService from '@/services/settingsService.js'; import SettingsService from "@/services/settingsService.js";
export default { export default {
data() { data() {
return { return {
isElectron: window && window.process && window.process.type, isElectron: window && window.process && window.process.type
}; };
}, },
methods: { methods: {
toggleSetting(key) { toggleSetting(key) {
const setting = this.notificationSettings[key]; const setting = this.notificationSettings[key];
if ( !setting || setting === false ) if (!setting || setting === false)
this.$store.dispatch('settingsModule/updateNotification', {[key]: true}) this.$store.dispatch("settingsModule/updateNotification", {
[key]: true
});
else else
this.$store.dispatch('settingsModule/updateNotification', {[key]: false}) this.$store.dispatch("settingsModule/updateNotification", {
[key]: false
});
}, },
toggleNotification(){ toggleNotification() {
const _this = this; const _this = this;
const setting = this.notificationSettings['disableDesktopNotification']; const setting = this.notificationSettings["disableDesktopNotification"];
if (setting && setting === true && !this.isElectron) { if (setting && setting === true && !this.isElectron) {
if (Notification.permission === "denied") { if (Notification.permission === "denied") {
alert("Notifications permission is blocked. Allow notifications from this website in your browsers permission settings."); alert(
"Notifications permission is blocked. Allow notifications from this website in your browsers permission settings."
);
} }
Notification.requestPermission().then(function(result) { Notification.requestPermission().then(function(result) {
if (result === 'denied' || result === 'default') return; if (result === "denied" || result === "default") return;
_this.$store.dispatch('settingsModule/updateNotification', {disableDesktopNotification: false}) _this.$store.dispatch("settingsModule/updateNotification", {
disableDesktopNotification: false
});
}); });
return; return;
} }
this.toggleSetting('disableDesktopNotification'); this.toggleSetting("disableDesktopNotification");
}, },
toggleNotificationSounds(){ toggleNotificationSounds() {
console.log("test") const setting = this.notificationSettings["disableNotificationSound"];
const setting = this.notificationSettings['disableNotificationSound']; this.$store.dispatch("settingsModule/updateNotification", {
console.log(!!!setting) disableNotificationSound: !setting
this.$store.dispatch('settingsModule/updateNotification', {disableNotificationSound: !setting}) });
} }
}, },
mounted() { mounted() {
if (!this.isElectron && this.notificationSettings.disableDesktopNotification === undefined) { if (
this.$store.dispatch('settingsModule/updateNotification', {disableDesktopNotification: true}) !this.isElectron &&
this.notificationSettings.disableDesktopNotification === undefined
) {
this.$store.dispatch("settingsModule/updateNotification", {
disableDesktopNotification: true
});
} }
}, },
computed: { computed: {
notificationSettings() { notificationSettings() {
return this.$store.getters['settingsModule/settings'].notification; return this.$store.getters["settingsModule/settings"].notification;
}, },
user() { user() {
return this.$store.getters.user return this.$store.getters.user;
} }
}, }
}; };
</script> </script>
<style scoped> <style scoped>
.switches { .switches {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -116,13 +124,13 @@ export default {
max-width: 200px; max-width: 200px;
} }
.message-example{ .message-example {
padding: 10px; padding: 10px;
background: rgba(88, 88, 88, 0.44); background: rgba(88, 88, 88, 0.44);
border-radius: 10px; border-radius: 10px;
margin: 10px; margin: 10px;
} }
.title{ .title {
font-size: 20px; font-size: 20px;
text-align: center; text-align: center;
margin-bottom: 5px; margin-bottom: 5px;
@ -138,5 +146,4 @@ export default {
margin-top: 10px; margin-top: 10px;
flex-direction: column; flex-direction: column;
} }
</style> </style>

View file

@ -23,7 +23,6 @@
<script> <script>
import MyMiniInformation from "@/components/app/MyMiniInformation.vue"; import MyMiniInformation from "@/components/app/MyMiniInformation.vue";
import Server from "@/components/app/ServerTemplate/ServerTemplate.vue";
import ChannelsList from "@/components/app/ServerTemplate/ChannelsList.vue"; import ChannelsList from "@/components/app/ServerTemplate/ChannelsList.vue";
import Navigation from "@/components/app/Navigation.vue"; import Navigation from "@/components/app/Navigation.vue";
import { bus } from "@/main"; import { bus } from "@/main";
@ -32,7 +31,6 @@ export default {
components: { components: {
MyMiniInformation, MyMiniInformation,
ChannelsList, ChannelsList,
Server,
Navigation Navigation
}, },
data() { data() {

View file

@ -72,6 +72,7 @@
<script> <script>
import Recaptcha from "@/components/Recaptcha.vue"; import Recaptcha from "@/components/Recaptcha.vue";
import HeaderLogin from "@/components/HeaderLoginTemplate.vue"; import HeaderLogin from "@/components/HeaderLoginTemplate.vue";
import AuthenticationService from "@/services/AuthenticationService";
const ElectronFrameButtons = () => const ElectronFrameButtons = () =>
import("@/components/ElectronJS/FrameButtons.vue"); import("@/components/ElectronJS/FrameButtons.vue");