feat: add permission onboarding page and startup routing for macOS

This commit is contained in:
CREDO23 2026-04-02 13:44:57 +02:00
parent ec2b7851b6
commit eaabad38fc
7 changed files with 228 additions and 7 deletions

View file

@ -31,8 +31,8 @@ export function registerIpcHandlers(): void {
requestAccessibility();
});
ipcMain.handle(IPC_CHANNELS.REQUEST_INPUT_MONITORING, () => {
requestInputMonitoring();
ipcMain.handle(IPC_CHANNELS.REQUEST_INPUT_MONITORING, async () => {
return await requestInputMonitoring();
});
ipcMain.handle(IPC_CHANNELS.RESTART_APP, () => {

View file

@ -7,6 +7,7 @@ import { setupAutoUpdater } from './modules/auto-updater';
import { setupMenu } from './modules/menu';
import { registerQuickAsk, unregisterQuickAsk } from './modules/quick-ask';
import { registerIpcHandlers } from './ipc/handlers';
import { allPermissionsGranted } from './modules/permissions';
registerGlobalErrorHandlers();
@ -16,7 +17,13 @@ if (!setupDeepLinks()) {
registerIpcHandlers();
// App lifecycle
function getInitialPath(): string {
if (process.platform === 'darwin' && !allPermissionsGranted()) {
return '/desktop/permissions';
}
return '/dashboard';
}
app.whenReady().then(async () => {
setupMenu();
try {
@ -26,7 +33,9 @@ app.whenReady().then(async () => {
setTimeout(() => app.quit(), 0);
return;
}
createMainWindow();
const initialPath = getInitialPath();
createMainWindow(initialPath);
registerQuickAsk();
setupAutoUpdater();
@ -34,7 +43,7 @@ app.whenReady().then(async () => {
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createMainWindow();
createMainWindow(getInitialPath());
}
});
});

View file

@ -12,7 +12,7 @@ export function getMainWindow(): BrowserWindow | null {
return mainWindow;
}
export function createMainWindow(): BrowserWindow {
export function createMainWindow(initialPath = '/dashboard'): BrowserWindow {
mainWindow = new BrowserWindow({
width: 1280,
height: 800,
@ -33,7 +33,7 @@ export function createMainWindow(): BrowserWindow {
mainWindow?.show();
});
mainWindow.loadURL(`http://localhost:${getServerPort()}/dashboard`);
mainWindow.loadURL(`http://localhost:${getServerPort()}${initialPath}`);
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
if (url.startsWith('http://localhost')) {