[MM-42098] Remove icon from Windows 10/11 notification (#2032)

This commit is contained in:
Devin Binnie
2022-03-31 16:46:23 -04:00
committed by GitHub
parent 67b150ab3b
commit 7c1fa2c78d
3 changed files with 6 additions and 6 deletions

View File

@@ -1,9 +1,12 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import os from 'os';
import path from 'path'; import path from 'path';
import {app, Notification} from 'electron'; import {app, Notification} from 'electron';
import Utils from 'common/utils/util';
const assetsDir = path.resolve(app.getAppPath(), 'assets'); const assetsDir = path.resolve(app.getAppPath(), 'assets');
const appIconURL = path.resolve(assetsDir, 'appicon_48.png'); const appIconURL = path.resolve(assetsDir, 'appicon_48.png');
@@ -18,9 +21,7 @@ const defaultOptions = {
export class DownloadNotification extends Notification { export class DownloadNotification extends Notification {
constructor(fileName: string, serverName: string) { constructor(fileName: string, serverName: string) {
const options = {...defaultOptions}; const options = {...defaultOptions};
if (process.platform === 'win32') { if (process.platform === 'darwin' || (process.platform === 'win32' && Utils.isVersionGreaterThanOrEqualTo(os.release(), '10.0'))) {
options.icon = appIconURL;
} else 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');
} }

View File

@@ -28,11 +28,11 @@ export class Mention extends Notification {
constructor(customOptions: MentionOptions, channel: {id: string}, teamId: string) { constructor(customOptions: MentionOptions, channel: {id: string}, teamId: string) {
const options = {...defaultOptions, ...customOptions}; const options = {...defaultOptions, ...customOptions};
if (process.platform === 'darwin') { if (process.platform === 'darwin' || (process.platform === 'win32' && Utils.isVersionGreaterThanOrEqualTo(os.release(), '10.0'))) {
// 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' && !Utils.isVersionGreaterThanOrEqualTo(os.version(), '6.3') && DEFAULT_WIN7); const isWin7 = (process.platform === 'win32' && !Utils.isVersionGreaterThanOrEqualTo(os.release(), '6.3') && DEFAULT_WIN7);
const customSound = String(!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;

View File

@@ -71,7 +71,6 @@ export default class SettingsPage extends React.PureComponent<Record<string, nev
startInFullscreenRef: React.RefObject<HTMLInputElement>; startInFullscreenRef: React.RefObject<HTMLInputElement>;
autoCheckForUpdatesRef: React.RefObject<HTMLInputElement>; autoCheckForUpdatesRef: React.RefObject<HTMLInputElement>;
saveQueue: SaveQueueItem[]; saveQueue: SaveQueueItem[];
selectedSpellCheckerLocales: Array<{label: string; value: string}>; selectedSpellCheckerLocales: Array<{label: string; value: string}>;