fix(electron): use dynamic load for exposed meta (#5251)
There is high possibilities of circular dependencies when importing `exposed-meta` module. Change it to dynamic import to mitigate the issue..
This commit is contained in:
4 files changed
+56
-41
No files matched your search
@@ -1,8 +1,9 @@
|
||||
import { app, BrowserWindow, nativeTheme } from 'electron';
|
||||
import { app, nativeTheme } from 'electron';
|
||||
import { getLinkPreview } from 'link-preview-js';
|
||||
|
||||
import { isMacOS } from '../../shared/utils';
|
||||
import { logger } from '../logger';
|
||||
import { getMainWindow } from '../main-window';
|
||||
import type { NamespaceHandlers } from '../type';
|
||||
import { getChallengeResponse } from './challenge';
|
||||
import { getGoogleOauthCode } from './google-auth';
|
||||
@@ -13,32 +14,28 @@ export const uiHandlers = {
|
||||
},
|
||||
handleSidebarVisibilityChange: async (_, visible: boolean) => {
|
||||
if (isMacOS()) {
|
||||
const windows = BrowserWindow.getAllWindows();
|
||||
windows.forEach(w => {
|
||||
// hide window buttons when sidebar is not visible
|
||||
w.setWindowButtonVisibility(visible);
|
||||
});
|
||||
const window = await getMainWindow();
|
||||
window?.setWindowButtonVisibility(visible);
|
||||
}
|
||||
},
|
||||
handleMinimizeApp: async () => {
|
||||
const windows = BrowserWindow.getAllWindows();
|
||||
windows.forEach(w => {
|
||||
w.minimize();
|
||||
});
|
||||
const window = await getMainWindow();
|
||||
window?.minimize();
|
||||
},
|
||||
handleMaximizeApp: async () => {
|
||||
const windows = BrowserWindow.getAllWindows();
|
||||
windows.forEach(w => {
|
||||
// allow unmaximize when in full screen mode
|
||||
if (w.isFullScreen()) {
|
||||
w.setFullScreen(false);
|
||||
w.unmaximize();
|
||||
} else if (w.isMaximized()) {
|
||||
w.unmaximize();
|
||||
} else {
|
||||
w.maximize();
|
||||
}
|
||||
});
|
||||
const window = await getMainWindow();
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
// allow unmaximize when in full screen mode
|
||||
if (window.isFullScreen()) {
|
||||
window.setFullScreen(false);
|
||||
window.unmaximize();
|
||||
} else if (window.isMaximized()) {
|
||||
window.unmaximize();
|
||||
} else {
|
||||
window.maximize();
|
||||
}
|
||||
},
|
||||
handleCloseApp: async () => {
|
||||
app.quit();
|
||||
|
||||
Reference in new issue
Block a user