diff --git a/src/main/preload/desktopAPI.js b/src/main/preload/desktopAPI.js index 0692d9a862c..583a1240672 100644 --- a/src/main/preload/desktopAPI.js +++ b/src/main/preload/desktopAPI.js @@ -4,7 +4,7 @@ 'use strict'; -import {ipcRenderer, contextBridge} from 'electron'; +import {ipcRenderer, contextBridge, app} from 'electron'; import { GET_LANGUAGE_INFORMATION, @@ -110,6 +110,8 @@ contextBridge.exposeInMainWorld('mas', { }); contextBridge.exposeInMainWorld('desktop', { + getAppName: () => app.name, + quit: (reason, stack) => ipcRenderer.send(QUIT, reason, stack), openAppMenu: () => ipcRenderer.send(OPEN_APP_MENU), closeServersDropdown: () => ipcRenderer.send(CLOSE_SERVERS_DROPDOWN), diff --git a/src/renderer/components/DownloadsDropdown/DownloadsDropdownItemFile.tsx b/src/renderer/components/DownloadsDropdown/DownloadsDropdownItemFile.tsx index aeeeef44545..b98cb2d91ee 100644 --- a/src/renderer/components/DownloadsDropdown/DownloadsDropdownItemFile.tsx +++ b/src/renderer/components/DownloadsDropdown/DownloadsDropdownItemFile.tsx @@ -7,8 +7,6 @@ import classNames from 'classnames'; import {useIntl} from 'react-intl'; -import {app} from 'electron'; - import FileSizeAndStatus from './FileSizeAndStatus'; import ProgressBar from './ProgressBar'; import ThreeDotButton from './ThreeDotButton'; @@ -30,7 +28,7 @@ const DownloadsDropdownItemFile = ({item, activeItem}: OwnProps) => { }; const itemFilename = item.type === 'update' ? - translate.formatMessage({id: 'renderer.downloadsDropdown.Update.MattermostVersionX', defaultMessage: `{appName} version ${item.filename}`}, {version: item.filename, appName: app.name}) : + translate.formatMessage({id: 'renderer.downloadsDropdown.Update.MattermostVersionX', defaultMessage: `{appName} version ${item.filename}`}, {version: item.filename, appName: window.desktop.getAppName()}) : item.filename; return ( diff --git a/src/renderer/components/DownloadsDropdown/Update/UpdateAvailable.tsx b/src/renderer/components/DownloadsDropdown/Update/UpdateAvailable.tsx index febf14ed3bc..9f5856b017d 100644 --- a/src/renderer/components/DownloadsDropdown/Update/UpdateAvailable.tsx +++ b/src/renderer/components/DownloadsDropdown/Update/UpdateAvailable.tsx @@ -8,8 +8,6 @@ import {FormattedMessage} from 'react-intl'; import {Button} from 'react-bootstrap'; -import {app} from 'electron'; - import Thumbnail from '../Thumbnail'; type OwnProps = { @@ -38,7 +36,7 @@ const UpdateAvailable = ({item}: OwnProps) => { defaultMessage={`A new version of the {appName} Desktop App (version ${item.filename}) is available to install.`} values={{ version: item.filename, - appName: app.name, + appName: window.desktop.getAppName(), }} /> diff --git a/src/renderer/components/DownloadsDropdown/Update/UpdateDownloaded.tsx b/src/renderer/components/DownloadsDropdown/Update/UpdateDownloaded.tsx index 3efd99a4d24..128084d5b09 100644 --- a/src/renderer/components/DownloadsDropdown/Update/UpdateDownloaded.tsx +++ b/src/renderer/components/DownloadsDropdown/Update/UpdateDownloaded.tsx @@ -10,8 +10,6 @@ import {Button} from 'react-bootstrap'; import classNames from 'classnames'; -import {app} from 'electron'; - import Thumbnail from '../Thumbnail'; import FileSizeAndStatus from '../FileSizeAndStatus'; @@ -33,7 +31,7 @@ const UpdateAvailable = ({item}: OwnProps) => {
- {translate.formatMessage({id: 'renderer.downloadsDropdown.Update.MattermostVersionX', defaultMessage: `{appName} version ${item.filename}`}, {version: item.filename, appName: app.name})} + {translate.formatMessage({id: 'renderer.downloadsDropdown.Update.MattermostVersionX', defaultMessage: `{appName} version ${item.filename}`}, {version: item.filename, appName: window.desktop.getAppName()})}
Promise; }; desktop: { + getAppName: () => string; + quit: (reason: string, stack: string) => void; openAppMenu: () => void; closeServersDropdown: () => void;