From 12ad8786188b4288f516a3c12a5608af76e3426a Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Fri, 21 Feb 2020 16:38:52 -0600 Subject: [PATCH] Unmount before install --- src/redux/actions/install_actions.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/redux/actions/install_actions.js b/src/redux/actions/install_actions.js index 5b28fff..48700c9 100644 --- a/src/redux/actions/install_actions.js +++ b/src/redux/actions/install_actions.js @@ -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(); } }; };