SiaPrime support
This commit is contained in:
56
src/App.js
56
src/App.js
@@ -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>
|
||||
));
|
||||
|
||||
@@ -36,6 +36,12 @@ class MountItems extends Component {
|
||||
Mounted: false,
|
||||
PID: -1,
|
||||
},
|
||||
SiaPrime: {
|
||||
AllowMount: false,
|
||||
DriveLetters: [],
|
||||
Mounted: false,
|
||||
PID: -1,
|
||||
},
|
||||
};
|
||||
|
||||
componentWillUnmount = () => {
|
||||
@@ -104,6 +110,13 @@ class MountItems extends Component {
|
||||
Mounted: (arg.data.Locations.Sia.length > 0),
|
||||
PID: arg.data.PIDS.Sia,
|
||||
};
|
||||
const siaPrime = {
|
||||
...this.state.SiaPrime,
|
||||
AllowMount: true,
|
||||
DriveLetters: (arg.data.DriveLetters.SiaPrime),
|
||||
Mounted: (arg.data.Locations.SiaPrime.length > 0),
|
||||
PID: arg.data.PIDS.SiaPrime,
|
||||
};
|
||||
const hs = {
|
||||
...this.state.Hyperspace,
|
||||
AllowMount: true,
|
||||
@@ -117,6 +130,7 @@ class MountItems extends Component {
|
||||
this.setState({
|
||||
Hyperspace: hs,
|
||||
Sia: sia,
|
||||
SiaPrime: siaPrime,
|
||||
}, () => {
|
||||
let hsLocation = arg.data.Locations.Hyperspace;
|
||||
if ((hsLocation.length === 0) && (this.props.platform === 'win32')) {
|
||||
@@ -134,6 +148,14 @@ class MountItems extends Component {
|
||||
this.props.changed('Sia', siaLocation);
|
||||
}
|
||||
|
||||
let siaPrimeLocation = arg.data.Locations.SiaPrime;
|
||||
if ((siaPrimeLocation.length === 0) && (this.props.platform === 'win32')) {
|
||||
siaPrimeLocation = this.props.siaprime.MountLocation || arg.data.DriveLetters.SiaPrime[0];
|
||||
}
|
||||
if (siaPrimeLocation !== this.props.siaprime.MountLocation) {
|
||||
this.props.changed('SiaPrime', siaPrimeLocation);
|
||||
}
|
||||
|
||||
this.performAutoMount();
|
||||
});
|
||||
} else {
|
||||
@@ -171,6 +193,11 @@ class MountItems extends Component {
|
||||
(this.props.sia.MountLocation.length > 0)) {
|
||||
this.handleMountUnMount('Sia', true, this.props.sia.MountLocation);
|
||||
}
|
||||
if (this.props.siaprime.AutoMount &&
|
||||
!this.state.SiaPrime.Mounted &&
|
||||
(this.props.siaprime.MountLocation.length > 0)) {
|
||||
this.handleMountUnMount('SiaPrime', true, this.props.siaprime.MountLocation);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -204,6 +231,20 @@ class MountItems extends Component {
|
||||
pid={this.state.Sia.PID}
|
||||
platform={this.props.platform}
|
||||
title={'Sia'}/>
|
||||
<div style={{paddingTop: '8px'}}/>
|
||||
<MountItem allowConfig={this.props.allowConfig}
|
||||
allowMount={this.state.Sia.AllowMount}
|
||||
autoMount={this.props.siaprime.AutoMount}
|
||||
autoMountChanged={(e)=>this.props.autoMountChanged('SiaPrime', e)}
|
||||
changed={(e) => this.handleMountLocationChanged('SiaPrime', e.target.value)}
|
||||
clicked={this.handleMountUnMount}
|
||||
configClicked={()=>this.props.configClicked('SiaPrime')}
|
||||
items={this.state.SiaPrime.DriveLetters}
|
||||
location={this.props.siaprime.MountLocation}
|
||||
mounted={this.state.SiaPrime.Mounted}
|
||||
pid={this.state.SiaPrime.PID}
|
||||
platform={this.props.platform}
|
||||
title={'SiaPrime'}/>
|
||||
</div>);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user