[partial] #30: Add uninstall feature with reboot to handle WinFSP upgrades/downgrades

This commit is contained in:
2019-08-13 14:06:50 -05:00
parent 9f45b0f03f
commit fa130c7dd1
10 changed files with 98 additions and 14 deletions

View File

@@ -4,7 +4,24 @@ import {getIPCRenderer} from '../../utils';
const ipcRenderer = getIPCRenderer();
export const notifyRebootRequired = createAction('common/notifyRebootRequired');
export const rebootSystem = () => {
return dispatch => {
dispatch(setApplicationReady(false));
if (ipcRenderer) {
ipcRenderer.send(Constants.IPC_Reboot_System);
}
}
};
export const setApplicationReady = createAction('common/setApplicationReady');
export const setRebootRequired = () => {
return dispatch => {
dispatch(showWindow());
dispatch(notifyRebootRequired(true));
};
};
export const showWindow = () => {
return dispatch => {

View File

@@ -25,7 +25,7 @@ export const setDownloadBegin = (name, type, url) => {
export const setDownloadEnd = createAction('download/setDownloadEnd');
export const setDownloadProgress = createAction('download/setDownloadProgress');
export const downloadItem = (name, type, urls) => {
export const downloadItem = (name, type, urls, isWinFSP) => {
return (dispatch, getState) => {
if (!Array.isArray(urls)) {
urls = [urls];
@@ -35,7 +35,7 @@ export const downloadItem = (name, type, urls) => {
if (result.Success) {
switch (type) {
case Constants.INSTALL_TYPES.Dependency:
dispatch(installDependency(result.Destination, result.URL));
dispatch(installDependency(result.Destination, result.URL, isWinFSP));
break;
case Constants.INSTALL_TYPES.Release:
dispatch(installRelease(result.Destination));

View File

@@ -13,6 +13,7 @@ import {
} from './release_version_actions';
import {
setApplicationReady,
setRebootRequired,
showWindow,
shutdownApplication
} from './common_actions';
@@ -81,7 +82,7 @@ export const checkVersionInstalled = () => {
};
};
export const installDependency = (source, url) => {
export const installDependency = (source, url, isWinFSP) => {
return (dispatch, getState) => {
if (ipcRenderer && !getState().install.InstallActive) {
dispatch(setInstallActive(Constants.INSTALL_TYPES.Dependency));
@@ -89,11 +90,15 @@ export const installDependency = (source, url) => {
const installDependencyComplete = (event, arg) => {
const result = arg.data;
const handleCompleted = ()=> {
ipcRenderer.send(Constants.IPC_Delete_File, {
FilePath: source,
});
dispatch(setInstallComplete(result));
dispatch(checkVersionInstalled());
if (result.RebootRequired) {
dispatch(setRebootRequired());
} else {
ipcRenderer.send(Constants.IPC_Delete_File, {
FilePath: source,
});
dispatch(setInstallComplete(result));
dispatch(checkVersionInstalled());
}
};
if (result.Success && source.toLowerCase().endsWith('.dmg')) {
@@ -121,6 +126,7 @@ export const installDependency = (source, url) => {
ipcRenderer.send(Constants.IPC_Install_Dependency, {
Source: source,
URL: url,
IsWinFSP: isWinFSP,
});
}
};