diff --git a/src/components/CurrenciesStatusBanner.js b/src/components/CurrenciesStatusBanner.js index 2138f73d..fb29a1f0 100644 --- a/src/components/CurrenciesStatusBanner.js +++ b/src/components/CurrenciesStatusBanner.js @@ -15,6 +15,7 @@ import IconCross from 'icons/Cross' import IconTriangleWarning from 'icons/TriangleWarning' import IconChevronRight from 'icons/ChevronRight' +import { listCryptoCurrencies } from 'config/cryptocurrencies' import { dismissedBannersSelector } from 'reducers/settings' import { currenciesStatusSelector, fetchCurrenciesStatus } from 'reducers/currenciesStatus' import { currenciesSelector } from 'reducers/accounts' @@ -92,11 +93,22 @@ class CurrenciesStatusBanner extends PureComponent { render() { 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 => accountsCurrencies.find(cur => cur.id === item.id) && dismissedBanners.indexOf(getItemKey(item)) === -1, ) + if (!filtered.length) return null return ( diff --git a/src/components/ManagerPage/AppsList.js b/src/components/ManagerPage/AppsList.js index d2935f46..7f8267c7 100644 --- a/src/components/ManagerPage/AppsList.js +++ b/src/components/ManagerPage/AppsList.js @@ -9,8 +9,10 @@ import { compose } from 'redux' import type { Device, T } from 'types/common' 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 { getFullListSortedCryptoCurrencies } from 'helpers/countervalues' +import { listCryptoCurrencies } from 'config/cryptocurrencies' import { developerModeSelector } from 'reducers/settings' import installApp from 'commands/installApp' import uninstallApp from 'commands/uninstallApp' @@ -89,7 +91,10 @@ type State = { } const oldAppsInstallDisabled = ['ZenCash', 'Ripple'] -const canHandleInstall = c => !oldAppsInstallDisabled.includes(c.name) +const terminatedCryptoCurrencies: Array = listCryptoCurrencies(true, true) +const canHandleInstall = app => + !oldAppsInstallDisabled.includes(app.name) && + !terminatedCryptoCurrencies.some(coin => coin.managerAppName === app.name) const LoadingApp = () => ( diff --git a/src/config/cryptocurrencies.js b/src/config/cryptocurrencies.js index 4c29f7b3..a38a90c1 100644 --- a/src/config/cryptocurrencies.js +++ b/src/config/cryptocurrencies.js @@ -32,8 +32,10 @@ const supported: CryptoCurrencyIds[] = [ 'bitcoin_testnet', ] -export const listCryptoCurrencies = memoize((withDevCrypto?: boolean) => - listCC(withDevCrypto) - .filter(c => supported.includes(c.id)) - .sort((a, b) => a.name.localeCompare(b.name)), +export const listCryptoCurrencies = memoize( + (withDevCrypto?: boolean, onlyTerminated?: boolean = false) => + listCC(withDevCrypto) + .filter(c => supported.includes(c.id)) + .filter(c => (onlyTerminated ? c.terminated : !c.terminated)) + .sort((a, b) => a.name.localeCompare(b.name)), ) diff --git a/static/i18n/en/app.json b/static/i18n/en/app.json index 9aed68e6..cdfb36c2 100644 --- a/static/i18n/en/app.json +++ b/static/i18n/en/app.json @@ -112,7 +112,8 @@ } }, "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": { "title": "Portfolio",