Merge branch 'master' of github.com:symphonyoss/SymphonyElectron

This commit is contained in:
Vishwas Shashidhar 2018-05-22 18:27:17 +05:30
commit 0f39c6f4a9
2 changed files with 24 additions and 3 deletions

View File

@ -301,9 +301,12 @@ function setupFirstTimeLaunch() {
* @returns {Promise}
*/
function setStartup(lStartup) {
log.send(logLevels.INFO, `launch on startup parameter value is ${lStartup}`);
return new Promise((resolve) => {
let launchOnStartup = (lStartup === 'true');
let launchOnStartup = (String(lStartup) === 'true');
log.send(logLevels.INFO, `launchOnStartup value is ${launchOnStartup}`);
if (launchOnStartup) {
log.send(logLevels.INFO, `enabling launch on startup`);
symphonyAutoLauncher.enable();
return resolve();
}

View File

@ -160,7 +160,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
// if bounds if not fully contained in some display then use default size
// and position.
if (!isInDisplayBounds(bounds)) {
if (!isInDisplayBounds(bounds) || initialBounds.isMaximized || initialBounds.isFullScreen) {
bounds = null;
}
@ -189,10 +189,22 @@ function doCreateMainWindow(initialUrl, initialBounds) {
mainWindow = new BrowserWindow(newWinOpts);
mainWindow.winName = 'main';
let throttledMainWinBoundsChange = throttle(5000, saveMainWinBounds);
let throttledMainWinBoundsChange = throttle(1000, saveMainWinBounds);
mainWindow.on('move', throttledMainWinBoundsChange);
mainWindow.on('resize', throttledMainWinBoundsChange);
if (initialBounds && !isNodeEnv) {
// maximizes the application if previously maximized
if (initialBounds.isMaximized) {
mainWindow.maximize();
}
// Sets the application to full-screen if previously set to full-screen
if (isMac && initialBounds.isFullScreen) {
mainWindow.setFullScreen(true);
}
}
function retry() {
if (!isOnline) {
loadErrors.showNetworkConnectivityError(mainWindow, url, retry);
@ -611,6 +623,12 @@ app.on('before-quit', function () {
function saveMainWinBounds() {
let newBounds = getWindowSizeAndPosition(mainWindow);
// set application full-screen and maximized state
if (mainWindow && !mainWindow.isDestroyed()) {
newBounds.isMaximized = mainWindow.isMaximized();
newBounds.isFullScreen = mainWindow.isFullScreen();
}
if (newBounds) {
updateConfigField('mainWinPos', newBounds);
}