Browse Source

LL-1063 Account for terminated cryptos

develop
Juan Cortes Ross 6 years ago
parent
commit
4982c3e3d1
No known key found for this signature in database GPG Key ID: 34A99C03E9455EB8
  1. 14
      src/components/CurrenciesStatusBanner.js
  2. 7
      src/components/ManagerPage/AppsList.js
  3. 10
      src/config/cryptocurrencies.js
  4. 3
      static/i18n/en/app.json

14
src/components/CurrenciesStatusBanner.js

@ -15,6 +15,7 @@ import IconCross from 'icons/Cross'
import IconTriangleWarning from 'icons/TriangleWarning' import IconTriangleWarning from 'icons/TriangleWarning'
import IconChevronRight from 'icons/ChevronRight' import IconChevronRight from 'icons/ChevronRight'
import { listCryptoCurrencies } from 'config/cryptocurrencies'
import { dismissedBannersSelector } from 'reducers/settings' import { dismissedBannersSelector } from 'reducers/settings'
import { currenciesStatusSelector, fetchCurrenciesStatus } from 'reducers/currenciesStatus' import { currenciesStatusSelector, fetchCurrenciesStatus } from 'reducers/currenciesStatus'
import { currenciesSelector } from 'reducers/accounts' import { currenciesSelector } from 'reducers/accounts'
@ -92,11 +93,22 @@ class CurrenciesStatusBanner extends PureComponent<Props> {
render() { render() {
const { dismissedBanners, accountsCurrencies, currenciesStatus, t } = this.props const { dismissedBanners, accountsCurrencies, currenciesStatus, t } = this.props
const filtered = currenciesStatus.filter(
const currenciesStatusWithTerminated = currenciesStatus.concat(
listCryptoCurrencies(true, true).map(coin => ({
id: coin.id,
nonce: 98,
message: t('banners.genericTerminatedCrypto', { coinName: coin.name }),
link: coin.terminated && coin.terminated.link || "#",
})),
)
const filtered = currenciesStatusWithTerminated.filter(
item => item =>
accountsCurrencies.find(cur => cur.id === item.id) && accountsCurrencies.find(cur => cur.id === item.id) &&
dismissedBanners.indexOf(getItemKey(item)) === -1, dismissedBanners.indexOf(getItemKey(item)) === -1,
) )
if (!filtered.length) return null if (!filtered.length) return null
return ( return (
<Box flow={2} style={styles.container}> <Box flow={2} style={styles.container}>

7
src/components/ManagerPage/AppsList.js

@ -9,8 +9,10 @@ import { compose } from 'redux'
import type { Device, T } from 'types/common' import type { Device, T } from 'types/common'
import type { ApplicationVersion, DeviceInfo } from '@ledgerhq/live-common/lib/types/manager' import type { ApplicationVersion, DeviceInfo } from '@ledgerhq/live-common/lib/types/manager'
import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types/currencies'
import manager from '@ledgerhq/live-common/lib/manager' import manager from '@ledgerhq/live-common/lib/manager'
import { getFullListSortedCryptoCurrencies } from 'helpers/countervalues' import { getFullListSortedCryptoCurrencies } from 'helpers/countervalues'
import { listCryptoCurrencies } from 'config/cryptocurrencies'
import { developerModeSelector } from 'reducers/settings' import { developerModeSelector } from 'reducers/settings'
import installApp from 'commands/installApp' import installApp from 'commands/installApp'
import uninstallApp from 'commands/uninstallApp' import uninstallApp from 'commands/uninstallApp'
@ -89,7 +91,10 @@ type State = {
} }
const oldAppsInstallDisabled = ['ZenCash', 'Ripple'] const oldAppsInstallDisabled = ['ZenCash', 'Ripple']
const canHandleInstall = c => !oldAppsInstallDisabled.includes(c.name) const terminatedCryptoCurrencies: Array<CryptoCurrency> = listCryptoCurrencies(true, true)
const canHandleInstall = app =>
!oldAppsInstallDisabled.includes(app.name) &&
!terminatedCryptoCurrencies.some(coin => coin.managerAppName === app.name)
const LoadingApp = () => ( const LoadingApp = () => (
<FakeManagerAppContainer noShadow align="center" justify="center" style={{ height: 90 }}> <FakeManagerAppContainer noShadow align="center" justify="center" style={{ height: 90 }}>

10
src/config/cryptocurrencies.js

@ -32,8 +32,10 @@ const supported: CryptoCurrencyIds[] = [
'bitcoin_testnet', 'bitcoin_testnet',
] ]
export const listCryptoCurrencies = memoize((withDevCrypto?: boolean) => export const listCryptoCurrencies = memoize(
listCC(withDevCrypto) (withDevCrypto?: boolean, onlyTerminated?: boolean = false) =>
.filter(c => supported.includes(c.id)) listCC(withDevCrypto)
.sort((a, b) => a.name.localeCompare(b.name)), .filter(c => supported.includes(c.id))
.filter(c => (onlyTerminated ? c.terminated : !c.terminated))
.sort((a, b) => a.name.localeCompare(b.name)),
) )

3
static/i18n/en/app.json

@ -112,7 +112,8 @@
} }
}, },
"banners": { "banners": {
"promoteMobile": "Enjoy the Ledger Live experience, now available on mobile with the Ledger Nano X" "promoteMobile": "Enjoy the Ledger Live experience, now available on mobile with the Ledger Nano X",
"genericTerminatedCrypto": "{{coinName}} has been terminated"
}, },
"dashboard": { "dashboard": {
"title": "Portfolio", "title": "Portfolio",

Loading…
Cancel
Save