#28: Fix Linux upgrade
This commit is contained in:
@@ -29,14 +29,22 @@ let launchHidden = false;
|
|||||||
let firstMountCheck = true;
|
let firstMountCheck = true;
|
||||||
let manualMountDetection = {};
|
let manualMountDetection = {};
|
||||||
|
|
||||||
|
let isShutdown = false;
|
||||||
let isQuiting = false;
|
let isQuiting = false;
|
||||||
|
let isInstalling = false;
|
||||||
|
|
||||||
app.on('before-quit', function () {
|
app.on('before-quit', function () {
|
||||||
isQuiting = true;
|
isQuiting = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
function closeApplication() {
|
function closeApplication() {
|
||||||
|
if (!isShutdown) {
|
||||||
|
isShutdown = true;
|
||||||
|
if (mainWindowTray) {
|
||||||
|
mainWindowTray.destroy();
|
||||||
|
}
|
||||||
app.quit();
|
app.quit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWindowVisibility(show) {
|
function setWindowVisibility(show) {
|
||||||
@@ -187,12 +195,10 @@ function createWindow() {
|
|||||||
mainWindow.loadURL(startUrl);
|
mainWindow.loadURL(startUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
const instanceLock = app.requestSingleInstanceLock();
|
let instanceLock = app.requestSingleInstanceLock();
|
||||||
if (!instanceLock) {
|
const configurePrimaryApp = () => {
|
||||||
closeApplication();
|
|
||||||
} else {
|
|
||||||
app.on('second-instance', () => {
|
app.on('second-instance', () => {
|
||||||
if (mainWindow) {
|
if (!isInstalling && mainWindow) {
|
||||||
setWindowVisibility(true);
|
setWindowVisibility(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -202,6 +208,17 @@ if (!instanceLock) {
|
|||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
closeApplication();
|
closeApplication();
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
if (!instanceLock) {
|
||||||
|
setTimeout(() => {
|
||||||
|
if ((instanceLock = app.requestSingleInstanceLock())) {
|
||||||
|
configurePrimaryApp();
|
||||||
|
} else {
|
||||||
|
closeApplication();
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
} else {
|
||||||
|
configurePrimaryApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
const clearManualMountDetection = (provider) => {
|
const clearManualMountDetection = (provider) => {
|
||||||
@@ -757,6 +774,7 @@ ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
|
|||||||
|
|
||||||
if (command) {
|
if (command) {
|
||||||
const executeInstall = () => {
|
const executeInstall = () => {
|
||||||
|
isInstalling = true;
|
||||||
helpers
|
helpers
|
||||||
.executeAsync(command, args)
|
.executeAsync(command, args)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -764,6 +782,7 @@ ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
|
|||||||
standardIPCReply(event, Constants.IPC_Install_Upgrade_Reply)
|
standardIPCReply(event, Constants.IPC_Install_Upgrade_Reply)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
isInstalling = false;
|
||||||
errorHandler(error);
|
errorHandler(error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ const mapStateToProps = state => {
|
|||||||
return {
|
return {
|
||||||
DownloadName: state.download.DownloadName,
|
DownloadName: state.download.DownloadName,
|
||||||
DownloadProgress: state.download.DownloadProgress,
|
DownloadProgress: state.download.DownloadProgress,
|
||||||
|
Platform: state.common.Platform,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps)(props => {
|
export default connect(mapStateToProps)(props => {
|
||||||
|
const width = props.Platform === 'linux' ? '480px' : '380px';
|
||||||
return (
|
return (
|
||||||
<Box dxStyle={{width: '380px', height: 'auto', padding: '5px'}}>
|
<Box dxStyle={{width: width, height: 'auto', padding: '5px'}}>
|
||||||
<div style={{width: '100%', height: 'auto'}}>
|
<div style={{width: '100%', height: 'auto'}}>
|
||||||
<h1 style={{width: '100%', textAlign: 'center'}}>{'Downloading ' + props.DownloadName}</h1>
|
<h1 style={{width: '100%', textAlign: 'center'}}>{'Downloading ' + props.DownloadName}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user