From dbcbe66c6a61edbe9003e5b1d3e3e5e39dea1d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 6 Jun 2018 12:58:22 +0200 Subject: [PATCH 1/3] Fix countervalues for testnets --- package.json | 2 +- src/helpers/countervalues.js | 2 +- src/reducers/settings.js | 7 +++++-- yarn.lock | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 1de9158d..59eee192 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@ledgerhq/hw-transport": "^4.12.0", "@ledgerhq/hw-transport-node-hid": "^4.12.0", "@ledgerhq/ledger-core": "1.4.5", - "@ledgerhq/live-common": "2.27.1", + "@ledgerhq/live-common": "2.29.0", "axios": "^0.18.0", "babel-runtime": "^6.26.0", "bcryptjs": "^2.4.3", diff --git a/src/helpers/countervalues.js b/src/helpers/countervalues.js index 72a6a0c5..4859ad79 100644 --- a/src/helpers/countervalues.js +++ b/src/helpers/countervalues.js @@ -20,7 +20,7 @@ const pairsSelector = createSelector( [ { from: intermediaryCurrency, to: counterValueCurrency, exchange: counterValueExchange }, ].concat( - currencies.filter(c => c !== intermediaryCurrency).map(currency => ({ + currencies.filter(c => c.ticker !== intermediaryCurrency.ticker).map(currency => ({ from: currency, to: intermediaryCurrency, exchange: currencySettingsSelector(state, { currency }).exchange, diff --git a/src/reducers/settings.js b/src/reducers/settings.js index 2a42f861..0136b644 100644 --- a/src/reducers/settings.js +++ b/src/reducers/settings.js @@ -98,12 +98,15 @@ const handlers: Object = { copy.currenciesSettings = { ...copy.currenciesSettings } for (const { to, from, exchange } of pairs) { const fromCrypto = asCryptoCurrency(from) - if (fromCrypto && to === intermediaryCurrency) { + if (fromCrypto && to.ticker === intermediaryCurrency.ticker) { copy.currenciesSettings[fromCrypto.id] = { ...copy.currenciesSettings[fromCrypto.id], exchange, } - } else if (from === intermediaryCurrency && to === counterValueCurrency) { + } else if ( + from.ticker === intermediaryCurrency.ticker && + to.ticker === counterValueCurrency.ticker + ) { copy.counterValueExchange = exchange } } diff --git a/yarn.lock b/yarn.lock index a9c72b15..861267da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1495,9 +1495,9 @@ npm "^5.7.1" prebuild-install "^2.2.2" -"@ledgerhq/live-common@2.27.1": - version "2.27.1" - resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-2.27.1.tgz#3ea96eb80b3e2676529c805c76e6b20ce14b95f0" +"@ledgerhq/live-common@2.29.0": + version "2.29.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-2.29.0.tgz#a8f8a023f12973a60b2f89882534597f0723929f" dependencies: axios "^0.18.0" invariant "^2.2.2" From ba3cfd6739d48e07a8eebcc401a1f30058838338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 6 Jun 2018 13:25:11 +0200 Subject: [PATCH 2/3] Polish code of reducers/accounts --- src/helpers/db.js | 23 +++++++++++++---------- src/reducers/accounts.js | 39 ++++++--------------------------------- src/reducers/settings.js | 1 - 3 files changed, 19 insertions(+), 44 deletions(-) diff --git a/src/helpers/db.js b/src/helpers/db.js index d5198ce4..19968185 100644 --- a/src/helpers/db.js +++ b/src/helpers/db.js @@ -4,7 +4,7 @@ import Store from 'electron-store' import set from 'lodash/set' import get from 'lodash/get' -import { serializeAccounts, deserializeAccounts } from 'reducers/accounts' +import { decodeAccountsModel, encodeAccountsModel } from 'reducers/accounts' type DBKey = 'settings' | 'accounts' | 'countervalues' @@ -23,17 +23,20 @@ export function setEncryptionKey(key: DBKey, value?: string) { encryptionKey[key] = value } -function middleware(type, key, data: any) { - if (key === 'accounts') { - if (type === 'get') { - data = serializeAccounts(data) - } +const transforms = { + get: { + accounts: decodeAccountsModel, + }, + set: { + accounts: encodeAccountsModel, + }, +} - if (type === 'set') { - data = deserializeAccounts(data) - } +function middleware(type: 'get' | 'set', key: string, data: any) { + const t = transforms[type][key] + if (t) { + data = t(data) } - return data } diff --git a/src/reducers/accounts.js b/src/reducers/accounts.js index b89cc8d5..b3a9ac8e 100644 --- a/src/reducers/accounts.js +++ b/src/reducers/accounts.js @@ -59,9 +59,7 @@ const handlers: Object = { // Selectors -export function accountsSelector(state: { accounts: AccountsState }): Account[] { - return state.accounts -} +export const accountsSelector = (state: { accounts: AccountsState }): Account[] => state.accounts export const currenciesSelector = createSelector(accountsSelector, accounts => [...new Set(accounts.map(a => a.currency))].sort((a, b) => a.name.localeCompare(b.name)), @@ -73,41 +71,16 @@ export const accountSelector = createSelector( (accounts, accountId) => accounts.find(a => a.id === accountId), ) -export function decodeAccount(account: AccountRaw): Account { - return accountModel.decode({ +export const decodeAccount = (account: AccountRaw): Account => + accountModel.decode({ data: account, version: accountModel.version, }) -} - -export function encodeAccount(account: Account): AccountRaw { - return accountModel.encode(account).data -} -// Yeah. `any` should be `AccountRaw[]` but it can also be a map -// of wrapped accounts. And as flow is apparently incapable of doing -// such a simple thing, let's put any, right? I don't care. -// FIXME: no it shouldn't. the purpose of DataModel is to contain the version, it's the only way we can run the migration functions -export function serializeAccounts(accounts: any): Account[] { - // ensure that accounts are always wrapped in data key - if (accounts && accounts.length && !accounts[0].data) { - accounts = accounts.map(account => ({ data: account })) - } - return accounts ? accounts.map(accountModel.decode) : [] -} +export const encodeAccount = (account: Account): AccountRaw => accountModel.encode(account).data -export function deserializeAccounts(accounts: Account[]) { - return accounts.map(account => { - // as account can be passed by main process, the Date types - // can be converted to string. we ensure here that we have real - // date - // FIXME Account shouldn't be passed by main process. only AccountRaw should be! - if (typeof account.lastSyncDate === 'string') { - account.lastSyncDate = new Date(account.lastSyncDate) - } +export const decodeAccountsModel = (raws: *) => (raws || []).map(accountModel.decode) - return accountModel.encode(account) - }) -} +export const encodeAccountsModel = (accounts: *) => (accounts || []).map(accountModel.encode) export default handleActions(handlers, state) diff --git a/src/reducers/settings.js b/src/reducers/settings.js index 2a42f861..7c8d4112 100644 --- a/src/reducers/settings.js +++ b/src/reducers/settings.js @@ -76,7 +76,6 @@ const INITIAL_STATE: SettingsState = { } function asCryptoCurrency(c: Currency): ?CryptoCurrency { - // $FlowFixMe return 'id' in c ? c : null } From 0e244dd949993954afc5c0f431af9bdbcce26e35 Mon Sep 17 00:00:00 2001 From: ledger-bot <37080477+ledger-bot@users.noreply.github.com> Date: Wed, 6 Jun 2018 14:48:29 +0200 Subject: [PATCH 3/3] New Crowdin translations (#451) * New translations emptyState.yml (French) * New translations common.yml (French) * New translations account.yml (French) * New translations onboarding.yml (French) * New translations send.yml (French) * New translations send.yml (French) * New translations settings.yml (French) * New translations onboarding.yml (French) * New translations accountsOrder.yml (French) --- static/i18n/fr/accountsOrder.yml | 1 - static/i18n/fr/onboarding.yml | 26 ++++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/static/i18n/fr/accountsOrder.yml b/static/i18n/fr/accountsOrder.yml index 80a8fdef..96b50909 100644 --- a/static/i18n/fr/accountsOrder.yml +++ b/static/i18n/fr/accountsOrder.yml @@ -1,4 +1,3 @@ --- name: Alphabétique balance: Balance -type: Crypto-monnaie diff --git a/static/i18n/fr/onboarding.yml b/static/i18n/fr/onboarding.yml index 2db5c568..d1631a96 100644 --- a/static/i18n/fr/onboarding.yml +++ b/static/i18n/fr/onboarding.yml @@ -1,7 +1,6 @@ --- start: - title: Welcome to the new Ledger Live Desktop app. - desc: Let’s get started! + title: Welcome to Ledger Live init: title: Welcome to Ledger Live, the computer companion app to your Ledger device newDevice: @@ -18,7 +17,6 @@ init: desc: Please replace it with the final wording once it’s done. selectDevice: title: To get started, select your device - desc: This is a long text, please replace it with the final wording once it’s done. Lorem ipsum dolor amet ledger lorem dolor ipsum amet ledgerNanoCard: title: Ledger Nano S desc: Please replace it with the final wording once it’s done. @@ -42,12 +40,25 @@ selectPIN: note2: An 8-digit PIN code offers an optimum level of security. note3: Never use a device supplied with a PIN code and/or a 24-word recovery phrase. writeSeed: - title: Save your recovery phrase - desc: Your recovery phrase is formed by 24 words. They will be displayed only once. - instructions: + restore: + title: Save your recovery phrase + desc: Your recovery phrase is formed by 24 words. They will be displayed only once. + step1: Press the right button to select the length of your recovery phrase. Press both buttons to confirm. + step2: Select the first letters of Word \ + step3: Select Word \ + step4: Repeat the process until the last word. + nano: + title: Save your recovery phrase + desc: Your recovery phrase is formed by 24 words. They will be displayed only once. step1: Copy the first word (Word \ step2: Press the right button to display Word \ step3: Confirm your recovery phrase press both buttons to validate each word displayed on the screen. + blue: + title: Save your recovery phrase + desc: Your recovery phrase is formed by 24 words. They will be displayed only once. + step1: Copy each word of the recovery phrase on the blank Recovery sheet. Make sure to copy the words in the same order. + step2: Tap NEXT to display the following words. Tap PREVIOUS to go back. + step3: Enter the requested words to confirm your recovery phrase. disclaimer: note1: Carefully secure your 24 words out of sight. note2: Ledger does not keep any backup of your 24 words. @@ -89,6 +100,9 @@ analytics: termsConditions: title: Terms and Conditions desc: Please accept terms and conditions to proceed + sentryLogs: + title: Sentry Logs + desc: Help Ledger improve its products and services by automatically sending diagnostics and usage data. finish: title: This is the title of the screen. 1 line is the maximum desc: This is a long text, please replace it with the final wording once it’s done.
Lorem ipsum dolor amet ledger lorem dolor ipsum amet