TorSyncStatusEvent->TorConnectionStatusEvent

and rename file
This commit is contained in:
sneurlax 2023-09-07 15:44:53 -05:00
parent 3e36723da3
commit a8ed46d804
4 changed files with 27 additions and 27 deletions

View file

@ -17,7 +17,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages/buy_view/buy_view.dart'; import 'package:stackwallet/pages/buy_view/buy_view.dart';
import 'package:stackwallet/pages/exchange_view/exchange_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/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/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/global_settings_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/hidden_settings.dart'; import 'package:stackwallet/pages/settings_views/global_settings_view/hidden_settings.dart';
@ -57,7 +57,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
bool _exitEnabled = false; bool _exitEnabled = false;
late TorSyncStatus _currentSyncStatus; late TorConnectionStatus _currentSyncStatus;
// final _buyDataLoadingService = BuyDataLoadingService(); // final _buyDataLoadingService = BuyDataLoadingService();
@ -117,23 +117,23 @@ class _HomeViewState extends ConsumerState<HomeView> {
); );
} }
Widget _buildTorIcon(TorSyncStatus status) { Widget _buildTorIcon(TorConnectionStatus status) {
switch (status) { switch (status) {
case TorSyncStatus.unableToSync: case TorConnectionStatus.unableToConnect:
return SvgPicture.asset( return SvgPicture.asset(
Assets.svg.tor, Assets.svg.tor,
color: Theme.of(context).extension<StackColors>()!.textSubtitle3, color: Theme.of(context).extension<StackColors>()!.textSubtitle3,
width: 20, width: 20,
height: 20, height: 20,
); );
case TorSyncStatus.synced: case TorConnectionStatus.connected:
return SvgPicture.asset( return SvgPicture.asset(
Assets.svg.tor, Assets.svg.tor,
color: Theme.of(context).extension<StackColors>()!.accentColorGreen, color: Theme.of(context).extension<StackColors>()!.accentColorGreen,
width: 20, width: 20,
height: 20, height: 20,
); );
case TorSyncStatus.syncing: case TorConnectionStatus.connecting:
return SvgPicture.asset( return SvgPicture.asset(
Assets.svg.tor, Assets.svg.tor,
color: Theme.of(context).extension<StackColors>()!.accentColorYellow, color: Theme.of(context).extension<StackColors>()!.accentColorYellow,
@ -261,7 +261,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
color: Theme.of(context) color: Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.backgroundAppBar, .backgroundAppBar,
icon: _buildTorIcon(TorSyncStatus.unableToSync), icon: _buildTorIcon(TorConnectionStatus.unableToConnect),
onPressed: () { onPressed: () {
Navigator.of(context) Navigator.of(context)
.pushNamed(TorSettingsView.routeName); .pushNamed(TorSettingsView.routeName);

View file

@ -9,12 +9,12 @@
*/ */
import 'package:stackwallet/utilities/logger.dart'; import 'package:stackwallet/utilities/logger.dart';
enum TorSyncStatus { unableToSync, synced, syncing } enum TorConnectionStatus { unableToConnect, connected, connecting }
class TorSyncStatusChangedEvent { class TorConnectionStatusChangedEvent {
TorSyncStatus newStatus; TorConnectionStatus newStatus;
TorSyncStatusChangedEvent(this.newStatus) { TorConnectionStatusChangedEvent(this.newStatus) {
Logging.instance.log( Logging.instance.log(
"TorSyncStatusChangedEvent fired with arg newStatus = $newStatus", "TorSyncStatusChangedEvent fired with arg newStatus = $newStatus",
level: LogLevel.Info); level: LogLevel.Info);

View file

@ -11,7 +11,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.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/providers/global/prefs_provider.dart';
import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
@ -35,11 +35,11 @@ class TorSettingsView extends ConsumerStatefulWidget {
} }
class _TorSettingsViewState extends ConsumerState<TorSettingsView> { class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
TorSyncStatus _networkStatus = TorSyncStatus.unableToSync; TorConnectionStatus _networkStatus = TorConnectionStatus.unableToConnect;
Widget _buildTorIcon(TorSyncStatus status) { Widget _buildTorIcon(TorConnectionStatus status) {
switch (status) { switch (status) {
case TorSyncStatus.unableToSync: case TorConnectionStatus.unableToConnect:
return Stack( return Stack(
alignment: AlignmentDirectional.center, alignment: AlignmentDirectional.center,
children: [ children: [
@ -56,7 +56,7 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
) )
], ],
); );
case TorSyncStatus.synced: case TorConnectionStatus.connected:
return Stack( return Stack(
alignment: AlignmentDirectional.center, alignment: AlignmentDirectional.center,
children: [ children: [
@ -74,7 +74,7 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
) )
], ],
); );
case TorSyncStatus.syncing: case TorConnectionStatus.connecting:
return Stack( return Stack(
alignment: AlignmentDirectional.center, alignment: AlignmentDirectional.center,
children: [ children: [
@ -95,22 +95,22 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
} }
} }
Widget _buildTorStatus(TorSyncStatus status) { Widget _buildTorStatus(TorConnectionStatus status) {
switch (status) { switch (status) {
case TorSyncStatus.unableToSync: case TorConnectionStatus.unableToConnect:
return Text( return Text(
"Disconnected", "Disconnected",
style: STextStyles.itemSubtitle(context).copyWith( style: STextStyles.itemSubtitle(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textSubtitle3), color: Theme.of(context).extension<StackColors>()!.textSubtitle3),
); );
case TorSyncStatus.synced: case TorConnectionStatus.connected:
return Text( return Text(
"Connected", "Connected",
style: STextStyles.itemSubtitle(context).copyWith( style: STextStyles.itemSubtitle(context).copyWith(
color: color:
Theme.of(context).extension<StackColors>()!.accentColorGreen), Theme.of(context).extension<StackColors>()!.accentColorGreen),
); );
case TorSyncStatus.syncing: case TorConnectionStatus.connecting:
return Text( return Text(
"Connecting", "Connecting",
style: STextStyles.itemSubtitle(context).copyWith( style: STextStyles.itemSubtitle(context).copyWith(

View file

@ -14,7 +14,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.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/desktop_menu_item.dart';
import 'package:stackwallet/pages_desktop_specific/settings/settings_menu.dart'; import 'package:stackwallet/pages_desktop_specific/settings/settings_menu.dart';
import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart'; import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart';
@ -59,9 +59,9 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
// final _buyDataLoadingService = BuyDataLoadingService(); // final _buyDataLoadingService = BuyDataLoadingService();
Widget _buildTorIcon(TorSyncStatus status) { Widget _buildTorIcon(TorConnectionStatus status) {
switch (status) { switch (status) {
case TorSyncStatus.unableToSync: case TorConnectionStatus.unableToConnect:
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -80,7 +80,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
) )
], ],
); );
case TorSyncStatus.synced: case TorConnectionStatus.connected:
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -100,7 +100,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
) )
], ],
); );
case TorSyncStatus.syncing: case TorConnectionStatus.connecting:
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -218,7 +218,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
.watch(selectedSettingsMenuItemStateProvider.state) .watch(selectedSettingsMenuItemStateProvider.state)
.state = 4; .state = 4;
}, },
child: _buildTorIcon(TorSyncStatus.unableToSync)), child: _buildTorIcon(TorConnectionStatus.unableToConnect)),
), ),
const SizedBox( const SizedBox(
height: 40, height: 40,