Thibaut Boustany
7 years ago
No known key found for this signature in database
GPG Key ID: 32475B11A2B13EEC
1 changed files with
18 additions and
5 deletions
-
src/components/UpdateNotifier/UpdateInstalled.js
|
|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
import { PureComponent } from 'react' |
|
|
|
import { connect } from 'react-redux' |
|
|
|
import axios from 'axios' |
|
|
|
import semver from 'semver' |
|
|
|
|
|
|
|
import { openModal } from 'reducers/modals' |
|
|
@ -28,13 +29,25 @@ const mapDispatchToProps = { |
|
|
|
|
|
|
|
class UpdateInstalled extends PureComponent<Props> { |
|
|
|
componentDidMount() { |
|
|
|
const { lastUsedVersion, openModal, saveSettings } = this.props |
|
|
|
const { lastUsedVersion, saveSettings } = this.props |
|
|
|
const currentVersion = __APP_VERSION__ |
|
|
|
|
|
|
|
if (semver.gt(currentVersion, lastUsedVersion)) { |
|
|
|
openModal(MODAL_RELEASES_NOTES, `${lastUsedVersion} -> ${currentVersion}`) |
|
|
|
saveSettings({ lastUsedVersion: currentVersion }) |
|
|
|
} |
|
|
|
// if (semver.gt(currentVersion, lastUsedVersion)) {
|
|
|
|
axios |
|
|
|
.get( |
|
|
|
`https://api.github.com/repos/LedgerHQ/ledger-live-desktop/releases/tags/v${currentVersion}`, |
|
|
|
) |
|
|
|
.then(this.showModal) |
|
|
|
|
|
|
|
saveSettings({ lastUsedVersion: currentVersion }) |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
showModal = ({ data }) => { |
|
|
|
const { openModal } = this.props |
|
|
|
const { body } = data |
|
|
|
|
|
|
|
openModal(MODAL_RELEASES_NOTES, body) |
|
|
|
} |
|
|
|
|
|
|
|
render() { |
|
|
|