#36: Add ability to select Linux distribution type if OS is unsupported - partial

This commit is contained in:
2019-08-28 18:58:43 -05:00
parent 0671a39809
commit 0105602a44
11 changed files with 194 additions and 38 deletions

View File

@@ -4,9 +4,17 @@ import {getIPCRenderer} from '../../utils';
const ipcRenderer = getIPCRenderer();
export const displaySelectAppPlatform = createAction('common/displaySelectAppPlatform');
export const displaySelectAppPlatform = display => {
return dispatch => {
if (display) {
dispatch(showWindow());
}
dispatch(setDisplaySelectAppPlatform(display));
};
};
export const notifyRebootRequired = createAction('common/notifyRebootRequired');
export const setAllowMount = createAction('common/setAllowMount');
export const rebootSystem = () => {
return dispatch => {
@@ -17,7 +25,19 @@ export const rebootSystem = () => {
}
};
export const setAllowMount = createAction('common/setAllowMount');
export const setApplicationReady = createAction('common/setApplicationReady');
export const SET_DISPLAY_SELECT_APPPLATFORM = 'common/displaySelectAppPlatform';
export const setDisplaySelectAppPlatform = display => {
return {
type: SET_DISPLAY_SELECT_APPPLATFORM,
payload: display,
};
};
export const setLinuxAppPlatform = createAction('common/setLinuxAppPlatform');
export const setRebootRequired = () => {
return dispatch => {
dispatch(showWindow());

View File

@@ -3,6 +3,7 @@ import {createAction} from 'redux-starter-kit';
import {getIPCRenderer} from '../../utils';
import {notifyError} from './error_actions';
import {
installAndTestRelease,
installDependency,
installRelease,
installUpgrade
@@ -25,7 +26,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, isWinFSP) => {
export const downloadItem = (name, type, urls, isWinFSP, testVersion, appPlatform) => {
return (dispatch, getState) => {
if (!Array.isArray(urls)) {
urls = [urls];
@@ -40,6 +41,9 @@ export const downloadItem = (name, type, urls, isWinFSP) => {
case Constants.INSTALL_TYPES.Release:
dispatch(installRelease(result.Destination));
break;
case Constants.INSTALL_TYPES.TestRelease:
dispatch(installAndTestRelease(result.Destination, testVersion, appPlatform));
break;
case Constants.INSTALL_TYPES.Upgrade:
//const info = this.props.LocationsLookup[this.props.AppPlatform][this.props.VersionLookup[this.props.AppPlatform][0]];
const sha256 = null;//info.sha256;

View File

@@ -7,13 +7,16 @@ import {
import {notifyError} from './error_actions';
import {setAllowDownload} from './download_actions';
import {
loadReleases,
setActiveRelease,
setInstalledVersion,
setReleaseUpgradeAvailable
} from './release_version_actions';
import {
displaySelectAppPlatform,
setAllowMount,
setApplicationReady,
setLinuxAppPlatform,
setRebootRequired,
showWindow,
shutdownApplication
@@ -134,6 +137,42 @@ export const installDependency = (source, url, isWinFSP) => {
};
};
export const installAndTestRelease = (source, version, appPlatform) => {
return (dispatch, getState) => {
if (ipcRenderer && !getState().install.InstallTestActive) {
const extractReleaseComplete = (event, arg) => {
ipcRenderer.send(Constants.IPC_Delete_File, {
FilePath: source,
});
ipcRenderer.once(Constants.IPC_Test_Release_Reply, (event, arg) => {
if (arg.data.Success) {
ipcRenderer.sendSync(Constants.IPC_Set_Linux_AppPlatform, {
AppPlatform: appPlatform,
});
dispatch(setLinuxAppPlatform(appPlatform));
dispatch(setInstallTestActive(false));
dispatch(displaySelectAppPlatform(false));
dispatch(loadReleases());
} else {
dispatch(notifyError(arg.data.Error));
dispatch(setInstallTestActive(false));
}
});
ipcRenderer.send(Constants.IPC_Test_Release, {
Version: version,
})
};
ipcRenderer.once(Constants.IPC_Extract_Release_Complete, extractReleaseComplete);
ipcRenderer.send(Constants.IPC_Extract_Release, {
Source: source,
Version: version,
});
}
};
};
export const installRelease = source => {
return (dispatch, getState) => {
if (ipcRenderer && !getState().install.InstallActive) {
@@ -193,5 +232,6 @@ export const installUpgrade = (source, sha256, signature, skipVerification) => {
export const setDismissDependencies = createAction('install/setDismissDependencies');
export const setInstallActive = createAction('install/setInstallActive');
export const setInstallTestActive = createAction('install/setInstallTestActive');
export const setInstallComplete = createAction('install/setInstallComplete');
export const setMissingDependencies = createAction('install/setMissingDependencies');

View File

@@ -1,9 +1,10 @@
import {createReducer} from 'redux-starter-kit';
import {
displaySelectAppPlatform,
notifyRebootRequired,
setAllowMount,
setApplicationReady,
setLinuxAppPlatform,
SET_DISPLAY_SELECT_APPPLATFORM
} from '../actions/common_actions';
export const createCommonReducer = (platform, appPlatform, version) => {
@@ -16,7 +17,7 @@ export const createCommonReducer = (platform, appPlatform, version) => {
RebootRequired: false,
Version: version,
}, {
[displaySelectAppPlatform]: (state, action) => {
[SET_DISPLAY_SELECT_APPPLATFORM]: (state, action) => {
return {
...state,
DisplaySelectAppPlatform: action.payload,
@@ -34,6 +35,12 @@ export const createCommonReducer = (platform, appPlatform, version) => {
AppReady: action.payload,
};
},
[setLinuxAppPlatform]: (state, action) => {
return {
...state,
AppPlatform: action.payload,
}
},
[notifyRebootRequired]: (state, action) => {
return {
...state,

View File

@@ -3,6 +3,7 @@ import {
setDismissDependencies,
setInstallActive,
setInstallComplete,
setInstallTestActive,
setMissingDependencies
} from '../actions/install_actions';
@@ -10,6 +11,7 @@ export const installReducer = createReducer({
DismissDependencies: false,
InstallActive: false,
InstallResult: null,
InstallTestActive: false,
InstallType: null,
MissingDependencies: [],
}, {
@@ -35,6 +37,12 @@ export const installReducer = createReducer({
InstallType: null,
}
},
[setInstallTestActive]: (state, action) => {
return {
...state,
InstallTestActive: action.payload,
}
},
[setMissingDependencies]: (state, action) => {
return {
...state,