mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-07-06 11:30:46 +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 Vue from 'vue';
|
||||||
import DesktopNotification from '@/utils/ElectronJS/DesktopNotification'
|
import DesktopNotification from '@/utils/ElectronJS/DesktopNotification'
|
||||||
import isElectron from '@/utils/ElectronJS/DesktopNotification'
|
import isElectron from '@/utils/ElectronJS/DesktopNotification'
|
||||||
|
import { isMobile } from '@/utils/Mobile';
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
|
|
||||||
|
|
@ -174,26 +175,37 @@ const actions = {
|
||||||
context.dispatch('messageCreatedNotification', notification);
|
context.dispatch('messageCreatedNotification', notification);
|
||||||
function desktopNotification() {
|
function desktopNotification() {
|
||||||
// send desktop notification
|
// 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 channel = context.getters.channels[data.message.channelID];
|
||||||
if (channel && channel.server_id) {
|
const disableDesktopNotification = context.rootGetters['settingsModule/settings'].notification.disableDesktopNotification;
|
||||||
const server = context.getters['servers/servers'][channel.server_id]
|
|
||||||
DesktopNotification.serverMessage({
|
|
||||||
serverName: server.name,
|
|
||||||
channelName: channel.name,
|
// if (disableDesktopNotification === true) return
|
||||||
username: data.message.creator.username,
|
|
||||||
avatarURL: config.domain + '/avatars/' + server.avatar,
|
// if (!isElectron || disableDesktopNotification === undefined) return;
|
||||||
message: data.message.message
|
if (isMobile) return;
|
||||||
})
|
if (isElectron && disableDesktopNotification === undefined) return sendNotification();
|
||||||
} else {
|
if (disableDesktopNotification !== undefined && disableDesktopNotification === false) return sendNotification()
|
||||||
DesktopNotification.directMessage({
|
|
||||||
username: data.message.creator.username,
|
|
||||||
avatarURL: config.domain + '/avatars/' + data.message.creator.avatar,
|
|
||||||
message: data.message.message
|
function sendNotification() {
|
||||||
})
|
if (channel && channel.server_id) {
|
||||||
|
const server = context.getters['servers/servers'][channel.server_id]
|
||||||
|
DesktopNotification.serverMessage({
|
||||||
|
serverName: server.name,
|
||||||
|
channelName: channel.name,
|
||||||
|
username: data.message.creator.username,
|
||||||
|
avatarURL: config.domain + '/avatars/' + server.avatar,
|
||||||
|
message: data.message.message
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
DesktopNotification.directMessage({
|
||||||
|
username: data.message.creator.username,
|
||||||
|
avatarURL: config.domain + '/avatars/' + data.message.creator.avatar,
|
||||||
|
message: data.message.message
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue