mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-07-10 13:30:52 +00:00
fix: notify not working on electron by default
This commit is contained in:
parent
65afe47175
commit
8ffe93d068
1 changed files with 31 additions and 19 deletions
|
|
@ -4,6 +4,7 @@ import {router} from './../../router'
|
|||
import Vue from 'vue';
|
||||
import DesktopNotification from '@/utils/ElectronJS/DesktopNotification'
|
||||
import isElectron from '@/utils/ElectronJS/DesktopNotification'
|
||||
import { isMobile } from '@/utils/Mobile';
|
||||
|
||||
const state = {
|
||||
|
||||
|
|
@ -174,11 +175,21 @@ const actions = {
|
|||
context.dispatch('messageCreatedNotification', notification);
|
||||
function desktopNotification() {
|
||||
// send desktop notification
|
||||
const disableDesktopNotification = context.rootGetters['settingsModule/settings'].notification.disableDesktopNotification;
|
||||
if (disableDesktopNotification === true) return
|
||||
|
||||
if (!isElectron || disableDesktopNotification === undefined) return;
|
||||
const channel = context.getters.channels[data.message.channelID];
|
||||
const disableDesktopNotification = context.rootGetters['settingsModule/settings'].notification.disableDesktopNotification;
|
||||
|
||||
|
||||
|
||||
// if (disableDesktopNotification === true) return
|
||||
|
||||
// if (!isElectron || disableDesktopNotification === undefined) return;
|
||||
if (isMobile) return;
|
||||
if (isElectron && disableDesktopNotification === undefined) return sendNotification();
|
||||
if (disableDesktopNotification !== undefined && disableDesktopNotification === false) return sendNotification()
|
||||
|
||||
|
||||
|
||||
function sendNotification() {
|
||||
if (channel && channel.server_id) {
|
||||
const server = context.getters['servers/servers'][channel.server_id]
|
||||
DesktopNotification.serverMessage({
|
||||
|
|
@ -196,6 +207,7 @@ const actions = {
|
|||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
socket_userStatusChange(context, data) {
|
||||
if (context.rootState.user.user.uniqueID === data.uniqueID) return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue