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 { 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 started from "electron-squirrel-startup";
|
||||||
|
|
||||||
import { autoLaunch } from "./native/autoLaunch";
|
import { autoLaunch } from "./native/autoLaunch";
|
||||||
@@ -26,29 +26,31 @@ const acquiredLock = app.requestSingleInstanceLock();
|
|||||||
|
|
||||||
const onNotifyUser = (_info: IUpdateInfo) => {
|
const onNotifyUser = (_info: IUpdateInfo) => {
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
title: 'Update Available',
|
title: "Update Available",
|
||||||
body: 'Restart the app to install the update.',
|
body: "Restart the app to install the update.",
|
||||||
silent: true
|
silent: true,
|
||||||
})
|
});
|
||||||
|
|
||||||
notification.show()
|
notification.show();
|
||||||
}
|
};
|
||||||
|
|
||||||
if (acquiredLock) {
|
if (acquiredLock) {
|
||||||
// start auto update logic
|
// start auto update logic
|
||||||
updateElectronApp({onNotifyUser})
|
updateElectronApp({ onNotifyUser });
|
||||||
|
|
||||||
// create and configure the app when electron is ready
|
// create and configure the app when electron is ready
|
||||||
app.on("ready", () => {
|
app.on("ready", () => {
|
||||||
|
// create window and application contexts
|
||||||
|
createMainWindow();
|
||||||
|
|
||||||
// enable auto start on Windows and MacOS
|
// enable auto start on Windows and MacOS
|
||||||
if (config.firstLaunch) {
|
if (config.firstLaunch) {
|
||||||
if (process.platform === "win32" || process.platform === "darwin") {
|
if (process.platform === "win32" || process.platform === "darwin") {
|
||||||
autoLaunch.enable();
|
autoLaunch.enable();
|
||||||
}
|
}
|
||||||
|
config.firstLaunch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create window and application contexts
|
|
||||||
createMainWindow();
|
|
||||||
initTray();
|
initTray();
|
||||||
initDiscordRpc();
|
initDiscordRpc();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user