[MM-35811][MM-35386] Upgrade to Electron 12 (#1604)

* Upgrade to Electron 12

* Fix lock file

* Update package.json

Co-authored-by: Guillermo Vayá <guivaya@gmail.com>

* Upgrade spectron

Co-authored-by: Guillermo Vayá <guivaya@gmail.com>
This commit is contained in:
Devin Binnie
2021-05-19 09:40:12 -04:00
committed by GitHub
parent 22449fb081
commit 4fdcaf66a3
4 changed files with 229 additions and 325 deletions

View File

@@ -19,7 +19,10 @@ contextBridge.exposeInMainWorld('os', {
contextBridge.exposeInMainWorld('process', {
platform: process.platform,
env: process.env,
env: {
user: process.env.USER,
username: process.env.USERNAME,
},
});
contextBridge.exposeInMainWorld('timers', {

View File

@@ -124,35 +124,26 @@ function handleMainWindowWebContentsCrashed() {
function handleMaximizeMainWindow() {
sendToRenderer(MAXIMIZE_CHANGE, true);
// Workaround as part of https://mattermost.atlassian.net/browse/MM-33577
// Linux (or GNOME at least) seems to have issues with Electron and getting the size correctly when minimizing/maximizing
// So we need to manually force the browser view to resize after a small interval to get the size correct
// Please remove this once this issue has been resolved by Electron
if (process.platform === 'linux') {
setTimeout(setBoundsForCurrentView, 10);
}
}
function handleUnmaximizeMainWindow() {
sendToRenderer(MAXIMIZE_CHANGE, false);
// Workaround as part of https://mattermost.atlassian.net/browse/MM-33577
// Linux (or GNOME at least) seems to have issues with Electron and getting the size correctly when minimizing/maximizing
// So we need to manually force the browser view to resize after a small interval to get the size correct
// Please remove this once this issue has been resolved by Electron
if (process.platform === 'linux') {
setTimeout(setBoundsForCurrentView, 10);
}
}
function handleResizeMainWindow(event, newBounds) {
setBoundsForCurrentView(event, newBounds);
}
function setBoundsForCurrentView(event, newBounds) {
function handleResizeMainWindow() {
const currentView = status.viewManager.getCurrentView();
const bounds = newBounds || status.mainWindow.getContentBounds();
let bounds;
// Workaround for linux maximizing/minimizing, which doesn't work properly because of these bugs:
// https://github.com/electron/electron/issues/28699
// https://github.com/electron/electron/issues/28106
if (process.platform === 'linux') {
const size = status.mainWindow.getSize();
bounds = {width: size[0], height: size[1]};
} else {
bounds = status.mainWindow.getContentBounds();
}
if (currentView) {
currentView.setBounds(getAdjustedWindowBoundaries(bounds.width, bounds.height, !urlUtils.isTeamUrl(currentView.server.url, currentView.view.webContents.getURL())));
}