feat: trigger welcome modal from electron

This commit is contained in:
Carlos Valente
2024-11-23 21:57:22 +01:00
committed by Carlos Valente
parent 22fe65c655
commit b4eabfae72
3 changed files with 29 additions and 7 deletions
+11 -3
View File
@@ -114,13 +114,21 @@ function escalateError(error) {
}
/**
* Allows electron to ask react app redirect
* @param string location
* Allows electron to ask the react app to redirect
* @param {string} location
*/
function redirectWindow(location) {
win.webContents.send('request-editor-location', location);
}
/**
* Asks the react app to show a user dialog
* @param {string} name
*/
function showDialog(name) {
win.webContents.send('dialog', name);
}
// Ensure there isn't another instance of the app running already
const lock = app.requestSingleInstanceLock();
if (!lock) {
@@ -190,7 +198,7 @@ app.whenReady().then(() => {
.then((port) => {
const clientUrl = getClientUrl(port);
const serverUrl = getServerUrl(port);
const menu = getApplicationMenu(askToQuit, clientUrl, serverUrl, redirectWindow, (url) =>
const menu = getApplicationMenu(askToQuit, clientUrl, serverUrl, redirectWindow, showDialog, (url) =>
win.webContents.downloadURL(url),
);
Menu.setApplicationMenu(menu);