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

View file

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

View file

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