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:
@@ -10,7 +10,7 @@ import {setLoggingLevel} from 'common/log';
|
||||
import {handleConfigUpdate} from 'main/app/config';
|
||||
import {handleMainWindowIsShown} from 'main/app/intercom';
|
||||
|
||||
import WindowManager from 'main/windows/windowManager';
|
||||
import MainWindow from 'main/windows/mainWindow';
|
||||
import AutoLauncher from 'main/AutoLauncher';
|
||||
|
||||
jest.mock('electron', () => ({
|
||||
@@ -47,8 +47,7 @@ jest.mock('main/views/viewManager', () => ({
|
||||
reloadConfiguration: jest.fn(),
|
||||
}));
|
||||
jest.mock('main/views/loadingScreen', () => ({}));
|
||||
jest.mock('main/windows/windowManager', () => ({
|
||||
handleUpdateConfig: jest.fn(),
|
||||
jest.mock('main/windows/mainWindow', () => ({
|
||||
sendToRenderer: jest.fn(),
|
||||
}));
|
||||
|
||||
@@ -65,11 +64,11 @@ describe('main/app/config', () => {
|
||||
|
||||
it('should reload renderer config only when app is ready', () => {
|
||||
handleConfigUpdate({});
|
||||
expect(WindowManager.sendToRenderer).not.toBeCalled();
|
||||
expect(MainWindow.sendToRenderer).not.toBeCalled();
|
||||
|
||||
app.isReady.mockReturnValue(true);
|
||||
handleConfigUpdate({});
|
||||
expect(WindowManager.sendToRenderer).toBeCalledWith(RELOAD_CONFIGURATION);
|
||||
expect(MainWindow.sendToRenderer).toBeCalledWith(RELOAD_CONFIGURATION);
|
||||
});
|
||||
|
||||
it('should set download path if applicable', () => {
|
||||
|
Reference in New Issue
Block a user