Skip to content

Commit

Permalink
Add electronAPI.isFirstTimeSetup (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Nov 10, 2024
1 parent 94ce295 commit aadf01d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ const electronAPI = {
extras,
});
},
/**
* Check if the user has completed the first time setup wizard.
*/
isFirstTimeSetup: (): Promise<boolean> => {
return ipcRenderer.invoke(IPC_CHANNELS.IS_FIRST_TIME_SETUP);
},
} as const;

export type ElectronAPI = typeof electronAPI;
Expand Down

0 comments on commit aadf01d

Please sign in to comment.