Fixed issue with notification sounds not working correctly (#1818)
This commit is contained in:
@@ -20,22 +20,22 @@ const defaultOptions = {
|
|||||||
export const DEFAULT_WIN7 = 'Ding';
|
export const DEFAULT_WIN7 = 'Ding';
|
||||||
|
|
||||||
export class Mention extends Notification {
|
export class Mention extends Notification {
|
||||||
customSound: boolean;
|
customSound: string;
|
||||||
channel: {id: string}; // TODO: Channel from mattermost-redux
|
channel: {id: string}; // TODO: Channel from mattermost-redux
|
||||||
teamId: string;
|
teamId: string;
|
||||||
|
|
||||||
constructor(customOptions: MentionOptions, channel: {id: string}, teamId: string) {
|
constructor(customOptions: MentionOptions, channel: {id: string}, teamId: string) {
|
||||||
super({...defaultOptions, ...customOptions});
|
|
||||||
const options = {...defaultOptions, ...customOptions};
|
const options = {...defaultOptions, ...customOptions};
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
// Notification Center shows app's icon, so there were two icons on the notification.
|
// Notification Center shows app's icon, so there were two icons on the notification.
|
||||||
Reflect.deleteProperty(options, 'icon');
|
Reflect.deleteProperty(options, 'icon');
|
||||||
}
|
}
|
||||||
const isWin7 = (process.platform === 'win32' && osVersion.isLowerThanOrEqualWindows8_1() && DEFAULT_WIN7);
|
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) {
|
if (customSound) {
|
||||||
options.silent = true;
|
options.silent = true;
|
||||||
}
|
}
|
||||||
|
super(options);
|
||||||
|
|
||||||
this.customSound = customSound;
|
this.customSound = customSound;
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
|
Reference in New Issue
Block a user