- Implement electron-updater integration with IPC handlers for update operations - Add Pinia store for managing update state and user preferences - Create settings UI with version display, update controls, and auto-update toggles - Update IPC constants and preload API for update-related communication - Refactor preload invoke methods to use async IPC consistently - Add rounded corners to settings page layout for better visual consistency
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import { app, BrowserWindow } from 'electron'
|
||
import { CONFIG_KEYS } from '@lib/constants'
|
||
import { setupMainWindow } from './wins';
|
||
import started from 'electron-squirrel-startup'
|
||
import configManager from '@electron/service/config-service'
|
||
import { runTaskOperationService } from '@electron/process/runTaskOperationService'
|
||
import log from 'electron-log';
|
||
import 'bytenode'; // Ensure bytenode is bundled/externalized correctly
|
||
import { appUpdater } from '@electron/service/updater';
|
||
|
||
// 初始化 updater,确保在 app ready 之前或者之中注册好 IPC
|
||
appUpdater.init();
|
||
|
||
// import logManager from '@electron/service/logger'
|
||
|
||
|
||
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
|
||
if (started) {
|
||
app.quit();
|
||
}
|
||
|
||
// process.on('uncaughtException', (err) => {
|
||
// logManager.error('uncaughtException', err);
|
||
// });
|
||
|
||
// process.on('unhandledRejection', (reason, promise) => {
|
||
// logManager.error('unhandledRejection', reason, promise);
|
||
// });
|
||
|
||
app.whenReady().then(() => {
|
||
setupMainWindow();
|
||
|
||
// 开启任务操作子进程
|
||
runTaskOperationService()
|
||
|
||
// 开启subagent子进程
|
||
});
|
||
|
||
// Quit when all windows are closed, except on macOS. There, it's common
|
||
// for applications and their menu bar to stay active until the user quits
|
||
// explicitly with Cmd + Q.
|
||
app.on('window-all-closed', () => {
|
||
if (process.platform !== 'darwin' && !configManager.get(CONFIG_KEYS.MINIMIZE_TO_TRAY)) {
|
||
log.info('app closing due to all windows being closed');
|
||
app.quit();
|
||
}
|
||
});
|
||
|
||
// On OS X it's common to re-create a window in the app when the
|
||
// dock icon is clicked and there are no other windows open.
|
||
app.on('activate', () => {
|
||
if (BrowserWindow.getAllWindows().length === 0) {
|
||
setupMainWindow();
|
||
}
|
||
});
|