[MM-51871] Migrate mainWindow and settingsWindow to singletons (#2650)
* Migrate mainWindow to singleton * Migrate settingsWindow to singleton * PR feedback * Missed a couple unwrapping cases
This commit is contained in:
@@ -15,6 +15,7 @@ import {displayMention} from 'main/notifications';
|
||||
import {getLocalPreload, getLocalURLString} from 'main/utils';
|
||||
import ModalManager from 'main/views/modalManager';
|
||||
import WindowManager from 'main/windows/windowManager';
|
||||
import MainWindow from 'main/windows/mainWindow';
|
||||
|
||||
import {handleAppBeforeQuit} from './app';
|
||||
import {updateServerInfos} from './utils';
|
||||
@@ -121,7 +122,7 @@ export function handleMainWindowIsShown() {
|
||||
* calls of this function will notification re-evaluate the booleans passed to "handleShowOnboardingScreens".
|
||||
*/
|
||||
|
||||
const mainWindow = WindowManager.getMainWindow();
|
||||
const mainWindow = MainWindow.get();
|
||||
|
||||
log.debug('intercom.handleMainWindowIsShown', {configTeams: Config.teams, showWelcomeScreen, showNewServerModal, mainWindow: Boolean(mainWindow)});
|
||||
if (mainWindow?.isVisible()) {
|
||||
@@ -140,7 +141,7 @@ export function handleNewServerModal() {
|
||||
|
||||
const preload = getLocalPreload('desktopAPI.js');
|
||||
|
||||
const mainWindow = WindowManager.getMainWindow();
|
||||
const mainWindow = MainWindow.get();
|
||||
if (!mainWindow) {
|
||||
return;
|
||||
}
|
||||
@@ -172,7 +173,7 @@ export function handleEditServerModal(e: IpcMainEvent, name: string) {
|
||||
|
||||
const preload = getLocalPreload('desktopAPI.js');
|
||||
|
||||
const mainWindow = WindowManager.getMainWindow();
|
||||
const mainWindow = MainWindow.get();
|
||||
if (!mainWindow) {
|
||||
return;
|
||||
}
|
||||
@@ -214,7 +215,7 @@ export function handleRemoveServerModal(e: IpcMainEvent, name: string) {
|
||||
|
||||
const preload = getLocalPreload('desktopAPI.js');
|
||||
|
||||
const mainWindow = WindowManager.getMainWindow();
|
||||
const mainWindow = MainWindow.get();
|
||||
if (!mainWindow) {
|
||||
return;
|
||||
}
|
||||
@@ -254,7 +255,7 @@ export function handleWelcomeScreenModal() {
|
||||
|
||||
const preload = getLocalPreload('desktopAPI.js');
|
||||
|
||||
const mainWindow = WindowManager.getMainWindow();
|
||||
const mainWindow = MainWindow.get();
|
||||
if (!mainWindow) {
|
||||
return;
|
||||
}
|
||||
@@ -293,7 +294,7 @@ export function handleOpenAppMenu() {
|
||||
return;
|
||||
}
|
||||
windowMenu.popup({
|
||||
window: WindowManager.getMainWindow(),
|
||||
window: MainWindow.get(),
|
||||
x: 18,
|
||||
y: 18,
|
||||
});
|
||||
|
Reference in New Issue
Block a user