diff --git a/main/app.ts b/main/app.ts index 4e1bbb2..c413cb5 100644 --- a/main/app.ts +++ b/main/app.ts @@ -25,17 +25,20 @@ export class App { } start() { - const url = `https://${this.switcher.current.host}${this.switcher.current.default_page}`; + const a = this.switcher.current; + const url = `https://${a.host}${a.default_page}`; this.win.open(url); - log.debug('Open URL: ', url); + log.debug('Application started', a, url); } private onAccountSwitch = (next: Account) => { this.win.close(); if (this.config.hot_key) { + log.debug('Disable global shortcut for switching account'); globalShortcut.unregister(this.config.hot_key); } Window.create(next, this.config, this.win.menubar) .then(win => { + log.debug('Window was recreated again', next); this.win = win; this.start(); }); diff --git a/main/window.ts b/main/window.ts index 8fafa09..0e9178b 100644 --- a/main/window.ts +++ b/main/window.ts @@ -36,19 +36,23 @@ export default class Window { e.preventDefault(); shell.openExternal(url); } + log.debug('Opened URL with external browser (will-navigate)', url); }); browser.webContents.on('new-window', (e, url) => { e.preventDefault(); shell.openExternal(url); + log.debug('Opened URL with external browser (new-window)', url); }); browser.webContents.session.setPermissionRequestHandler((contents, permission, callback) => { if (permission !== 'geolocation' && permission !== 'media') { // Granted + log.debug('Permission was granted', permission); callback(true); return; } + log.debug('Create dialog for user permission', permission); dialog.showMessageBox({ type: 'question', buttons: ['Accept', 'Reject'], @@ -62,10 +66,12 @@ export default class Window { } open(url: string) { + log.debug('Open URL:', url); this.browser.loadURL(url); } close() { + log.debug('Closing window:', this.account); this.state.unmanage(); this.browser.webContents.removeAllListeners(); this.browser.removeAllListeners(); @@ -216,12 +222,13 @@ function startMenuBar(account: Account, config: Config, bar: Menubar.MenubarApp app.quit(); }); if (bar) { - log.debug('recreate menubar window with different partition:', account); + log.debug('Recreate menubar window with different partition:', account); const pref = mb.getOption('webPreferences'); pref.partition = partitionForAccount(account); mb.setOption('webPreferences', pref); mb.showWindow(); } else { + log.debug('New menubar instance was created:', account); mb.once('ready', () => mb.showWindow()); } });