fix: firstLaunch = false after initial setup (#131)

fix: don't re-enable abutostart

Signed-off-by: Mihai <cristian@mihaimuresan.com>
Co-authored-by: Mihai <cristian@mihaimuresan.com>
This commit is contained in:
Mihai
2026-02-18 04:33:46 +01:00
committed by GitHub
parent 58ccb63d23
commit 63b9ea818a
+12 -10
View File
@@ -1,6 +1,6 @@
import { IUpdateInfo, updateElectronApp } from "update-electron-app";
import { BrowserWindow, app, shell, Notification } from "electron";
import { BrowserWindow, Notification, app, shell } from "electron";
import started from "electron-squirrel-startup";
import { autoLaunch } from "./native/autoLaunch";
@@ -26,29 +26,31 @@ const acquiredLock = app.requestSingleInstanceLock();
const onNotifyUser = (_info: IUpdateInfo) => {
const notification = new Notification({
title: 'Update Available',
body: 'Restart the app to install the update.',
silent: true
})
title: "Update Available",
body: "Restart the app to install the update.",
silent: true,
});
notification.show()
}
notification.show();
};
if (acquiredLock) {
// start auto update logic
updateElectronApp({onNotifyUser})
updateElectronApp({ onNotifyUser });
// create and configure the app when electron is ready
app.on("ready", () => {
// create window and application contexts
createMainWindow();
// enable auto start on Windows and MacOS
if (config.firstLaunch) {
if (process.platform === "win32" || process.platform === "darwin") {
autoLaunch.enable();
}
config.firstLaunch = false;
}
// create window and application contexts
createMainWindow();
initTray();
initDiscordRpc();