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:
+12
-10
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user