Remove WindowManager, separate functionality into smaller modules (#2682)
* Move sendToRenderer to respective singletons * Move to using ViewManager call for getting view by webContentsId * Move show and create logic to main window, handle deep linking seperately * Move resizing logic and event handing to mainWindow * Move server switching logic to main/app * Move tab switching logic to main/app, rely on showById for most usage * Migrate remaining functions, remove windowManager objects, set up imports for self-contained singletons * Fix E2E tests * Update src/main/app/servers.ts Co-authored-by: Elias Nahum <nahumhbl@gmail.com> --------- Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
@@ -7,6 +7,8 @@ import {SHOW_SETTINGS_WINDOW} from 'common/communication';
|
||||
import Config from 'common/config';
|
||||
import {Logger} from 'common/log';
|
||||
|
||||
import ViewManager from 'main/views/viewManager';
|
||||
|
||||
import ContextMenu from '../contextMenu';
|
||||
import {getLocalPreload, getLocalURLString} from '../utils';
|
||||
|
||||
@@ -33,8 +35,12 @@ export class SettingsWindow {
|
||||
return this.win;
|
||||
}
|
||||
|
||||
sendToRenderer = (channel: string, ...args: any[]) => {
|
||||
this.win?.webContents.send(channel, ...args);
|
||||
}
|
||||
|
||||
private create = () => {
|
||||
const mainWindow = MainWindow.get(true);
|
||||
const mainWindow = MainWindow.get();
|
||||
if (!mainWindow) {
|
||||
return;
|
||||
}
|
||||
@@ -67,6 +73,8 @@ export class SettingsWindow {
|
||||
|
||||
this.win.on('closed', () => {
|
||||
delete this.win;
|
||||
|
||||
ViewManager.focusCurrentView();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user