Merge remote-tracking branch 'upstream/master' into ELECTRON-134

This commit is contained in:
Kiran Niranjan 2017-10-26 09:58:24 +05:30
commit 69a1e94445
12 changed files with 104 additions and 8138 deletions

3
.gitignore vendored
View File

@ -26,4 +26,5 @@ installer/mac/build/
installer/mac/SymphonySettingsPlugin/SymphonySettingsPlugin.xcodeproj/xcuserdata
installer/mac/SymphonySettingsPlugin/SymphonySettingsPlugin.xcodeproj/project.xcworkspace/xcuserdata
installer/win/Symphony-x64-cache
installer/win/Symphony-x64-SetupFiles
installer/win/Symphony-x64-SetupFiles
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

@ -460,7 +460,7 @@
<key>OVERWRITE_PERMISSIONS</key>
<false/>
<key>VERSION</key>
<string>1.0.1</string>
<string>2.0.0</string>
</dict>
<key>UUID</key>
<string>91776F5A-09FA-4631-A17C-BE8B5C83AF81</string>

View File

@ -25,7 +25,7 @@
<ROW Property="ProductCode" Value="1033:{F17EDEB4-A15F-46B9-83E9-8652CBC886B2} " Type="16"/>
<ROW Property="ProductLanguage" Value="1033"/>
<ROW Property="ProductName" Value="Symphony-Electron"/>
<ROW Property="ProductVersion" Value="1.0.0" Type="32"/>
<ROW Property="ProductVersion" Value="2.0.0" Type="32"/>
<ROW Property="REBOOT" MultiBuildValue="DefaultBuild:ReallySuppress"/>
<ROW Property="RUNAPPLICATION" Value="1" Type="4"/>
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND"/>

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

@ -179,7 +179,7 @@ function setup() {
setupConfig();
// if display added/removed/changed then re-run setup and remove all existing
// notifications. ToDo: should reposition notifications rather than closing.
// notifications.
electron.screen.on('display-added', setupConfig);
electron.screen.on('display-removed', setupConfig);
electron.screen.on('display-metrics-changed', setupConfig);
@ -246,7 +246,6 @@ function calcDimensions() {
* Setup the notification config
*/
function setupConfig() {
closeAll();
// This feature only applies to windows
if (!isMac) {
@ -702,33 +701,6 @@ function getWindow() {
})
}
/**
* Closes all the notifications and windows
*/
function closeAll() {
// Clear out animation Queue and close windows
animationQueue.clear();
activeNotifications.forEach(function(window) {
if (window.displayTimer) {
clearTimeout(window.displayTimer);
}
if (window.electronNotifyOnCloseFunc) {
// ToDo: fix this: shouldn't delete method on arg
/* eslint-disable */
delete window.electronNotifyOnCloseFunc;
/* eslint-enable */
}
window.close();
});
cleanUpInactiveWindow();
// Reset certain vars
nextInsertPos = {};
activeNotifications = [];
}
/**
* Once a minute, remove inactive windows to free up memory used.
*/

View File

@ -48,8 +48,14 @@ function updateScreens() {
screens = electron.screen.getAllDisplays();
// Notifying renderer when a display is added/removed
if (configurationWindow && screens && screens.length >= 0) {
configurationWindow.webContents.send('screens', screens);
if (configurationWindow) {
// Event that updates the DOM elements
// notification position checkbox and monitor selection drop-down
configurationWindow.webContents.send('notificationSettings', {position: position, display: display});
if (screens && screens.length >= 0) {
configurationWindow.webContents.send('screens', screens);
}
}
}
@ -72,13 +78,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",