From a8ed46d8041058392163dc09936090fbda0f1102 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 7 Sep 2023 15:44:53 -0500 Subject: [PATCH] TorSyncStatusEvent->TorConnectionStatusEvent and rename file --- lib/pages/home_view/home_view.dart | 14 ++++++------- ... tor_connection_status_changed_event.dart} | 8 ++++---- .../tor_settings/tor_settings_view.dart | 20 +++++++++---------- lib/pages_desktop_specific/desktop_menu.dart | 12 +++++------ 4 files changed, 27 insertions(+), 27 deletions(-) rename lib/pages/home_view/sub_widgets/{tor_sync_status_changed_event.dart => tor_connection_status_changed_event.dart} (68%) diff --git a/lib/pages/home_view/home_view.dart b/lib/pages/home_view/home_view.dart index 759c7760d..71427ab4c 100644 --- a/lib/pages/home_view/home_view.dart +++ b/lib/pages/home_view/home_view.dart @@ -17,7 +17,7 @@ import 'package:flutter_svg/svg.dart'; import 'package:stackwallet/pages/buy_view/buy_view.dart'; import 'package:stackwallet/pages/exchange_view/exchange_view.dart'; import 'package:stackwallet/pages/home_view/sub_widgets/home_view_button_bar.dart'; -import 'package:stackwallet/pages/home_view/sub_widgets/tor_sync_status_changed_event.dart'; +import 'package:stackwallet/pages/home_view/sub_widgets/tor_connection_status_changed_event.dart'; import 'package:stackwallet/pages/notification_views/notifications_view.dart'; import 'package:stackwallet/pages/settings_views/global_settings_view/global_settings_view.dart'; import 'package:stackwallet/pages/settings_views/global_settings_view/hidden_settings.dart'; @@ -57,7 +57,7 @@ class _HomeViewState extends ConsumerState { bool _exitEnabled = false; - late TorSyncStatus _currentSyncStatus; + late TorConnectionStatus _currentSyncStatus; // final _buyDataLoadingService = BuyDataLoadingService(); @@ -117,23 +117,23 @@ class _HomeViewState extends ConsumerState { ); } - Widget _buildTorIcon(TorSyncStatus status) { + Widget _buildTorIcon(TorConnectionStatus status) { switch (status) { - case TorSyncStatus.unableToSync: + case TorConnectionStatus.unableToConnect: return SvgPicture.asset( Assets.svg.tor, color: Theme.of(context).extension()!.textSubtitle3, width: 20, height: 20, ); - case TorSyncStatus.synced: + case TorConnectionStatus.connected: return SvgPicture.asset( Assets.svg.tor, color: Theme.of(context).extension()!.accentColorGreen, width: 20, height: 20, ); - case TorSyncStatus.syncing: + case TorConnectionStatus.connecting: return SvgPicture.asset( Assets.svg.tor, color: Theme.of(context).extension()!.accentColorYellow, @@ -261,7 +261,7 @@ class _HomeViewState extends ConsumerState { color: Theme.of(context) .extension()! .backgroundAppBar, - icon: _buildTorIcon(TorSyncStatus.unableToSync), + icon: _buildTorIcon(TorConnectionStatus.unableToConnect), onPressed: () { Navigator.of(context) .pushNamed(TorSettingsView.routeName); diff --git a/lib/pages/home_view/sub_widgets/tor_sync_status_changed_event.dart b/lib/pages/home_view/sub_widgets/tor_connection_status_changed_event.dart similarity index 68% rename from lib/pages/home_view/sub_widgets/tor_sync_status_changed_event.dart rename to lib/pages/home_view/sub_widgets/tor_connection_status_changed_event.dart index 87910b806..00682d32e 100644 --- a/lib/pages/home_view/sub_widgets/tor_sync_status_changed_event.dart +++ b/lib/pages/home_view/sub_widgets/tor_connection_status_changed_event.dart @@ -9,12 +9,12 @@ */ import 'package:stackwallet/utilities/logger.dart'; -enum TorSyncStatus { unableToSync, synced, syncing } +enum TorConnectionStatus { unableToConnect, connected, connecting } -class TorSyncStatusChangedEvent { - TorSyncStatus newStatus; +class TorConnectionStatusChangedEvent { + TorConnectionStatus newStatus; - TorSyncStatusChangedEvent(this.newStatus) { + TorConnectionStatusChangedEvent(this.newStatus) { Logging.instance.log( "TorSyncStatusChangedEvent fired with arg newStatus = $newStatus", level: LogLevel.Info); 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 8304eb851..731f31f1a 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 @@ -11,7 +11,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:stackwallet/pages/home_view/sub_widgets/tor_sync_status_changed_event.dart'; +import 'package:stackwallet/pages/home_view/sub_widgets/tor_connection_status_changed_event.dart'; import 'package:stackwallet/providers/global/prefs_provider.dart'; import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/assets.dart'; @@ -35,11 +35,11 @@ class TorSettingsView extends ConsumerStatefulWidget { } class _TorSettingsViewState extends ConsumerState { - TorSyncStatus _networkStatus = TorSyncStatus.unableToSync; + TorConnectionStatus _networkStatus = TorConnectionStatus.unableToConnect; - Widget _buildTorIcon(TorSyncStatus status) { + Widget _buildTorIcon(TorConnectionStatus status) { switch (status) { - case TorSyncStatus.unableToSync: + case TorConnectionStatus.unableToConnect: return Stack( alignment: AlignmentDirectional.center, children: [ @@ -56,7 +56,7 @@ class _TorSettingsViewState extends ConsumerState { ) ], ); - case TorSyncStatus.synced: + case TorConnectionStatus.connected: return Stack( alignment: AlignmentDirectional.center, children: [ @@ -74,7 +74,7 @@ class _TorSettingsViewState extends ConsumerState { ) ], ); - case TorSyncStatus.syncing: + case TorConnectionStatus.connecting: return Stack( alignment: AlignmentDirectional.center, children: [ @@ -95,22 +95,22 @@ class _TorSettingsViewState extends ConsumerState { } } - Widget _buildTorStatus(TorSyncStatus status) { + Widget _buildTorStatus(TorConnectionStatus status) { switch (status) { - case TorSyncStatus.unableToSync: + case TorConnectionStatus.unableToConnect: return Text( "Disconnected", style: STextStyles.itemSubtitle(context).copyWith( color: Theme.of(context).extension()!.textSubtitle3), ); - case TorSyncStatus.synced: + case TorConnectionStatus.connected: return Text( "Connected", style: STextStyles.itemSubtitle(context).copyWith( color: Theme.of(context).extension()!.accentColorGreen), ); - case TorSyncStatus.syncing: + case TorConnectionStatus.connecting: return Text( "Connecting", style: STextStyles.itemSubtitle(context).copyWith( diff --git a/lib/pages_desktop_specific/desktop_menu.dart b/lib/pages_desktop_specific/desktop_menu.dart index b21a1d724..62aa30ec8 100644 --- a/lib/pages_desktop_specific/desktop_menu.dart +++ b/lib/pages_desktop_specific/desktop_menu.dart @@ -14,7 +14,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:stackwallet/pages/home_view/sub_widgets/tor_sync_status_changed_event.dart'; +import 'package:stackwallet/pages/home_view/sub_widgets/tor_connection_status_changed_event.dart'; import 'package:stackwallet/pages_desktop_specific/desktop_menu_item.dart'; import 'package:stackwallet/pages_desktop_specific/settings/settings_menu.dart'; import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart'; @@ -59,9 +59,9 @@ class _DesktopMenuState extends ConsumerState { // final _buyDataLoadingService = BuyDataLoadingService(); - Widget _buildTorIcon(TorSyncStatus status) { + Widget _buildTorIcon(TorConnectionStatus status) { switch (status) { - case TorSyncStatus.unableToSync: + case TorConnectionStatus.unableToConnect: return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -80,7 +80,7 @@ class _DesktopMenuState extends ConsumerState { ) ], ); - case TorSyncStatus.synced: + case TorConnectionStatus.connected: return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -100,7 +100,7 @@ class _DesktopMenuState extends ConsumerState { ) ], ); - case TorSyncStatus.syncing: + case TorConnectionStatus.connecting: return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -218,7 +218,7 @@ class _DesktopMenuState extends ConsumerState { .watch(selectedSettingsMenuItemStateProvider.state) .state = 4; }, - child: _buildTorIcon(TorSyncStatus.unableToSync)), + child: _buildTorIcon(TorConnectionStatus.unableToConnect)), ), const SizedBox( height: 40,