Fix the issue where we sometimes need to wait for GPO teams properly (#2621)

This commit is contained in:
Devin Binnie
2023-03-20 16:24:07 -04:00
committed by GitHub
parent a4444bda1e
commit c85a4497b6
5 changed files with 31 additions and 42 deletions

View File

@@ -4,11 +4,10 @@
import {app, dialog, IpcMainEvent, IpcMainInvokeEvent, Menu} from 'electron';
import log from 'electron-log';
import {Team, TeamWithIndex, RegistryConfig as RegistryConfigType} from 'types/config';
import {Team, TeamWithIndex} from 'types/config';
import {MentionData} from 'types/notification';
import Config from 'common/config';
import {REGISTRY_READ_EVENT} from 'common/config/RegistryConfig';
import {getDefaultTeamWithTabsFromTeam} from 'common/tabs/TabView';
import {ping} from 'common/utils/requests';
@@ -89,36 +88,24 @@ export function handleOpenTab(event: IpcMainEvent, serverName: string, tabName:
export function handleShowOnboardingScreens(showWelcomeScreen: boolean, showNewServerModal: boolean, mainWindowIsVisible: boolean) {
log.debug('Intercom.handleShowOnboardingScreens', {showWelcomeScreen, showNewServerModal, mainWindowIsVisible});
const showWelcomeScreenFunc = () => {
if (showWelcomeScreen) {
handleWelcomeScreenModal();
if (showWelcomeScreen) {
handleWelcomeScreenModal();
if (process.env.NODE_ENV === 'test') {
const welcomeScreen = ModalManager.modalQueue.find((modal) => modal.key === 'welcomeScreen');
if (welcomeScreen?.view.webContents.isLoading()) {
welcomeScreen?.view.webContents.once('did-finish-load', () => {
app.emit('e2e-app-loaded');
});
} else {
if (process.env.NODE_ENV === 'test') {
const welcomeScreen = ModalManager.modalQueue.find((modal) => modal.key === 'welcomeScreen');
if (welcomeScreen?.view.webContents.isLoading()) {
welcomeScreen?.view.webContents.once('did-finish-load', () => {
app.emit('e2e-app-loaded');
}
});
} else {
app.emit('e2e-app-loaded');
}
return;
}
if (showNewServerModal) {
handleNewServerModal();
}
};
if (process.platform === 'win32' && !Config.registryConfigData) {
Config.registryConfig.once(REGISTRY_READ_EVENT, (data: Partial<RegistryConfigType>) => {
if (data.teams?.length === 0) {
showWelcomeScreenFunc();
}
});
} else {
showWelcomeScreenFunc();
return;
}
if (showNewServerModal) {
handleNewServerModal();
}
}