Browse Source
Merge pull request #1645 from gre/fix-paused-when-disrupted-coin
Fix estetic glitch that display "Paused" when a sync is disrupted
gre-patch-1
Gaëtan Renaudeau
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
13 additions and
5 deletions
-
src/components/QRCodeExporter.js
-
src/reducers/accounts.js
-
src/reducers/bridgeSync.js
|
|
@ -5,14 +5,14 @@ import { Buffer } from 'buffer' |
|
|
|
import { createStructuredSelector } from 'reselect' |
|
|
|
import { connect } from 'react-redux' |
|
|
|
|
|
|
|
import { accountsSelector } from 'reducers/accounts' |
|
|
|
import { activeAccountsSelector } from 'reducers/accounts' |
|
|
|
import { exportSettingsSelector } from 'reducers/settings' |
|
|
|
import { encode } from '@ledgerhq/live-common/lib/cross' |
|
|
|
import { dataToFrames } from 'qrloop/exporter' |
|
|
|
import QRCode from './base/QRCode' |
|
|
|
|
|
|
|
const mapStateToProps = createStructuredSelector({ |
|
|
|
accounts: accountsSelector, |
|
|
|
accounts: activeAccountsSelector, |
|
|
|
settings: exportSettingsSelector, |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
@ -6,6 +6,7 @@ import accountModel from 'helpers/accountModel' |
|
|
|
import logger from 'logger' |
|
|
|
import type { Account, AccountRaw } from '@ledgerhq/live-common/lib/types' |
|
|
|
import { OUTDATED_CONSIDERED_DELAY, DEBUG_SYNC } from 'config/constants' |
|
|
|
import { currenciesStatusSelector, getIsCurrencyDown } from './currenciesStatus' |
|
|
|
|
|
|
|
export type AccountsState = Account[] |
|
|
|
const state: AccountsState = [] |
|
|
@ -60,7 +61,14 @@ const handlers: Object = { |
|
|
|
|
|
|
|
export const accountsSelector = (state: { accounts: AccountsState }): Account[] => state.accounts |
|
|
|
|
|
|
|
export const isUpToDateSelector = createSelector(accountsSelector, accounts => |
|
|
|
export const activeAccountsSelector = createSelector( |
|
|
|
accountsSelector, |
|
|
|
currenciesStatusSelector, |
|
|
|
(accounts, currenciesStatus) => |
|
|
|
accounts.filter(a => !getIsCurrencyDown(currenciesStatus, a.currency)), |
|
|
|
) |
|
|
|
|
|
|
|
export const isUpToDateSelector = createSelector(activeAccountsSelector, accounts => |
|
|
|
accounts.every(a => { |
|
|
|
const { lastSyncDate } = a |
|
|
|
const { blockAvgTime } = a.currency |
|
|
|
|
|
@ -3,7 +3,7 @@ |
|
|
|
import { createSelector } from 'reselect' |
|
|
|
import { handleActions } from 'redux-actions' |
|
|
|
import type { State } from 'reducers' |
|
|
|
import { accountsSelector } from './accounts' |
|
|
|
import { activeAccountsSelector } from './accounts' |
|
|
|
|
|
|
|
export type AsyncState = { |
|
|
|
pending: boolean, |
|
|
@ -45,7 +45,7 @@ export const syncStateLocalSelector = ( |
|
|
|
) => bridgeSync.syncs[accountId] || nothingState |
|
|
|
|
|
|
|
export const globalSyncStateSelector = createSelector( |
|
|
|
accountsSelector, |
|
|
|
activeAccountsSelector, |
|
|
|
bridgeSyncSelector, |
|
|
|
(accounts, bridgeSync) => { |
|
|
|
const globalSyncState: AsyncState = { |
|
|
|