MM-25003_Improve Onboarding screens for the desktop app - Intro Screen (#2220)
This commit is contained in:
@@ -85,15 +85,26 @@ export function handleOpenTab(event: IpcMainEvent, serverName: string, tabName:
|
||||
Config.set('teams', teams);
|
||||
}
|
||||
|
||||
export function addNewServerModalWhenMainWindowIsShown() {
|
||||
export function handleMainWindowIsShown() {
|
||||
const showWelcomeScreen = !Config.teams.length;
|
||||
const mainWindow = WindowManager.getMainWindow();
|
||||
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isVisible()) {
|
||||
handleNewServerModal();
|
||||
if (showWelcomeScreen) {
|
||||
handleWelcomeScreenModal();
|
||||
} else {
|
||||
handleNewServerModal();
|
||||
}
|
||||
} else {
|
||||
mainWindow.once('show', () => {
|
||||
log.debug('Intercom.addNewServerModalWhenMainWindowIsShown.show');
|
||||
handleNewServerModal();
|
||||
if (showWelcomeScreen) {
|
||||
log.debug('Intercom.handleMainWindowIsShown.show.welcomeScreenModal');
|
||||
handleWelcomeScreenModal();
|
||||
} else {
|
||||
log.debug('Intercom.handleMainWindowIsShown.show.newServerModal');
|
||||
handleNewServerModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -213,6 +224,32 @@ export function handleRemoveServerModal(e: IpcMainEvent, name: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export function handleWelcomeScreenModal() {
|
||||
log.debug('Intercom.handleWelcomeScreenModal');
|
||||
|
||||
const html = getLocalURLString('welcomeScreen.html');
|
||||
|
||||
const modalPreload = getLocalPreload('modalPreload.js');
|
||||
|
||||
const mainWindow = WindowManager.getMainWindow();
|
||||
if (!mainWindow) {
|
||||
return;
|
||||
}
|
||||
const modalPromise = ModalManager.addModal('welcomeScreen', html, modalPreload, {}, mainWindow, true);
|
||||
if (modalPromise) {
|
||||
modalPromise.then(() => {
|
||||
handleNewServerModal();
|
||||
}).catch((e) => {
|
||||
// e is undefined for user cancellation
|
||||
if (e) {
|
||||
log.error(`there was an error in the welcome screen modal: ${e}`);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
log.warn('There is already a welcome screen modal');
|
||||
}
|
||||
}
|
||||
|
||||
export function handleMentionNotification(event: IpcMainEvent, title: string, body: string, channel: {id: string}, teamId: string, url: string, silent: boolean, data: MentionData) {
|
||||
log.debug('Intercom.handleMentionNotification', {title, body, channel, teamId, url, silent, data});
|
||||
displayMention(title, body, channel, teamId, url, silent, event.sender, data);
|
||||
|
Reference in New Issue
Block a user