Unmount before install

This commit is contained in:
2020-02-21 16:38:52 -06:00
parent 39409495c4
commit 12ad878618

View File

@@ -13,6 +13,7 @@ import {
setReleaseUpgradeAvailable
} from './release_version_actions';
import {
confirmYesNo,
displaySelectAppPlatform,
setAllowMount,
setApplicationReady,
@@ -21,6 +22,7 @@ import {
showWindow,
shutdownApplication
} from './common_actions';
import {unmountAll} from './mount_actions';
const ipcRenderer = getIPCRenderer();
@@ -188,18 +190,25 @@ export const installAndTestRelease = (source, version, appPlatform) => {
export const installReleaseByVersion = (release, version) => {
return (dispatch, getState) => {
let allowInstall = !getState().mounts.MountsBusy;
if (!allowInstall) {
// TODO: prompt to unmount
}
if (allowInstall) {
const install = () => {
if (getState().download.AllowDownload && !getState().download.DownloadActive) {
dispatch(setAutoInstallRelease(true));
dispatch(setActiveRelease(release, version));
} else {
notifyError('Download is active. Unable to install release.');
}
};
if (getState().mounts.MountsBusy) {
dispatch(confirmYesNo('Unmount all drives?'))
.then(confirmed => {
if (confirmed) {
dispatch(unmountAll(install));
}
})
.catch(error => notifyError(error));
} else {
install();
}
};
};