mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Electron-435 - Optimize reading "isCustomTitleBar" global config field (#365)
This commit is contained in:
committed by
Vishwas Shashidhar
parent
0ff4a8bb6d
commit
0f2d52020d
@@ -93,33 +93,35 @@ function getParsedUrl(appUrl) {
|
|||||||
* @param initialUrl
|
* @param initialUrl
|
||||||
*/
|
*/
|
||||||
function createMainWindow(initialUrl) {
|
function createMainWindow(initialUrl) {
|
||||||
Promise.all([
|
getConfigField('mainWinPos')
|
||||||
getConfigField('mainWinPos'),
|
.then(winPos => {
|
||||||
getGlobalConfigField('isCustomTitleBar')
|
doCreateMainWindow(initialUrl, winPos);
|
||||||
]).then((values) => {
|
})
|
||||||
doCreateMainWindow(initialUrl, values[ 0 ], values[ 1 ]);
|
.catch(() => {
|
||||||
}).catch(() => {
|
// failed use default bounds and frame
|
||||||
// failed use default bounds and frame
|
doCreateMainWindow(initialUrl, null);
|
||||||
doCreateMainWindow(initialUrl, null, false);
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the main window with bounds
|
* Creates the main window with bounds
|
||||||
* @param initialUrl
|
* @param initialUrl
|
||||||
* @param initialBounds
|
* @param initialBounds
|
||||||
* @param isCustomTitleBar {Boolean} - Global config value weather to enable custom title bar
|
|
||||||
*/
|
*/
|
||||||
function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
|
function doCreateMainWindow(initialUrl, initialBounds) {
|
||||||
let url = initialUrl;
|
let url = initialUrl;
|
||||||
let key = getGuid();
|
let key = getGuid();
|
||||||
|
|
||||||
|
const config = readConfigFileSync();
|
||||||
|
|
||||||
// condition whether to enable custom Windows 10 title bar
|
// condition whether to enable custom Windows 10 title bar
|
||||||
const isCustomTitleBarEnabled = typeof isCustomTitleBar === 'boolean' && isCustomTitleBar && isWindows10();
|
const isCustomTitleBarEnabled = config
|
||||||
|
&& typeof config.isCustomTitleBar === 'boolean'
|
||||||
|
&& config.isCustomTitleBar
|
||||||
|
&& isWindows10();
|
||||||
|
|
||||||
log.send(logLevels.INFO, 'creating main window url: ' + url);
|
log.send(logLevels.INFO, 'creating main window url: ' + url);
|
||||||
|
|
||||||
let config = readConfigFileSync();
|
|
||||||
|
|
||||||
if (config && config !== null && config.customFlags) {
|
if (config && config !== null && config.customFlags) {
|
||||||
|
|
||||||
log.send(logLevels.INFO, 'Chrome flags config found!');
|
log.send(logLevels.INFO, 'Chrome flags config found!');
|
||||||
|
|||||||
Reference in New Issue
Block a user