Fixed issue with notification sounds not working correctly (#1818)

This commit is contained in:
Devin Binnie
2021-10-18 18:22:58 -04:00
committed by GitHub
parent 12052d4e0b
commit ebba86bc08

View File

@@ -20,22 +20,22 @@ const defaultOptions = {
export const DEFAULT_WIN7 = 'Ding';
export class Mention extends Notification {
customSound: boolean;
customSound: string;
channel: {id: string}; // TODO: Channel from mattermost-redux
teamId: string;
constructor(customOptions: MentionOptions, channel: {id: string}, teamId: string) {
super({...defaultOptions, ...customOptions});
const options = {...defaultOptions, ...customOptions};
if (process.platform === 'darwin') {
// Notification Center shows app's icon, so there were two icons on the notification.
Reflect.deleteProperty(options, 'icon');
}
const isWin7 = (process.platform === 'win32' && osVersion.isLowerThanOrEqualWindows8_1() && DEFAULT_WIN7);
const customSound = Boolean(!options.silent && ((options.data && options.data.soundName !== 'None' && options.data.soundName) || isWin7));
const customSound = String(!options.silent && ((options.data && options.data.soundName !== 'None' && options.data.soundName) || isWin7));
if (customSound) {
options.silent = true;
}
super(options);
this.customSound = customSound;
this.channel = channel;