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

@ -170,6 +170,7 @@ jobs:
path: |
apps/desktop/out/make/squirrel.windows/${{ matrix.arch }}/*.exe
apps/desktop/out/make/squirrel.windows/${{ matrix.arch }}/*.nupkg
apps/desktop/out/make/squirrel.windows/${{ matrix.arch }}/RELEASES
release:
name: Create Release
@ -241,5 +242,6 @@ jobs:
artifacts/macos-x64/zip/darwin/x64/*.zip
artifacts/windows-x64/*.exe
artifacts/windows-x64/*.nupkg
artifacts/windows-x64/RELEASES
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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();