Fixed issues with loading the app from cold when deep linking (#3201)
* Fixed issues with loading the app from cold when deep linking * Don't call show() before the window is created on Windows
This commit is contained in:
@@ -29,7 +29,6 @@ export function handleAppSecondInstance(event: Event, argv: string[]) {
|
|||||||
|
|
||||||
// Protocol handler for win32
|
// Protocol handler for win32
|
||||||
// argv: An array of the second instance’s (command line / deep linked) arguments
|
// argv: An array of the second instance’s (command line / deep linked) arguments
|
||||||
MainWindow.show();
|
|
||||||
const deeplinkingURL = getDeeplinkingURL(argv);
|
const deeplinkingURL = getDeeplinkingURL(argv);
|
||||||
if (deeplinkingURL) {
|
if (deeplinkingURL) {
|
||||||
openDeepLink(deeplinkingURL);
|
openDeepLink(deeplinkingURL);
|
||||||
|
@@ -8,7 +8,7 @@ import type {BrowserWindow, Rectangle} from 'electron';
|
|||||||
import {app, Menu, session, dialog, nativeImage, screen} from 'electron';
|
import {app, Menu, session, dialog, nativeImage, screen} from 'electron';
|
||||||
import isDev from 'electron-is-dev';
|
import isDev from 'electron-is-dev';
|
||||||
|
|
||||||
import {APP_MENU_WILL_CLOSE} from 'common/communication';
|
import {APP_MENU_WILL_CLOSE, MAIN_WINDOW_CREATED} from 'common/communication';
|
||||||
import Config from 'common/config';
|
import Config from 'common/config';
|
||||||
import JsonFileManager from 'common/JsonFileManager';
|
import JsonFileManager from 'common/JsonFileManager';
|
||||||
import {Logger} from 'common/log';
|
import {Logger} from 'common/log';
|
||||||
@@ -38,8 +38,12 @@ const log = new Logger('App.Utils');
|
|||||||
|
|
||||||
export function openDeepLink(deeplinkingUrl: string) {
|
export function openDeepLink(deeplinkingUrl: string) {
|
||||||
try {
|
try {
|
||||||
|
if (MainWindow.get()) {
|
||||||
MainWindow.show();
|
MainWindow.show();
|
||||||
ViewManager.handleDeepLink(deeplinkingUrl);
|
ViewManager.handleDeepLink(deeplinkingUrl);
|
||||||
|
} else {
|
||||||
|
MainWindow.on(MAIN_WINDOW_CREATED, () => ViewManager.handleDeepLink(deeplinkingUrl));
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.error(`There was an error opening the deeplinking url: ${err}`);
|
log.error(`There was an error opening the deeplinking url: ${err}`);
|
||||||
}
|
}
|
||||||
|
@@ -92,9 +92,11 @@ export class ViewManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private init = () => {
|
private init = () => {
|
||||||
|
if (ServerManager.hasServers()) {
|
||||||
LoadingScreen.show();
|
LoadingScreen.show();
|
||||||
ServerManager.getAllServers().forEach((server) => this.loadServer(server));
|
ServerManager.getAllServers().forEach((server) => this.loadServer(server));
|
||||||
this.showInitial();
|
this.showInitial();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private handleDeveloperModeUpdated = (json: DeveloperSettings) => {
|
private handleDeveloperModeUpdated = (json: DeveloperSettings) => {
|
||||||
|
Reference in New Issue
Block a user