diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-08-07 11:03:11 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-08-07 11:03:11 +0200 |
| commit | 858ded2aa27ab9c86ecf79c1702ef07a2bdf60fe (patch) | |
| tree | c279d261fad33222c3fb7e0c45904b2915f21f1b | |
| parent | 83ae95e38026c16703a50a78966d583280010f3d (diff) | |
| parent | 7ca1a8e1a3eecd18ee4acea2007b22092da97fd9 (diff) | |
| download | mullvadvpn-858ded2aa27ab9c86ecf79c1702ef07a2bdf60fe.tar.xz mullvadvpn-858ded2aa27ab9c86ecf79c1702ef07a2bdf60fe.zip | |
Merge branch 'update-flow-v0.78'
| -rw-r--r-- | .eslintrc | 2 | ||||
| -rw-r--r-- | app/app.js | 1 | ||||
| -rw-r--r-- | app/components/Account.js | 7 | ||||
| -rw-r--r-- | app/components/Connect.js | 16 | ||||
| -rw-r--r-- | app/errors.js | 18 | ||||
| -rw-r--r-- | package.json | 4 | ||||
| -rw-r--r-- | yarn.lock | 12 |
7 files changed, 28 insertions, 32 deletions
@@ -38,7 +38,7 @@ "react": { "pragma": "React", "version": "16.2", - "flowVersion": "0.66" + "flowVersion": "0.78" } }, "env": { diff --git a/app/app.js b/app/app.js index 8839e3d33e..eb9c9c2647 100644 --- a/app/app.js +++ b/app/app.js @@ -12,7 +12,6 @@ import { log } from './lib/platform'; import ReconnectionBackoff from './lib/reconnection-backoff'; import { DaemonRpc } from './lib/daemon-rpc'; import { setShutdownHandler } from './shutdown-handler'; - import { NoAccountError } from './errors'; import configureStore from './redux/store'; diff --git a/app/components/Account.js b/app/components/Account.js index 2534a3e40c..2edf277fa4 100644 --- a/app/components/Account.js +++ b/app/components/Account.js @@ -23,14 +23,15 @@ export type AccountProps = { onBuyMore: () => void, }; -export type AccountState = { +type State = { isRefreshingExpiry: boolean, + showAccountTokenCopiedMessage: boolean, }; -export default class Account extends Component<AccountProps, AccountState> { +export default class Account extends Component<AccountProps, State> { state = { isRefreshingExpiry: false, - showAccountCopiedMessage: false, + showAccountTokenCopiedMessage: false, }; _activationStateToken: ?Types.SubscriptionToken; diff --git a/app/components/Connect.js b/app/components/Connect.js index d472c45b31..037ab02495 100644 --- a/app/components/Connect.js +++ b/app/components/Connect.js @@ -80,8 +80,18 @@ export default class Connect extends Component<ConnectProps, ConnectState> { } renderError(error: Error) { - const title = error.userFriendlyTitle || 'Something went wrong'; - const message = error.userFriendlyMessage || error.message; + let title = ''; + let message = ''; + + if (error instanceof NoCreditError) { + title = 'Out of time'; + message = 'Buy more time, so you can continue using the internet securely'; + } + + if (error instanceof NoInternetError) { + title = 'Offline'; + message = 'Your internet connection will be secured when you get back online'; + } return ( <View style={styles.connect}> @@ -91,7 +101,7 @@ export default class Connect extends Component<ConnectProps, ConnectState> { <View style={styles.status}> <View style={styles.error_title}>{title}</View> <View style={styles.error_message}>{message}</View> - {error.type === 'NO_CREDIT' ? ( + {error instanceof NoCreditError ? ( <View> <AppButton.GreenButton onPress={this.onExternalLink.bind(this, 'purchase')}> <AppButton.Label>Buy more time</AppButton.Label> diff --git a/app/errors.js b/app/errors.js index 993b4d0ff1..7464851a1f 100644 --- a/app/errors.js +++ b/app/errors.js @@ -1,29 +1,15 @@ +// @flow + export class NoCreditError extends Error { constructor() { super("Account doesn't have enough credit available for connection"); } - - get userFriendlyTitle(): string { - return 'Out of time'; - } - - get userFriendlyMessage(): string { - return 'Buy more time, so you can continue using the internet securely'; - } } export class NoInternetError extends Error { constructor() { super('Internet connectivity is currently unavailable'); } - - get userFriendlyTitle(): string { - return 'Offline'; - } - - get userFriendlyMessage(): string { - return 'Your internet connection will be secured when you get back online'; - } } export class NoDaemonError extends Error { diff --git a/package.json b/package.json index 5c577d2ccd..442078931c 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "redux": "^3.0.0", "redux-thunk": "^2.2.0", "uuid": "^3.0.1", - "validated": "^1.1.0" + "validated": "^1.3.0" }, "optionalDependencies": { "nseventmonitor": "https://github.com/mullvad/NSEventMonitor.git#0.0.9", @@ -62,7 +62,7 @@ "eslint-config-prettier": "^2.9.0", "eslint-plugin-flowtype": "^2.49.3", "eslint-plugin-react": "^7.9.1", - "flow-bin": "^0.66.0", + "flow-bin": "^0.78.0", "flow-typed": "^2.4.0", "mock-socket": "^7.1.0", "npm-run-all": "^4.0.1", @@ -3343,9 +3343,9 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -flow-bin@^0.66.0: - version "0.66.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.66.0.tgz#a96dde7015dc3343fd552a7b4963c02be705ca26" +flow-bin@^0.78.0: + version "0.78.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.78.0.tgz#df9fe7f9c9a2dfaff39083949fe2d831b41627b7" flow-typed@^2.4.0: version "2.4.0" @@ -7904,9 +7904,9 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -validated@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/validated/-/validated-1.2.0.tgz#44ca3791cd5b2fc24433f7d1ae3a8896dfe1aec3" +validated@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/validated/-/validated-1.3.0.tgz#ff12e55853aae400e289e8bd0ca8f5d0c9fe0da4" dependencies: commander "^2.9.0" custom-error-instance "^2.1.1" |
