From aadf01da95a8d3ac6a6e8e434580f854cb011980 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Sat, 9 Nov 2024 21:27:51 -0500 Subject: [PATCH] Add electronAPI.isFirstTimeSetup (#215) --- src/constants.ts | 1 + src/main.ts | 4 +++- src/preload.ts | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index ccdddce7..ba91043f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -24,6 +24,7 @@ export const IPC_CHANNELS = { OPEN_LOGS_PATH: 'open-logs-path', OPEN_DEV_TOOLS: 'open-dev-tools', OPEN_FORUM: 'open-forum', + IS_FIRST_TIME_SETUP: 'is-first-time-setup', } as const; export enum ProgressStatus { diff --git a/src/main.ts b/src/main.ts index 394ea9aa..95ca2762 100644 --- a/src/main.ts +++ b/src/main.ts @@ -160,7 +160,9 @@ if (!gotTheLock) { ipcMain.on(IPC_CHANNELS.OPEN_DEV_TOOLS, () => { appWindow.openDevTools(); }); - + ipcMain.handle(IPC_CHANNELS.IS_FIRST_TIME_SETUP, () => { + return isFirstTimeSetup(); + }); await handleFirstTimeSetup(); const basePath = await getBasePath(); const pythonInstallPath = await getPythonInstallPath(); diff --git a/src/preload.ts b/src/preload.ts index b900f0c2..b1ca8f62 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -141,6 +141,12 @@ const electronAPI = { extras, }); }, + /** + * Check if the user has completed the first time setup wizard. + */ + isFirstTimeSetup: (): Promise => { + return ipcRenderer.invoke(IPC_CHANNELS.IS_FIRST_TIME_SETUP); + }, } as const; export type ElectronAPI = typeof electronAPI;