Fix upgrades

This commit is contained in:
Scott E. Graves
2019-07-02 21:13:56 -05:00
parent 37ce52df75
commit c632c2eaaa
3 changed files with 26 additions and 14 deletions

View File

@@ -8,6 +8,10 @@ import {
setInstalledVersion,
setReleaseUpgradeAvailable
} from './release_version_actions';
import {
setApplicationReady,
shutdownApplication
} from './common_actions';
const ipcRenderer = getIPCRenderer();
@@ -126,16 +130,18 @@ export const installRelease = (source, version, completedCallback) => {
export const installUpgrade = (source, sha256, signature, skipVerification, completedCallback) => {
return (dispatch, getState) => {
if (ipcRenderer && !getState().install.InstallActive) {
dispatch(setInstallActive(Constants.INSTALL_TYPES.Dependency));
dispatch(setInstallActive(Constants.INSTALL_TYPES.Upgrade));
dispatch(setApplicationReady(false));
const installUpgradeComplete = (event, arg) => {
ipcRenderer.removeListener(Constants.IPC_Install_Upgrade_Reply, installUpgradeComplete);
ipcRenderer.send(Constants.IPC_Delete_File, {
FilePath: source,
});
dispatch(setInstallComplete(arg.data));
completedCallback(source, arg.data);
if (arg.data.Success) {
dispatch(shutdownApplication());
} else {
dispatch(setApplicationReady(true));
dispatch(setInstallComplete(arg.data));
completedCallback(source, arg.data);
}
};
ipcRenderer.on(Constants.IPC_Install_Upgrade_Reply, installUpgradeComplete);