SiaPrime support

This commit is contained in:
Scott E. Graves
2018-11-03 12:29:31 -05:00
parent d8c5c769fd
commit 21b50d48b5
3 changed files with 104 additions and 25 deletions

View File

@@ -80,6 +80,10 @@ class App extends Component {
AutoMount: false,
MountLocation: '',
},
SiaPrime: {
AutoMount: false,
MountLocation: '',
},
UpgradeAvailable: false,
UpgradeData: {},
UpgradeDismissed: false,
@@ -168,11 +172,15 @@ class App extends Component {
...this.state.Sia
};
let siaPrime = {
...this.state.SiaPrime
};
let hyperspace = {
...this.state.Hyperspace
};
this.saveState(this.state.Release, this.state.Version, sia, hyperspace);
this.saveState(this.state.Release, this.state.Version, sia, hyperspace, siaPrime);
if (storageType === 'Hyperspace') {
hyperspace.AutoMount = e.target.checked;
@@ -184,6 +192,11 @@ class App extends Component {
this.setState({
Sia: sia,
});
} else if (storageType === 'SiaPrime') {
siaPrime.AutoMount = e.target.checked;
this.setState({
SiaPrime: siaPrime,
});
}
};
@@ -230,8 +243,11 @@ class App extends Component {
const sia = storageType === 'Sia' ? state : {
...this.state.Sia,
};
const siaPrime = storageType === 'SiaPrime' ? state : {
...this.state.SiaPrime,
};
this.saveState(this.state.Release, this.state.Version, sia, hyperspace);
this.saveState(this.state.Release, this.state.Version, sia, hyperspace, siaPrime);
this.setState({
[storageType]: state,
});
@@ -240,7 +256,7 @@ class App extends Component {
handleReleaseChanged = (e) => {
const val = parseInt(e.target.value, 10);
const versionIndex = this.state.VersionLookup[this.state.ReleaseTypes[val]].length - 1;
this.saveState(val, versionIndex, this.state.Sia, this.state.Hyperspace);
this.saveState(val, versionIndex, this.state.Sia, this.state.Hyperspace, this.state.SiaPrime);
this.setState({
Release: val,
Version: versionIndex
@@ -287,7 +303,7 @@ class App extends Component {
handleVersionChanged = (e) => {
const val = parseInt(e.target.value, 10);
this.saveState(this.state.Release, val, this.state.Sia, this.state.Hyperspace);
this.saveState(this.state.Release, val, this.state.Sia, this.state.Hyperspace, this.state.SiaPrime);
this.setState({
Version: val
}, ()=> {
@@ -406,16 +422,26 @@ class App extends Component {
onGetStateReply = (event, arg) => {
if (arg.data) {
if (arg.data.Hyperspace.AutoMount === undefined) {
arg.data.Hyperspace['AutoMount'] = false;
let hyperspace = arg.data.Hyperspace || this.state.Hyperspace;
if (hyperspace.AutoMount === undefined) {
hyperspace['AutoMount'] = false;
}
if (arg.data.Sia.AutoMount === undefined) {
arg.data.Sia['AutoMount'] = false;
let sia = arg.data.Sia || this.state.Sia;
if (sia.AutoMount === undefined) {
sia['AutoMount'] = false;
}
let siaPrime = arg.data.SiaPrime || this.state.SiaPrime;
if (siaPrime.AutoMount === undefined) {
siaPrime['AutoMount'] = false;
}
this.setState({
Hyperspace: arg.data.Hyperspace,
Hyperspace: hyperspace,
Release: arg.data.Release,
Sia: arg.data.Sia,
Sia: sia,
SiaPrime: siaPrime,
Version: arg.data.Version,
}, ()=> {
this.grabReleases();
@@ -431,7 +457,7 @@ class App extends Component {
let version = this.state.Version;
if ((version === -1) || !versionLookup[this.state.ReleaseTypes[this.state.Release]][version]) {
version = latestVersion;
this.saveState(this.state.Release, version, this.state.Sia, this.state.Hyperspace);
this.saveState(this.state.Release, version, this.state.Sia, this.state.Hyperspace, this.state.SiaPrime);
}
this.setState({
@@ -518,7 +544,7 @@ class App extends Component {
});
};
saveState = (release, version, sia, hyperspace)=> {
saveState = (release, version, sia, hyperspace, siaPrime)=> {
if (ipcRenderer) {
ipcRenderer.send(Constants.IPC_Save_State, {
Directory: Constants.DATA_LOCATIONS[this.props.platform],
@@ -526,6 +552,7 @@ class App extends Component {
Hyperspace: hyperspace,
Release: release,
Sia: sia,
SiaPrime: siaPrime,
Version: version,
}
});
@@ -637,7 +664,7 @@ class App extends Component {
let key = 0;
mainContent.push((
<div key={'rvd_' + key++}
style={{height: '44%'}}>
style={{height: '34%'}}>
<ReleaseVersionDisplay disabled={this.state.DownloadActive || this.state.ExtractActive || this.state.MountsBusy}
downloadClicked={this.handleReleaseDownload}
downloadDisabled={!downloadEnabled}
@@ -656,7 +683,7 @@ class App extends Component {
if (allowMount) {
mainContent.push((
<div key={'md_' + key++}
style={{height: '56%'}}>
style={{height: '28%'}}>
<MountItems allowConfig={allowConfig}
autoMountChanged={this.handleAutoMountChanged}
autoMountProcessed={this.notifyAutoMountProcessed}
@@ -669,6 +696,7 @@ class App extends Component {
platform={this.props.platform}
processAutoMount={!this.state.AutoMountProcessed}
sia={this.state.Sia}
siaprime={this.state.SiaPrime}
version={this.state.InstalledVersion}/>
</div>
));