From 474ec39a5fca4f7074070b420d9ff2ddef34f2dd Mon Sep 17 00:00:00 2001 From: sneurlax Date: Mon, 11 Sep 2023 18:08:27 -0500 Subject: [PATCH] filter non tor exchanges from the exchange provider options list --- .../sub_widgets/exchange_provider_options.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart b/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart index 13330e2f9..6f0108f66 100644 --- a/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart +++ b/lib/pages/exchange_view/sub_widgets/exchange_provider_options.dart @@ -14,9 +14,11 @@ import 'package:stackwallet/models/exchange/aggregate_currency.dart'; import 'package:stackwallet/pages/exchange_view/sub_widgets/exchange_provider_option.dart'; import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart'; +import 'package:stackwallet/services/exchange/exchange.dart'; import 'package:stackwallet/services/exchange/majestic_bank/majestic_bank_exchange.dart'; import 'package:stackwallet/services/exchange/trocador/trocador_exchange.dart'; import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/utilities/prefs.dart'; import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart'; @@ -44,6 +46,13 @@ class _ExchangeProviderOptionsState required AggregateCurrency? sendCurrency, required AggregateCurrency? receiveCurrency, }) { + // If using Tor, only allow exchanges that support it. + if (Prefs.instance.useTor) { + if (!Exchange.exchangeNamesWithTorSupport.contains(exchangeName)) { + return false; + } + } + final send = sendCurrency?.forExchange(exchangeName); if (send == null) return false;