mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-20 11:48:30 -06:00
Merge branch 'master' of https://github.com/symphonyoss/SymphonyElectron into ELECTRON-142
This commit is contained in:
commit
0db10822b2
@ -6,5 +6,5 @@
|
|||||||
"notificationSettings": {
|
"notificationSettings": {
|
||||||
"position": "upper-right",
|
"position": "upper-right",
|
||||||
"display": ""
|
"display": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -37,6 +37,13 @@
|
|||||||
<button id='open-config-win'>Open configure window</button>
|
<button id='open-config-win'>Open configure window</button>
|
||||||
<br>
|
<br>
|
||||||
<hr>
|
<hr>
|
||||||
|
<p>
|
||||||
|
Crash Process:
|
||||||
|
<p>
|
||||||
|
<button id='crash'>Crash Renderer</button>
|
||||||
|
</p>
|
||||||
|
<br>
|
||||||
|
<hr>
|
||||||
<p>Badge Count:<p>
|
<p>Badge Count:<p>
|
||||||
<button id='inc-badge'>increment badge count</button>
|
<button id='inc-badge'>increment badge count</button>
|
||||||
<br>
|
<br>
|
||||||
@ -172,6 +179,12 @@
|
|||||||
console.log('bounds changed for=', arg)
|
console.log('bounds changed for=', arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// crash the renderer process
|
||||||
|
const crash = document.getElementById('crash');
|
||||||
|
crash.addEventListener('click', function () {
|
||||||
|
ssf.crashRendererProcess();
|
||||||
|
});
|
||||||
|
|
||||||
var getSources = document.getElementById('get-sources');
|
var getSources = document.getElementById('get-sources');
|
||||||
getSources.addEventListener('click', function() {
|
getSources.addEventListener('click', function() {
|
||||||
ssf.getMediaSources({types: ['window', 'screen']}, function(error, sources) {
|
ssf.getMediaSources({types: ['window', 'screen']}, function(error, sources) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// Third Party Dependencies
|
// Third Party Dependencies
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const app = electron.app;
|
const app = electron.app;
|
||||||
|
const crashReporter = electron.crashReporter;
|
||||||
const nodeURL = require('url');
|
const nodeURL = require('url');
|
||||||
const squirrelStartup = require('electron-squirrel-startup');
|
const squirrelStartup = require('electron-squirrel-startup');
|
||||||
const AutoLaunch = require('auto-launch');
|
const AutoLaunch = require('auto-launch');
|
||||||
@ -31,6 +32,8 @@ require('./memoryMonitor.js');
|
|||||||
|
|
||||||
const windowMgr = require('./windowMgr.js');
|
const windowMgr = require('./windowMgr.js');
|
||||||
|
|
||||||
|
crashReporter.start({companyName: 'Symphony', submitURL: 'http://localhost:3000', uploadToServer: false, extra: {'process': 'main'}});
|
||||||
|
|
||||||
// only allow a single instance of app.
|
// only allow a single instance of app.
|
||||||
const shouldQuit = app.makeSingleInstance((argv) => {
|
const shouldQuit = app.makeSingleInstance((argv) => {
|
||||||
// Someone tried to run a second instance, we should focus our window.
|
// Someone tried to run a second instance, we should focus our window.
|
||||||
|
@ -66,6 +66,13 @@ const template = [{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Open Crashes Directory',
|
||||||
|
click() {
|
||||||
|
const crashesDirectory = electron.crashReporter.getCrashesDirectory() + '/completed';
|
||||||
|
electron.shell.showItemInFolder(crashesDirectory);
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
},
|
},
|
||||||
@ -98,10 +105,11 @@ const template = [{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
role: 'help',
|
role: 'help',
|
||||||
submenu: [{
|
submenu: [
|
||||||
label: 'Learn More',
|
{
|
||||||
click() { electron.shell.openExternal('https://www.symphony.com'); }
|
label: 'Learn More',
|
||||||
}]
|
click() { electron.shell.openExternal('https://www.symphony.com'); }
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
// also to bring pieces of node.js:
|
// also to bring pieces of node.js:
|
||||||
// https://github.com/electron/electron/issues/2984
|
// https://github.com/electron/electron/issues/2984
|
||||||
//
|
//
|
||||||
const { ipcRenderer, remote } = require('electron');
|
const { ipcRenderer, remote, crashReporter } = require('electron');
|
||||||
|
|
||||||
const throttle = require('../utils/throttle.js');
|
const throttle = require('../utils/throttle.js');
|
||||||
const apiEnums = require('../enums/api.js');
|
const apiEnums = require('../enums/api.js');
|
||||||
@ -53,6 +53,7 @@ const throttledSetBadgeCount = throttle(1000, function(count) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
crashReporter.start({companyName: 'Symphony', submitURL: 'http://localhost:3000', uploadToServer: false, extra: {'process': 'preload script / renderer'}});
|
||||||
createAPI();
|
createAPI();
|
||||||
|
|
||||||
// creates API exposed from electron.
|
// creates API exposed from electron.
|
||||||
@ -109,6 +110,19 @@ function createAPI() {
|
|||||||
*/
|
*/
|
||||||
ScreenSnippet: remote.require('./screenSnippet/index.js').ScreenSnippet,
|
ScreenSnippet: remote.require('./screenSnippet/index.js').ScreenSnippet,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides API to crash the renderer process that calls this function
|
||||||
|
* Is only used for demos.
|
||||||
|
*/
|
||||||
|
crashRendererProcess: function () {
|
||||||
|
// For practical purposes, we don't allow
|
||||||
|
// this method to work in non-dev environments
|
||||||
|
if (!process.env.ELECTRON_DEV) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
process.crash();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Brings window forward and gives focus.
|
* Brings window forward and gives focus.
|
||||||
* @param {String} windowName Name of window. Note: main window name is 'main'
|
* @param {String} windowName Name of window. Note: main window name is 'main'
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const app = electron.app;
|
const app = electron.app;
|
||||||
|
const crashReporter = electron.crashReporter;
|
||||||
const BrowserWindow = electron.BrowserWindow;
|
const BrowserWindow = electron.BrowserWindow;
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const nodeURL = require('url');
|
const nodeURL = require('url');
|
||||||
@ -16,7 +17,6 @@ const log = require('./log.js');
|
|||||||
const logLevels = require('./enums/logLevels.js');
|
const logLevels = require('./enums/logLevels.js');
|
||||||
const notify = require('./notify/electron-notify.js');
|
const notify = require('./notify/electron-notify.js');
|
||||||
const eventEmitter = require('./eventEmitter');
|
const eventEmitter = require('./eventEmitter');
|
||||||
|
|
||||||
const throttle = require('./utils/throttle.js');
|
const throttle = require('./utils/throttle.js');
|
||||||
const { getConfigField, updateConfigField } = require('./config.js');
|
const { getConfigField, updateConfigField } = require('./config.js');
|
||||||
const { isMac, isNodeEnv } = require('./utils/misc');
|
const { isMac, isNodeEnv } = require('./utils/misc');
|
||||||
@ -81,7 +81,7 @@ function createMainWindow(initialUrl) {
|
|||||||
// failed, use default bounds
|
// failed, use default bounds
|
||||||
doCreateMainWindow(initialUrl, null);
|
doCreateMainWindow(initialUrl, null);
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,6 +93,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
|||||||
let url = initialUrl;
|
let url = initialUrl;
|
||||||
let key = getGuid();
|
let key = getGuid();
|
||||||
|
|
||||||
|
crashReporter.start({companyName: 'Symphony', submitURL: 'http://localhost:3000', uploadToServer: false, extra: {'process': 'renderer / main window'}});
|
||||||
log.send(logLevels.INFO, 'creating main window url: ' + url);
|
log.send(logLevels.INFO, 'creating main window url: ' + url);
|
||||||
|
|
||||||
let newWinOpts = {
|
let newWinOpts = {
|
||||||
@ -180,6 +181,26 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
|||||||
loadErrors.showLoadFailure(mainWindow, validatedURL, errorDesc, errorCode, retry, false);
|
loadErrors.showLoadFailure(mainWindow, validatedURL, errorDesc, errorCode, retry, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// In case a renderer process crashes, provide an
|
||||||
|
// option for the user to either reload or close the window
|
||||||
|
mainWindow.webContents.on('crashed', function () {
|
||||||
|
const options = {
|
||||||
|
type: 'error',
|
||||||
|
title: 'Renderer Process Crashed',
|
||||||
|
message: 'Oops! Looks like we have had a crash. Please reload or close this window.',
|
||||||
|
buttons: ['Reload', 'Close']
|
||||||
|
};
|
||||||
|
|
||||||
|
electron.dialog.showMessageBox(options, function (index) {
|
||||||
|
if (index === 0) {
|
||||||
|
mainWindow.reload();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mainWindow.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
addWindowKey(key, mainWindow);
|
addWindowKey(key, mainWindow);
|
||||||
mainWindow.loadURL(url);
|
mainWindow.loadURL(url);
|
||||||
|
|
||||||
@ -315,6 +336,8 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
|||||||
if (browserWin) {
|
if (browserWin) {
|
||||||
log.send(logLevels.INFO, 'loaded pop-out window url: ' + newWinParsedUrl);
|
log.send(logLevels.INFO, 'loaded pop-out window url: ' + newWinParsedUrl);
|
||||||
|
|
||||||
|
crashReporter.start({companyName: 'Symphony', submitURL: 'http://localhost:3000', uploadToServer: false, extra: {'process': 'renderer / pop out window - winKey -> ' + newWinKey}});
|
||||||
|
|
||||||
browserWin.winName = frameName;
|
browserWin.winName = frameName;
|
||||||
browserWin.setAlwaysOnTop(alwaysOnTop);
|
browserWin.setAlwaysOnTop(alwaysOnTop);
|
||||||
|
|
||||||
@ -324,6 +347,24 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
|||||||
browserWin.removeListener('resize', throttledBoundsChange);
|
browserWin.removeListener('resize', throttledBoundsChange);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
browserWin.webContents.on('crashed', function () {
|
||||||
|
const options = {
|
||||||
|
type: 'error',
|
||||||
|
title: 'Renderer Process Crashed',
|
||||||
|
message: 'Oops! Looks like we have had a crash. Please reload or close this window.',
|
||||||
|
buttons: ['Reload', 'Close']
|
||||||
|
};
|
||||||
|
|
||||||
|
electron.dialog.showMessageBox(options, function (index) {
|
||||||
|
if (index === 0) {
|
||||||
|
mainWindow.reload();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mainWindow.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
addWindowKey(newWinKey, browserWin);
|
addWindowKey(newWinKey, browserWin);
|
||||||
|
|
||||||
// throttle changes so we don't flood client.
|
// throttle changes so we don't flood client.
|
||||||
|
Loading…
Reference in New Issue
Block a user