diff --git a/.gitignore b/.gitignore index 2df01008..d3e7e2c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,8 @@ .DS_Store *.log +/.env /dist/ /flow-typed/ /node_modules/ -/static/ /storybook-static/ thumbs.db -/.env diff --git a/package.json b/package.json index a14b291e..92c60ab9 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "redux-actions": "^2.2.1", "redux-thunk": "^2.2.0", "shortid": "^2.2.8", - "source-map-support": "^0.5.2", + "source-map-support": "^0.5.3", "styled-components": "^3.0.2", "styled-system": "^1.1.1" }, @@ -108,11 +108,11 @@ "eslint-plugin-flowtype": "^2.42.0", "eslint-plugin-import": "^2.8.0", "eslint-plugin-jsx-a11y": "^6.0.3", - "eslint-plugin-react": "^7.5.1", + "eslint-plugin-react": "^7.6.0", "flow-bin": "^0.64.0", "flow-typed": "^2.2.3", "husky": "^0.14.3", - "lint-staged": "^6.0.0", + "lint-staged": "^6.1.0", "node-loader": "^0.6.0", "prettier": "^1.10.2", "react-hot-loader": "^4.0.0-beta.17", diff --git a/src/components/UpdateNotifier.js b/src/components/UpdateNotifier.js index 3b7d3ba8..45721e49 100644 --- a/src/components/UpdateNotifier.js +++ b/src/components/UpdateNotifier.js @@ -7,7 +7,7 @@ import type { MapStateToProps } from 'react-redux' import styled from 'styled-components' import { getUpdateStatus, getUpdateData } from 'reducers/update' -import { sendEvent, checkUpdates } from 'renderer/events' +import { sendEvent } from 'renderer/events' import type { State } from 'reducers' import type { UpdateStatus } from 'reducers/update' @@ -39,12 +39,6 @@ const Container = styled(Box).attrs({ ` class UpdateNotifier extends PureComponent { - componentWillReceiveProps(nextProps) { - if (['idle', 'unavailable', 'error'].includes(nextProps.updateStatus)) { - checkUpdates() - } - } - renderStatus() { const { updateStatus } = this.props switch (updateStatus) { diff --git a/src/constants.js b/src/constants.js index 007c8a00..45fd3ea2 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,2 +1,2 @@ export const CHECK_UPDATE_TIMEOUT = 5e3 -export const SYNC_ACCOUNT_TIMEOUT = 5e3 +export const SYNC_ACCOUNT_TIMEOUT = 2e3 diff --git a/src/helpers/btc.js b/src/helpers/btc.js index 55d858a8..b1596ae6 100644 --- a/src/helpers/btc.js +++ b/src/helpers/btc.js @@ -60,12 +60,14 @@ export async function getAccount({ hdnode, segwit, network, + asyncDelay = 100, }: { allAddresses?: Array, currentIndex?: number, hdnode: Object, segwit: boolean, network: Object, + asyncDelay?: number, }) { const gapLimit = 20 const script = segwit ? parseInt(network.scriptHash, 10) : parseInt(network.pubKeyHash, 10) @@ -99,7 +101,7 @@ export async function getAccount({ }) const getAsyncAddress = params => - new Promise(resolve => setTimeout(() => resolve(getAddress(params)), 100)) + new Promise(resolve => setTimeout(() => resolve(getAddress(params)), asyncDelay)) const getLastAddress = (addresses, txs) => { const txsAddresses = [...txs.inputs.map(tx => tx.prev_out.addr), ...txs.out.map(tx => tx.addr)] diff --git a/src/internals/usb/wallet/accounts.js b/src/internals/usb/wallet/accounts.js index b1222ea8..620fce5b 100644 --- a/src/internals/usb/wallet/accounts.js +++ b/src/internals/usb/wallet/accounts.js @@ -113,7 +113,7 @@ export default async ({ } const hdnode = getHDNode({ xpub58, network }) - const account = await getAccount({ hdnode, network, segwit }) + const account = await getAccount({ hdnode, network, segwit, asyncDelay: 0 }) onProgress({ account: currentAccount, diff --git a/src/renderer/i18n.js b/src/renderer/i18n.js index 2166d0b8..d9ca2c6d 100644 --- a/src/renderer/i18n.js +++ b/src/renderer/i18n.js @@ -8,7 +8,7 @@ i18n.use(Backend).init({ fallbackLng: 'en', debug: false, backend: { - loadPath: path.resolve(__dirname, '../i18n/{{lng}}/{{ns}}.yml'), + loadPath: path.join(__static, '/i18n/{{lng}}/{{ns}}.yml'), }, react: { wait: true, diff --git a/src/i18n/en/translation.yml b/static/i18n/en/translation.yml similarity index 100% rename from src/i18n/en/translation.yml rename to static/i18n/en/translation.yml diff --git a/src/i18n/fr/translation.yml b/static/i18n/fr/translation.yml similarity index 100% rename from src/i18n/fr/translation.yml rename to static/i18n/fr/translation.yml diff --git a/yarn.lock b/yarn.lock index 8a86f52a..af50b281 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3048,7 +3048,7 @@ doctrine@1.5.0: esutils "^2.0.2" isarray "^1.0.0" -doctrine@^2.0.0, doctrine@^2.1.0: +doctrine@^2.0.0, doctrine@^2.0.2, doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" dependencies: @@ -3602,13 +3602,13 @@ eslint-plugin-jsx-a11y@^6.0.3: emoji-regex "^6.1.0" jsx-ast-utils "^2.0.0" -eslint-plugin-react@^7.5.1: - version "7.5.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.5.1.tgz#52e56e8d80c810de158859ef07b880d2f56ee30b" +eslint-plugin-react@^7.6.0: + version "7.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.6.0.tgz#351651188c74c5b2fecc2717e3936b7207baa728" dependencies: - doctrine "^2.0.0" + doctrine "^2.0.2" has "^1.0.1" - jsx-ast-utils "^2.0.0" + jsx-ast-utils "^2.0.1" prop-types "^15.6.0" eslint-restricted-globals@^0.1.1: @@ -5386,7 +5386,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jsx-ast-utils@^2.0.0: +jsx-ast-utils@^2.0.0, jsx-ast-utils@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz#e801b1b39985e20fffc87b40e3748080e2dcac7f" dependencies: @@ -5463,9 +5463,9 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -lint-staged@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-6.0.1.tgz#855f2993ab4a265430e2fd9828427e648d65e6b4" +lint-staged@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-6.1.0.tgz#28f600c10a6cbd249ceb003118a1552e53544a93" dependencies: app-root-path "^2.0.0" chalk "^2.1.0" @@ -8269,6 +8269,12 @@ source-map-support@^0.5.2: dependencies: source-map "^0.6.0" +source-map-support@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.3.tgz#2b3d5fff298cfa4d1afd7d4352d569e9a0158e76" + dependencies: + source-map "^0.6.0" + source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"