diff --git a/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart b/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart index 1be2885b7..ada195455 100644 --- a/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart +++ b/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart @@ -154,10 +154,6 @@ class _ExchangeCurrencySelectionViewState } Future> _getCurrencies() async { - // This is where exchanges are added to the list of available currencies. - // - // TODO: make an exchange's addition to the list of available currencies - // be dynamic and dependant upon the exchange's supportsTor implementation. final currencies = await ExchangeDataLoadingService.instance.isar.currencies .where() .filter() @@ -178,12 +174,10 @@ class _ExchangeCurrencySelectionViewState // If using Tor, filter exchanges which do not support Tor. if (Prefs.instance.useTor) { - if (Exchange.exchangesWithTorSupport.isNotEmpty) { - currencies - .removeWhere((element) => !Exchange.exchangesWithTorSupport.any( - (e) => e.name == element.exchangeName, - )); - // Could have also filtered using the List Exchange.exchangeNamesWithTorSupport. But I didn't. This is fancier. + if (Exchange.exchangeNamesWithTorSupport.isNotEmpty) { + currencies.removeWhere((element) => !Exchange + .exchangeNamesWithTorSupport + .contains(element.exchangeName)); } } diff --git a/lib/services/exchange/exchange.dart b/lib/services/exchange/exchange.dart index 9530639ee..a8553854c 100644 --- a/lib/services/exchange/exchange.dart +++ b/lib/services/exchange/exchange.dart @@ -107,8 +107,8 @@ abstract class Exchange { static List get exchangeNamesWithTorSupport => exchangesWithTorSupport.map((exchange) => exchange.name).toList(); // Instead of using this, you can do like: - // currencies - // .removeWhere((element) => !Exchange.exchangesWithTorSupport.any( - // (e) => e.name == element.exchangeName, - // )); + // currencies.removeWhere((element) => + // !Exchange.exchangesWithTorSupport.any((e) => e.name == element.exchangeName) + // ); + // But this helper may be more readable. }