Browse Source

WIP: load last used version from settings

master
Thibaut Boustany 7 years ago
parent
commit
d53f7b9b3b
No known key found for this signature in database GPG Key ID: 32475B11A2B13EEC
  1. 14
      src/components/UpdateNotifier/UpdateInstalled.js
  2. 1
      src/components/modals/ReleaseNotes.js
  3. 4
      src/reducers/settings.js

14
src/components/UpdateNotifier/UpdateInstalled.js

@ -5,20 +5,28 @@ import { connect } from 'react-redux'
import { openModal } from 'reducers/modals' import { openModal } from 'reducers/modals'
import { MODAL_RELEASES_NOTES } from 'config/constants' import { MODAL_RELEASES_NOTES } from 'config/constants'
import { lastUsedVersionSelector } from 'reducers/settings'
import type { State } from 'reducers'
type Props = { type Props = {
openModal: Function, openModal: Function,
lastUsedVersion: string,
} }
const mapStateToProps = (state: State) => ({
lastUsedVersion: lastUsedVersionSelector(state),
})
const mapDispatchToProps = { const mapDispatchToProps = {
openModal, openModal,
} }
class UpdateInstalled extends PureComponent<Props> { class UpdateInstalled extends PureComponent<Props> {
componentDidMount() { componentDidMount() {
const { openModal } = this.props const { lastUsedVersion, openModal } = this.props
const currentVersion = __APP_VERSION__
openModal(MODAL_RELEASES_NOTES, 'blah') openModal(MODAL_RELEASES_NOTES, `${lastUsedVersion} -> ${currentVersion}`)
} }
render() { render() {
@ -27,6 +35,6 @@ class UpdateInstalled extends PureComponent<Props> {
} }
export default connect( export default connect(
null, mapStateToProps,
mapDispatchToProps, mapDispatchToProps,
)(UpdateInstalled) )(UpdateInstalled)

1
src/components/modals/ReleaseNotes.js

@ -1,5 +1,6 @@
// @flow // @flow
import React, { PureComponent } from 'react' import React, { PureComponent } from 'react'
import { MODAL_RELEASES_NOTES } from 'config/constants' import { MODAL_RELEASES_NOTES } from 'config/constants'
import Modal, { ModalBody, ModalTitle, ModalContent } from 'components/base/Modal' import Modal, { ModalBody, ModalTitle, ModalContent } from 'components/base/Modal'

4
src/reducers/settings.js

@ -37,6 +37,7 @@ export type SettingsState = {
developerMode: boolean, developerMode: boolean,
shareAnalytics: boolean, shareAnalytics: boolean,
sentryLogs: boolean, sentryLogs: boolean,
lastUsedVersion: string,
} }
/* have to check if available for all OS */ /* have to check if available for all OS */
@ -73,6 +74,7 @@ const INITIAL_STATE: SettingsState = {
loaded: false, loaded: false,
shareAnalytics: false, shareAnalytics: false,
sentryLogs: false, sentryLogs: false,
lastUsedVersion: __APP_VERSION__,
} }
function asCryptoCurrency(c: Currency): ?CryptoCurrency { function asCryptoCurrency(c: Currency): ?CryptoCurrency {
@ -157,6 +159,8 @@ export const counterValueExchangeSelector = createSelector(
export const developerModeSelector = (state: State): boolean => state.settings.developerMode export const developerModeSelector = (state: State): boolean => state.settings.developerMode
export const lastUsedVersionSelector = (state: State): string => state.settings.lastUsedVersion
export const availableCurrencies = createSelector(developerModeSelector, listCryptoCurrencies) export const availableCurrencies = createSelector(developerModeSelector, listCryptoCurrencies)
export const getLanguage = (state: State) => state.settings.language export const getLanguage = (state: State) => state.settings.language

Loading…
Cancel
Save