From 1f3b5fc639e7122c323b9638c12367a786ea44da Mon Sep 17 00:00:00 2001 From: huchenlei Date: Sat, 9 Nov 2024 19:12:02 -0500 Subject: [PATCH] Add electronAPI.isFirstTimeSetup --- src/constants.ts | 1 + src/main.ts | 3 +++ src/preload.ts | 6 ++++++ 3 files changed, 10 insertions(+) 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 bf5d8420..85a440ca 100644 --- a/src/main.ts +++ b/src/main.ts @@ -179,6 +179,9 @@ if (!gotTheLock) { ipcMain.handle(IPC_CHANNELS.IS_PACKAGED, () => { return app.isPackaged; }); + 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;