[Added tooltips] [IPC constants]
This commit is contained in:
52
src/App.js
52
src/App.js
@@ -1,5 +1,4 @@
|
||||
import React, {Component} from 'react';
|
||||
import * as Constants from './constants';
|
||||
import axios from 'axios';
|
||||
import styles from './App.css';
|
||||
import Box from './components/UI/Box/Box';
|
||||
@@ -15,6 +14,7 @@ import MountItems from './containers/MountItems/MountItems';
|
||||
import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon';
|
||||
import UpgradeUI from './components/UpgradeUI/UpgradeUI';
|
||||
|
||||
const Constants = require('./constants');
|
||||
const Scheduler = require('node-schedule');
|
||||
|
||||
let ipcRenderer = null;
|
||||
@@ -399,18 +399,7 @@ class App extends Component {
|
||||
};
|
||||
|
||||
onGrabReleasesReply = ()=> {
|
||||
axios.get(Constants.RELEASES_URL)
|
||||
.then(response => {
|
||||
const versionLookup = {
|
||||
Alpha: response.data.Versions.Alpha[this.state.Platform],
|
||||
Beta: response.data.Versions.Beta[this.state.Platform],
|
||||
RC: response.data.Versions.RC[this.state.Platform],
|
||||
Release: response.data.Versions.Release[this.state.Platform],
|
||||
};
|
||||
const locationsLookup = {
|
||||
...response.data.Locations[this.state.Platform],
|
||||
};
|
||||
|
||||
const doUpdate = (locationsLookup, versionLookup) => {
|
||||
const latestVersion = versionLookup[this.state.ReleaseTypes[this.state.Release]].length - 1;
|
||||
let version = this.state.Version;
|
||||
if (version === -1) {
|
||||
@@ -424,9 +413,40 @@ class App extends Component {
|
||||
VersionAvailable: version !== latestVersion,
|
||||
VersionLookup: versionLookup,
|
||||
});
|
||||
|
||||
this.checkVersionInstalled(this.state.Release, version, versionLookup);
|
||||
};
|
||||
|
||||
axios.get(Constants.RELEASES_URL)
|
||||
.then(response => {
|
||||
const versionLookup = {
|
||||
Alpha: response.data.Versions.Alpha[this.state.Platform],
|
||||
Beta: response.data.Versions.Beta[this.state.Platform],
|
||||
RC: response.data.Versions.RC[this.state.Platform],
|
||||
Release: response.data.Versions.Release[this.state.Platform],
|
||||
};
|
||||
const locationsLookup = {
|
||||
...response.data.Locations[this.state.Platform],
|
||||
};
|
||||
|
||||
window.localStorage.setItem('releases', JSON.stringify({
|
||||
LocationsLookup: locationsLookup,
|
||||
VersionLookup: versionLookup
|
||||
}));
|
||||
|
||||
doUpdate(locationsLookup, versionLookup);
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
const releases = window.localStorage.getItem('releases');
|
||||
if (releases && (releases.length > 0)) {
|
||||
const obj = JSON.parse(releases);
|
||||
const locationsLookup = obj.LocationsLookup;
|
||||
const versionLookup = obj.VersionLookup;
|
||||
|
||||
doUpdate(locationsLookup, versionLookup);
|
||||
} else {
|
||||
// TODO Handle error
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -446,6 +466,10 @@ class App extends Component {
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
this.setState({
|
||||
UpgradeAvailable: false,
|
||||
UpgradeData: {},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -648,7 +672,7 @@ class App extends Component {
|
||||
<table cellPadding={0}
|
||||
cellSpacing={0}
|
||||
style={{margin: 0, padding: 0}}
|
||||
width="100%">
|
||||
width='100%'>
|
||||
<tbody style={{margin: 0, padding: 0}}>
|
||||
<tr style={{margin: 0, padding: 0}}>
|
||||
<td style={{margin: 0, padding: 0}}
|
||||
|
||||
Reference in New Issue
Block a user