fix: auto update on windows

This commit is contained in:
haritabh-z01 2025-09-25 17:41:47 +05:30
parent 97bd60135e
commit 0e25ddda01
2 changed files with 19 additions and 1 deletions

View file

@ -6,11 +6,17 @@ import { app } from "electron";
import started from "electron-squirrel-startup";
import { AppManager } from "./core/app-manager";
import { updateElectronApp } from "update-electron-app";
import { isWindows } from "../utils/platform";
if (started) {
app.quit();
}
// Set App User Model ID for Windows (required for Squirrel.Windows)
if (isWindows()) {
app.setAppUserModelId("com.amical.desktop");
}
// Enforce single instance
const gotTheLock = app.requestSingleInstanceLock();
@ -20,9 +26,19 @@ if (!gotTheLock) {
}
// Set up auto-updater for production builds
if (app.isPackaged) {
if (app.isPackaged && !isWindows()) {
updateElectronApp();
}
if (app.isPackaged && isWindows()) {
// Check if running with --squirrel-firstrun (Windows only)
const isSquirrelFirstRun = process.argv.includes("--squirrel-firstrun");
// Delay update check on Windows to avoid Squirrel file lock issues
if (isWindows() && !isSquirrelFirstRun) {
setTimeout(() => {
updateElectronApp();
}, 60000); // 60 second delay
}
}
const appManager = new AppManager();