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
|
||||
*/
|
||||
function createMainWindow(initialUrl) {
|
||||
Promise.all([
|
||||
getConfigField('mainWinPos'),
|
||||
getGlobalConfigField('isCustomTitleBar')
|
||||
]).then((values) => {
|
||||
doCreateMainWindow(initialUrl, values[ 0 ], values[ 1 ]);
|
||||
}).catch(() => {
|
||||
// failed use default bounds and frame
|
||||
doCreateMainWindow(initialUrl, null, false);
|
||||
});
|
||||
getConfigField('mainWinPos')
|
||||
.then(winPos => {
|
||||
doCreateMainWindow(initialUrl, winPos);
|
||||
})
|
||||
.catch(() => {
|
||||
// failed use default bounds and frame
|
||||
doCreateMainWindow(initialUrl, null);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the main window with bounds
|
||||
* @param initialUrl
|
||||
* @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 key = getGuid();
|
||||
|
||||
const config = readConfigFileSync();
|
||||
|
||||
// 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);
|
||||
|
||||
let config = readConfigFileSync();
|
||||
|
||||
if (config && config !== null && config.customFlags) {
|
||||
|
||||
log.send(logLevels.INFO, 'Chrome flags config found!');
|
||||
|
||||
Reference in New Issue
Block a user