SDA-3813 - update variables on create Application (#1472)

This commit is contained in:
Kiran Niranjan 2022-08-17 14:11:16 +05:30 committed by GitHub
parent 272e2f8096
commit d1ba6a2b99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,31 +129,31 @@ export class WindowHandler {
} }
return format(parsedUrl); return format(parsedUrl);
} }
public mainView: ICustomBrowserView | null; public mainView: ICustomBrowserView | null = null;
public titleBarView: ICustomBrowserView | null; public titleBarView: ICustomBrowserView | null = null;
public mainWebContents: WebContents | undefined; public mainWebContents: WebContents | undefined;
public appMenu: AppMenu | null; public appMenu: AppMenu | null = null;
public isAutoReload: boolean; public isAutoReload: boolean = false;
public isOnline: boolean; public isOnline: boolean = true;
public url: string | undefined; public url: string | undefined;
public startUrl!: string; public startUrl!: string;
public isMana: boolean = false; public isMana: boolean = false;
public willQuitApp: boolean = false; public willQuitApp: boolean = false;
public spellchecker: SpellChecker | undefined; public spellchecker: SpellChecker | undefined;
public isCustomTitleBar: boolean; public isCustomTitleBar: boolean = isWindowsOS;
public isWebPageLoading: boolean = true; public isWebPageLoading: boolean = true;
public isLoggedIn: boolean = false; public isLoggedIn: boolean = false;
public isAutoUpdating: boolean = false; public isAutoUpdating: boolean = false;
public screenShareIndicatorFrameUtil: string; public screenShareIndicatorFrameUtil: string;
private readonly defaultPodUrl: string = 'https://[POD].symphony.com'; private defaultPodUrl: string = 'https://[POD].symphony.com';
private readonly contextIsolation: boolean; private contextIsolation: boolean = true;
private readonly backgroundThrottling: boolean; private backgroundThrottling: boolean = false;
private readonly windowOpts: ICustomBrowserWindowConstructorOpts; private windowOpts: ICustomBrowserWindowConstructorOpts = {} as ICustomBrowserWindowConstructorOpts;
private readonly globalConfig: IGlobalConfig; private globalConfig: IGlobalConfig = {} as IGlobalConfig;
private readonly config: IConfig; private config: IConfig = {} as IConfig;
// Window reference // Window reference
private readonly windows: object; private windows: object = {};
private userConfig: IConfig; private userConfig: IConfig = {} as IConfig;
private loadFailError: string | undefined; private loadFailError: string | undefined;
private mainWindow: ICustomBrowserWindow | null = null; private mainWindow: ICustomBrowserWindow | null = null;
private aboutAppWindow: Electron.BrowserWindow | null = null; private aboutAppWindow: Electron.BrowserWindow | null = null;
@ -165,9 +165,40 @@ export class WindowHandler {
private basicAuthWindow: Electron.BrowserWindow | null = null; private basicAuthWindow: Electron.BrowserWindow | null = null;
private notificationSettingsWindow: Electron.BrowserWindow | null = null; private notificationSettingsWindow: Electron.BrowserWindow | null = null;
private snippingToolWindow: Electron.BrowserWindow | null = null; private snippingToolWindow: Electron.BrowserWindow | null = null;
private finishedLoading: boolean; private finishedLoading: boolean = false;
private readonly opts: Electron.BrowserViewConstructorOptions | undefined;
constructor(opts?: Electron.BrowserViewConstructorOptions) { constructor(opts?: Electron.BrowserViewConstructorOptions) {
this.opts = opts;
this.screenShareIndicatorFrameUtil = '';
if (isWindowsOS) {
this.screenShareIndicatorFrameUtil = isDevEnv
? path.join(
__dirname,
'../../../node_modules/screen-share-indicator-frame/ScreenShareIndicatorFrame.exe',
)
: path.join(
path.dirname(app.getPath('exe')),
'ScreenShareIndicatorFrame.exe',
);
} else if (isMac) {
this.screenShareIndicatorFrameUtil = isDevEnv
? path.join(
__dirname,
'../../../node_modules/screen-share-indicator-frame/SymphonyScreenShareIndicator',
)
: path.join(
path.dirname(app.getPath('exe')),
'../node_modules/screen-share-indicator-frame/SymphonyScreenShareIndicator',
);
}
this.listenForLoad();
}
/**
* Starting point of the app
*/
public async createApplication() {
// Use these variables only on initial setup // Use these variables only on initial setup
this.config = config.getConfigFields([ this.config = config.getConfigFields([
'isCustomTitleBar', 'isCustomTitleBar',
@ -184,7 +215,6 @@ export class WindowHandler {
`window-handler: main windows initialized with following config data`, `window-handler: main windows initialized with following config data`,
this.config, this.config,
); );
this.globalConfig = config.getGlobalConfigFields([ this.globalConfig = config.getGlobalConfigFields([
'url', 'url',
'contextIsolation', 'contextIsolation',
@ -192,14 +222,10 @@ export class WindowHandler {
'overrideUserAgent', 'overrideUserAgent',
]); ]);
this.userConfig = config.getUserConfigFields(['url']); this.userConfig = config.getUserConfigFields(['url']);
const { customFlags } = this.config; const { customFlags } = this.config;
const { disableThrottling } = config.getCloudConfigFields([ const { disableThrottling } = config.getCloudConfigFields([
'disableThrottling', 'disableThrottling',
]) as any; ]) as any;
this.windows = {};
this.contextIsolation = true;
if (this.globalConfig.contextIsolation !== undefined) { if (this.globalConfig.contextIsolation !== undefined) {
this.contextIsolation = this.globalConfig.contextIsolation; this.contextIsolation = this.globalConfig.contextIsolation;
} }
@ -224,39 +250,8 @@ export class WindowHandler {
preload: path.join(__dirname, '../renderer/_preload-main.js'), preload: path.join(__dirname, '../renderer/_preload-main.js'),
}, },
), ),
...opts, ...this.opts,
}; };
this.isAutoReload = false;
this.isOnline = true;
this.finishedLoading = false;
this.screenShareIndicatorFrameUtil = '';
if (isWindowsOS) {
this.screenShareIndicatorFrameUtil = isDevEnv
? path.join(
__dirname,
'../../../node_modules/screen-share-indicator-frame/ScreenShareIndicatorFrame.exe',
)
: path.join(
path.dirname(app.getPath('exe')),
'ScreenShareIndicatorFrame.exe',
);
} else if (isMac) {
this.screenShareIndicatorFrameUtil = isDevEnv
? path.join(
__dirname,
'../../../node_modules/screen-share-indicator-frame/SymphonyScreenShareIndicator',
)
: path.join(
path.dirname(app.getPath('exe')),
'../node_modules/screen-share-indicator-frame/SymphonyScreenShareIndicator',
);
}
this.appMenu = null;
this.mainView = null;
this.titleBarView = null;
const locale: LocaleType = (this.config.locale || const locale: LocaleType = (this.config.locale ||
app.getLocale()) as LocaleType; app.getLocale()) as LocaleType;
i18n.setLocale(locale); i18n.setLocale(locale);
@ -268,15 +263,6 @@ export class WindowHandler {
isWindowsOS, isWindowsOS,
isLinux, isLinux,
}); });
this.listenForLoad();
}
/**
* Starting point of the app
*/
public async createApplication() {
this.userConfig = config.getUserConfigFields(['url']);
this.spellchecker = new SpellChecker(); this.spellchecker = new SpellChecker();
logger.info( logger.info(
`window-handler: initialized spellchecker module with locale ${this.spellchecker.locale}`, `window-handler: initialized spellchecker module with locale ${this.spellchecker.locale}`,