diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-06-26 16:30:54 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-07-07 13:49:29 +0200 |
| commit | 16ee9a212560f0a1989dc278cb9281152307275d (patch) | |
| tree | 3033099f2a3081618e05531a5e828b910b25c244 | |
| parent | 5da649c239443431fe492fdf57fbdaee0099ca79 (diff) | |
| download | mullvadvpn-16ee9a212560f0a1989dc278cb9281152307275d.tar.xz mullvadvpn-16ee9a212560f0a1989dc278cb9281152307275d.zip | |
Move geoIP from account to connection
| -rw-r--r-- | app/components/Connect.js | 4 | ||||
| -rw-r--r-- | app/lib/backend.js | 2 | ||||
| -rw-r--r-- | app/redux/account/reducers.js | 7 | ||||
| -rw-r--r-- | app/redux/connection/reducers.js | 11 |
4 files changed, 12 insertions, 12 deletions
diff --git a/app/components/Connect.js b/app/components/Connect.js index 173628646d..eb93d97432 100644 --- a/app/components/Connect.js +++ b/app/components/Connect.js @@ -129,7 +129,7 @@ export default class Connect extends Component { const displayLocation = this.displayLocation(); const mapBounds = this.calculateMapBounds(displayLocation.location, altitude); const mapBoundsOptions = { offset: [0, -113], animate: !this.state.isFirstPass }; - const accountLocation = this.convertToMapCoordinate(this.props.account.location || [0, 0]); + const accountLocation = this.convertToMapCoordinate(this.props.connection.location || [0, 0]); const serverLocation = this.convertToMapCoordinate(serverInfo.location); const map = process.platform === 'darwin' @@ -397,7 +397,7 @@ export default class Connect extends Component { displayLocation(): DisplayLocation { // return user location when disconnected if(this.props.connection.status === 'disconnected') { - let { location, country, city } = this.props.account; + let { location, country, city } = this.props.connection; return { location: location || [0, 0], country, city diff --git a/app/lib/backend.js b/app/lib/backend.js index 6b0e1f100f..a8774dc599 100644 --- a/app/lib/backend.js +++ b/app/lib/backend.js @@ -108,7 +108,7 @@ export class Backend { country: location.country, city: location.city }; - this._store.dispatch(accountActions.loginChange(newLocation)); + this._store.dispatch(connectionActions.connectionChange(newLocation)); }) .catch(e => { log.info('Failed getting new location', e); diff --git a/app/redux/account/reducers.js b/app/redux/account/reducers.js index 52b36f60a0..b93a5b6948 100644 --- a/app/redux/account/reducers.js +++ b/app/redux/account/reducers.js @@ -2,7 +2,6 @@ import { handleActions } from 'redux-actions'; import actions from './actions.js'; -import type { Coordinate2d } from '../../types'; import type { ReduxAction } from '../store'; import type { BackendError } from '../../lib/backend'; @@ -10,9 +9,6 @@ export type LoginState = 'none' | 'logging in' | 'failed' | 'ok'; export type AccountReduxState = { accountNumber: ?string, paidUntil: ?string, // ISO8601 - location: ?Coordinate2d, - country: ?string, - city: ?string, status: LoginState, error: ?BackendError }; @@ -20,9 +16,6 @@ export type AccountReduxState = { const initialState: AccountReduxState = { accountNumber: null, paidUntil: null, - location: null, - country: null, - city: null, status: 'none', error: null }; diff --git a/app/redux/connection/reducers.js b/app/redux/connection/reducers.js index bf44281602..daf746c034 100644 --- a/app/redux/connection/reducers.js +++ b/app/redux/connection/reducers.js @@ -3,20 +3,27 @@ import { handleActions } from 'redux-actions'; import actions from './actions'; import type { ReduxAction } from '../store'; +import type { Coordinate2d } from '../../types'; export type ConnectionState = 'disconnected' | 'connecting' | 'connected'; export type ConnectionReduxState = { status: ConnectionState, isOnline: boolean, serverAddress: ?string, - clientIp: ?string + clientIp: ?string, + location: ?Coordinate2d, + country: ?string, + city: ?string, }; const initialState: ConnectionReduxState = { status: 'disconnected', isOnline: true, serverAddress: null, - clientIp: null + clientIp: null, + location: null, + country: null, + city: null, }; export default handleActions({ |
