diff --git a/lib/pages/home_view/home_view.dart b/lib/pages/home_view/home_view.dart index 33acd0d62..c2f71bf48 100644 --- a/lib/pages/home_view/home_view.dart +++ b/lib/pages/home_view/home_view.dart @@ -118,32 +118,6 @@ class _HomeViewState extends ConsumerState { ); } - Widget _buildTorIcon(TorConnectionStatus status) { - switch (status) { - case TorConnectionStatus.disconnected: - return SvgPicture.asset( - Assets.svg.tor, - color: Theme.of(context).extension()!.textSubtitle3, - width: 20, - height: 20, - ); - case TorConnectionStatus.connected: - return SvgPicture.asset( - Assets.svg.tor, - color: Theme.of(context).extension()!.accentColorGreen, - width: 20, - height: 20, - ); - case TorConnectionStatus.connecting: - return SvgPicture.asset( - Assets.svg.tor, - color: Theme.of(context).extension()!.accentColorYellow, - width: 20, - height: 20, - ); - } - } - @override void initState() { _pageController = PageController(); diff --git a/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart b/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart index f271b292a..f76d29b3e 100644 --- a/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart @@ -375,6 +375,11 @@ class _TorSettingsViewState extends ConsumerState { // Init the Tor service if it hasn't already been. ref.read(pTorService).init(); + // Update the UI. + setState(() { + _networkStatus = TorConnectionStatus.connecting; + }); + // Start the Tor service. try { await ref.read(pTorService).start(); @@ -388,11 +393,6 @@ class _TorSettingsViewState extends ConsumerState { ); } - // Update the UI. - setState(() { - _networkStatus = TorConnectionStatus.connecting; - }); - return; } diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart index c9e391320..7e15c6e7d 100644 --- a/lib/pages/wallet_view/wallet_view.dart +++ b/lib/pages/wallet_view/wallet_view.dart @@ -29,6 +29,7 @@ import 'package:stackwallet/pages/paynym/paynym_claim_view.dart'; import 'package:stackwallet/pages/paynym/paynym_home_view.dart'; import 'package:stackwallet/pages/receive_view/receive_view.dart'; import 'package:stackwallet/pages/send_view/send_view.dart'; +import 'package:stackwallet/pages/settings_views/global_settings_view/tor_settings/tor_settings_view.dart'; import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart'; import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_view.dart'; import 'package:stackwallet/pages/special/firo_rescan_recovery_error_dialog.dart'; @@ -51,6 +52,7 @@ import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_ import 'package:stackwallet/services/event_bus/global_event_bus.dart'; import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart'; import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart'; +import 'package:stackwallet/services/tor_service.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/theme_providers.dart'; @@ -552,6 +554,56 @@ class _WalletViewState extends ConsumerState { ], ), actions: [ + Padding( + padding: const EdgeInsets.only( + top: 10, + bottom: 10, + right: 10, + ), + child: AspectRatio( + aspectRatio: 1, + child: AppBarIconButton( + semanticsLabel: + "Tor Settings Button. Takes To Tor Settings Page.", + key: const Key("walletsViewTorButton"), + size: 36, + shadows: const [], + color: Theme.of(context) + .extension()! + .backgroundAppBar, + icon: ref.watch(pTorService).enabled + ? ref.read(pTorService).proxyInfo.port == -1 + ? SvgPicture.asset( + Assets.svg.tor, + color: Theme.of(context) + .extension()! + .accentColorYellow, + width: 20, + height: 20, + ) + : SvgPicture.asset( + Assets.svg.tor, + color: Theme.of(context) + .extension()! + .accentColorGreen, + width: 20, + height: 20, + ) + : SvgPicture.asset( + Assets.svg.tor, + color: Theme.of(context) + .extension()! + .textSubtitle3, + width: 20, + height: 20, + ), + onPressed: () { + Navigator.of(context) + .pushNamed(TorSettingsView.routeName); + }, + ), + ), + ), Padding( padding: const EdgeInsets.only( top: 10,