#28: Fix Linux upgrade
This commit is contained in:
@@ -29,14 +29,22 @@ let launchHidden = false;
|
||||
let firstMountCheck = true;
|
||||
let manualMountDetection = {};
|
||||
|
||||
let isShutdown = false;
|
||||
let isQuiting = false;
|
||||
let isInstalling = false;
|
||||
|
||||
app.on('before-quit', function () {
|
||||
isQuiting = true;
|
||||
});
|
||||
|
||||
function closeApplication() {
|
||||
app.quit();
|
||||
if (!isShutdown) {
|
||||
isShutdown = true;
|
||||
if (mainWindowTray) {
|
||||
mainWindowTray.destroy();
|
||||
}
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
|
||||
function setWindowVisibility(show) {
|
||||
@@ -187,12 +195,10 @@ function createWindow() {
|
||||
mainWindow.loadURL(startUrl);
|
||||
}
|
||||
|
||||
const instanceLock = app.requestSingleInstanceLock();
|
||||
if (!instanceLock) {
|
||||
closeApplication();
|
||||
} else {
|
||||
let instanceLock = app.requestSingleInstanceLock();
|
||||
const configurePrimaryApp = () => {
|
||||
app.on('second-instance', () => {
|
||||
if (mainWindow) {
|
||||
if (!isInstalling && mainWindow) {
|
||||
setWindowVisibility(true);
|
||||
}
|
||||
});
|
||||
@@ -202,6 +208,17 @@ if (!instanceLock) {
|
||||
app.on('window-all-closed', () => {
|
||||
closeApplication();
|
||||
});
|
||||
};
|
||||
if (!instanceLock) {
|
||||
setTimeout(() => {
|
||||
if ((instanceLock = app.requestSingleInstanceLock())) {
|
||||
configurePrimaryApp();
|
||||
} else {
|
||||
closeApplication();
|
||||
}
|
||||
}, 3000);
|
||||
} else {
|
||||
configurePrimaryApp();
|
||||
}
|
||||
|
||||
const clearManualMountDetection = (provider) => {
|
||||
@@ -757,6 +774,7 @@ ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
|
||||
|
||||
if (command) {
|
||||
const executeInstall = () => {
|
||||
isInstalling = true;
|
||||
helpers
|
||||
.executeAsync(command, args)
|
||||
.then(() => {
|
||||
@@ -764,6 +782,7 @@ ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
|
||||
standardIPCReply(event, Constants.IPC_Install_Upgrade_Reply)
|
||||
})
|
||||
.catch(error => {
|
||||
isInstalling = false;
|
||||
errorHandler(error);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user