MM-25003_Improve Onboarding screens for the desktop app - Intro Screen (#2220)

This commit is contained in:
Julian Mondragón
2022-08-16 12:33:03 -05:00
committed by GitHub
parent d4282d965e
commit faf2dae74b
50 changed files with 1815 additions and 42 deletions

View File

@@ -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);