Attempt to resolve auto update issues.
This commit is contained in:
@@ -22,6 +22,7 @@ import ipcTypes from "../util/ipcTypes.json";
|
||||
import ImportJob from "./decoder/decoder";
|
||||
import LocalServer from "./http-server/http-server";
|
||||
import store from "./store/store";
|
||||
import { getMainWindow } from "./util/toRenderer";
|
||||
import { GetAllEnvFiles } from "./watcher/watcher";
|
||||
|
||||
Sentry.init({
|
||||
@@ -373,17 +374,17 @@ app.whenReady().then(async () => {
|
||||
//Check for app updates.
|
||||
autoUpdater.logger = log;
|
||||
|
||||
// if (import.meta.env.DEV) {
|
||||
// // Useful for some dev/debugging tasks, but download can
|
||||
// // not be validated becuase dev app is not signed
|
||||
// autoUpdater.channel = "alpha";
|
||||
// autoUpdater.updateConfigPath = path.join(
|
||||
// __dirname,
|
||||
// "../../dev-app-update.yml",
|
||||
// );
|
||||
// autoUpdater.forceDevUpdateConfig = true;
|
||||
// //autoUpdater.autoDownload = false;
|
||||
// }
|
||||
if (import.meta.env.DEV) {
|
||||
// Useful for some dev/debugging tasks, but download can
|
||||
// not be validated becuase dev app is not signed
|
||||
autoUpdater.channel = "alpha";
|
||||
autoUpdater.updateConfigPath = path.join(
|
||||
__dirname,
|
||||
"../../dev-app-update.yml",
|
||||
);
|
||||
autoUpdater.forceDevUpdateConfig = true;
|
||||
//autoUpdater.autoDownload = false;
|
||||
}
|
||||
|
||||
autoUpdater.on("checking-for-update", () => {
|
||||
log.info("Checking for update...");
|
||||
@@ -439,7 +440,8 @@ app.on("window-all-closed", () => {
|
||||
}
|
||||
});
|
||||
|
||||
app.on("before-quit", () => {
|
||||
app.on("before-quit", (props) => {
|
||||
console.log(props);
|
||||
preQuitMethods();
|
||||
});
|
||||
|
||||
@@ -447,14 +449,17 @@ app.on("before-quit", () => {
|
||||
ipcMain.on(ipcTypes.toMain.updates.apply, () => {
|
||||
log.info("Applying update from renderer.");
|
||||
preQuitMethods();
|
||||
autoUpdater.quitAndInstall();
|
||||
setImmediate(() => {
|
||||
app.removeAllListeners("window-all-closed");
|
||||
const mainWindow = getMainWindow();
|
||||
if (mainWindow) mainWindow.close();
|
||||
autoUpdater.quitAndInstall(false);
|
||||
});
|
||||
});
|
||||
|
||||
function preQuitMethods(): void {
|
||||
localServer.stop();
|
||||
const currentSetting = store.get("app.openOnStartup") as boolean;
|
||||
store.set("app.openOnStartup", !currentSetting);
|
||||
log.info("Open on startup set to", !currentSetting);
|
||||
if (!import.meta.env.DEV) {
|
||||
app.setLoginItemSettings({
|
||||
enabled: true, //This is a windows only command. Updates the task manager and registry.
|
||||
|
||||
Reference in New Issue
Block a user