Browse Source

Only show modal if current version is newer + save as last used version

master
Thibaut Boustany 7 years ago
parent
commit
4869bd6888
No known key found for this signature in database GPG Key ID: 32475B11A2B13EEC
  1. 1
      package.json
  2. 14
      src/components/UpdateNotifier/UpdateInstalled.js

1
package.json

@ -94,6 +94,7 @@
"rxjs-compat": "^6.1.0",
"secp256k1": "3.3.1",
"semaphore": "^1.1.0",
"semver": "^5.5.0",
"smooth-scrollbar": "^8.2.7",
"source-map": "0.7.3",
"source-map-support": "^0.5.4",

14
src/components/UpdateNotifier/UpdateInstalled.js

@ -2,14 +2,18 @@
import { PureComponent } from 'react'
import { connect } from 'react-redux'
import semver from 'semver'
import { openModal } from 'reducers/modals'
import { MODAL_RELEASES_NOTES } from 'config/constants'
import { lastUsedVersionSelector } from 'reducers/settings'
import { saveSettings } from 'actions/settings'
import { MODAL_RELEASES_NOTES } from 'config/constants'
import type { State } from 'reducers'
type Props = {
openModal: Function,
saveSettings: Function,
lastUsedVersion: string,
}
@ -19,14 +23,18 @@ const mapStateToProps = (state: State) => ({
const mapDispatchToProps = {
openModal,
saveSettings,
}
class UpdateInstalled extends PureComponent<Props> {
componentDidMount() {
const { lastUsedVersion, openModal } = this.props
const { lastUsedVersion, openModal, saveSettings } = this.props
const currentVersion = __APP_VERSION__
openModal(MODAL_RELEASES_NOTES, `${lastUsedVersion} -> ${currentVersion}`)
if (semver.gt(currentVersion, lastUsedVersion)) {
openModal(MODAL_RELEASES_NOTES, `${lastUsedVersion} -> ${currentVersion}`)
saveSettings({ lastUsedVersion: currentVersion })
}
}
render() {

Loading…
Cancel
Save