Merge branch 'master' into electron-141

* master:
  Bumped up version to 2.0.0
  removed package-lock.json from git cache and added it to gitignore
  Electron-175 - Method to set AlwaysOnTop property for about window
  Electron-171 - Added issue link to the comment
  Electron-170 - Added code comments
  Electron-170 - Added an event to update the monitor drop-down whenever a display is added/removed
  Electron-171 - corrected a code comment
  Electron-171 - Fixes the Configuration window positioning when multiple monitors are connected
  electron-17: disabled crash report upload to server
  electron-17: refactored code to read data from the config file and added pod url to the extras object

# Conflicts:
#	.gitignore
This commit is contained in:
Vishwas Shashidhar 2017-10-25 11:27:06 +05:30
commit 372a506311
9 changed files with 96 additions and 8105 deletions

3
.gitignore vendored
View File

@ -78,4 +78,5 @@ artifacts/
.builds
*.pidb
*.svclog
*.scc
*.scc
package-lock.json

View File

@ -6,5 +6,10 @@
"notificationSettings": {
"position": "upper-right",
"display": ""
}
},
"crashReporter": {
"submitURL": "https://localhost:1127/post",
"companyName": "Symphony",
"uploadToServer": false
}
}

View File

@ -67,6 +67,13 @@ function openAboutWindow(windowName) {
aboutWindow.setVisibleOnAllWorkspaces(true);
aboutWindow.loadURL(getTemplatePath());
// sets the AlwaysOnTop property for the about window
// if the main window's AlwaysOnTop is true
let focusedWindow = BrowserWindow.getFocusedWindow();
if (focusedWindow && focusedWindow.isAlwaysOnTop()) {
aboutWindow.setAlwaysOnTop(true);
}
aboutWindow.once('ready-to-show', () => {
aboutWindow.show();
});

View File

@ -14,6 +14,8 @@ const {getConfigField, updateUserConfigWin, updateUserConfigMac} = require('./co
const { isMac, isDevEnv } = require('./utils/misc.js');
const protocolHandler = require('./protocolHandler');
const getCmdLineArg = require('./utils/getCmdLineArg.js');
const log = require('./log.js');
const logLevels = require('./enums/logLevels.js');
require('electron-dl')();
@ -32,7 +34,22 @@ require('./memoryMonitor.js');
const windowMgr = require('./windowMgr.js');
crashReporter.start({companyName: 'Symphony', submitURL: 'http://localhost:3000', uploadToServer: false, extra: {'process': 'main'}});
getConfigField('url')
.then(initializeCrashReporter)
.catch(app.quit);
function initializeCrashReporter(podUrl) {
getConfigField('crashReporter')
.then((crashReporterConfig) => {
crashReporter.start({companyName: crashReporterConfig.companyName, submitURL: crashReporterConfig.submitURL, uploadToServer: crashReporterConfig.uploadToServer, extra: {'process': 'main', podUrl: podUrl}});
log.send(logLevels.INFO, 'initialized crash reporter on the main process!');
})
.catch((err) => {
log.send(logLevels.ERROR, 'Unable to initialize crash reporter in the main process. Error is -> ' + err);
});
}
// only allow a single instance of app.
const shouldQuit = app.makeSingleInstance((argv) => {

View File

@ -51,6 +51,9 @@ function updateScreens() {
if (configurationWindow && screens && screens.length >= 0) {
configurationWindow.webContents.send('screens', screens);
}
// Event that updates the DOM elements
// notification position checkbox and monitor selection drop-down
configurationWindow.webContents.send('notificationSettings', {position: position, display: display});
}
/**
@ -72,13 +75,30 @@ function getTemplatePath() {
* @param windowName
*/
function openConfigurationWindow(windowName) {
let allWindows = BrowserWindow.getAllWindows();
allWindows = allWindows.find((window) => { return window.winName === windowName });
const allWindows = BrowserWindow.getAllWindows();
const selectedParentWindow = allWindows.find((window) => { return window.winName === windowName });
// if we couldn't find any window matching the window name
// it will render as a new window
if (allWindows) {
windowConfig.parent = allWindows;
if (selectedParentWindow) {
windowConfig.parent = selectedParentWindow;
/**
* This is a temporary work around until there
* is a fix for the modal window in windows from the electron
* issue - https://github.com/electron/electron/issues/10721
*/
const { x, y, width, height } = selectedParentWindow.getBounds();
const windowWidth = Math.round(width * 0.5);
const windowHeight = Math.round(height * 0.5);
// Calculating the center of the parent window
// to place the configuration window
const centerX = x + width / 2.0;
const centerY = y + height / 2.0;
windowConfig.x = Math.round(centerX - (windowWidth / 2.0));
windowConfig.y = Math.round(centerY - (windowHeight / 2.0));
}
configurationWindow = new BrowserWindow(windowConfig);

View File

@ -60,7 +60,6 @@ const throttledSetBadgeCount = throttle(1000, function(count) {
});
});
crashReporter.start({companyName: 'Symphony', submitURL: 'http://localhost:3000', uploadToServer: false, extra: {'process': 'preload script / renderer'}});
createAPI();
// creates API exposed from electron.
@ -336,6 +335,12 @@ function createAPI() {
});
local.ipcRenderer.on('register-crash-reporter', (event, arg) => {
if (arg) {
crashReporter.start({companyName: arg.companyName, submitURL: arg.submitURL, uploadToServer: arg.uploadToServer, extra: {'process': arg.process, podUrl: arg.podUrl}});
}
});
function updateOnlineStatus() {
local.ipcRenderer.send(apiName, {
cmd: apiCmds.isOnline,

View File

@ -93,7 +93,6 @@ function doCreateMainWindow(initialUrl, initialBounds) {
let url = initialUrl;
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);
let newWinOpts = {
@ -250,7 +249,24 @@ function doCreateMainWindow(initialUrl, initialBounds) {
webContents.send('downloadCompleted', data);
}
});
});
});
getConfigField('url')
.then(initializeCrashReporter)
.catch(app.quit);
function initializeCrashReporter(podUrl) {
getConfigField('crashReporter')
.then((crashReporterConfig) => {
log.send(logLevels.INFO, 'Initializing crash reporter on the main window!');
crashReporter.start({companyName: crashReporterConfig.companyName, submitURL: crashReporterConfig.submitURL, uploadToServer: crashReporterConfig.uploadToServer, extra: {'process': 'renderer / main window', podUrl: podUrl}});
log.send(logLevels.INFO, 'initialized crash reporter on the main window!');
mainWindow.webContents.send('register-crash-reporter', {companyName: crashReporterConfig.companyName, submitURL: crashReporterConfig.submitURL, uploadToServer: crashReporterConfig.uploadToServer, process: 'preload script / main window renderer'});
})
.catch((err) => {
log.send(logLevels.ERROR, 'Unable to initialize crash reporter in the main window. Error is -> ' + err);
});
}
// open external links in default browser - a tag with href='_blank' or window.open
mainWindow.webContents.on('new-window', function (event, newWinUrl,
@ -326,7 +342,19 @@ function doCreateMainWindow(initialUrl, initialBounds) {
if (browserWin) {
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}});
getConfigField('url')
.then((podUrl) => {
getConfigField('crashReporter')
.then((crashReporterConfig) => {
crashReporter.start({companyName: crashReporterConfig.companyName, submitURL: crashReporterConfig.submitURL, uploadToServer: crashReporterConfig.uploadToServer, extra: {'process': 'renderer / child window', podUrl: podUrl}});
log.send(logLevels.INFO, 'initialized crash reporter on a child window!');
browserWin.webContents.send('register-crash-reporter', {companyName: crashReporterConfig.companyName, submitURL: crashReporterConfig.submitURL, uploadToServer: crashReporterConfig.uploadToServer, process: 'preload script / child window renderer'});
})
.catch((err) => {
log.send(logLevels.ERROR, 'Unable to initialize crash reporter in the child window. Error is -> ' + err);
});
})
.catch(app.quit);
browserWin.winName = frameName;
browserWin.setAlwaysOnTop(alwaysOnTop);
@ -387,7 +415,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
let throttledBoundsChange = throttle(1000,
sendChildWinBoundsChange.bind(null, browserWin));
browserWin.on('move', throttledBoundsChange);
browserWin.on('resize', throttledBoundsChange);
browserWin.on('resize', throttledBoundsChange);
}
});
} else {

8092
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"name": "Symphony",
"productName": "Symphony",
"version": "1.0.1",
"version": "2.0.0",
"description": "Symphony desktop app (Foundation ODP)",
"author": "Symphony",
"main": "js/main.js",