From c040c7cb4e6ba9d0a172ccad953947c1a0fa179a Mon Sep 17 00:00:00 2001 From: Shawn Date: Fri, 15 Mar 2019 17:09:14 -0500 Subject: [PATCH] Fix double video and broken tray icon --- src/platforms/electron/createTray.js | 5 ++++- src/ui/component/fileViewer/internal/player.jsx | 8 ++++++++ webpack.electron.config.js | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/platforms/electron/createTray.js b/src/platforms/electron/createTray.js index 55d9586ac..5cc3203ad 100644 --- a/src/platforms/electron/createTray.js +++ b/src/platforms/electron/createTray.js @@ -3,6 +3,7 @@ import path from 'path'; export default window => { let iconPath; + switch (process.platform) { case 'darwin': { iconPath = 'static/img/tray/mac/trayTemplate.png'; @@ -17,7 +18,9 @@ export default window => { } } - const tray = new Tray(iconPath); + const tray = new Tray( + process.env.NODE_ENV === 'development' ? iconPath : path.join(process.resourcesPath, iconPath) + ); tray.on('double-click', () => { window.show(); diff --git a/src/ui/component/fileViewer/internal/player.jsx b/src/ui/component/fileViewer/internal/player.jsx index f31166c63..dbe94b7ef 100644 --- a/src/ui/component/fileViewer/internal/player.jsx +++ b/src/ui/component/fileViewer/internal/player.jsx @@ -144,6 +144,14 @@ class MediaPlayer extends React.PureComponent { else { // Temp hack to help in some metadata loading cases setTimeout(() => { + + const currentMediaContainer = this.mediaContainer.current; + + // Clean any potential rogue instances + while (currentMediaContainer.firstChild) { + currentMediaContainer.removeChild(currentMediaContainer.firstChild); + } + player.append( { name: fileName, diff --git a/webpack.electron.config.js b/webpack.electron.config.js index f8d50bef2..9a346022f 100644 --- a/webpack.electron.config.js +++ b/webpack.electron.config.js @@ -53,6 +53,7 @@ if (process.env.NODE_ENV === 'production') { mainConfig = merge(mainConfig, { externals: { keytar: 'require("keytar")', + electron: 'require("electron")', }, }); } else {