From 3e36723da305bebe9b3d0a3e1b335e9724664456 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 7 Sep 2023 15:37:23 -0500 Subject: [PATCH] TorStatusChangedEvent->TorPreferenceChangedEvent --- lib/electrumx_rpc/electrumx.dart | 4 ++-- lib/networking/tor_service.dart | 2 ++ .../event_bus/events/global/tor_status_changed_event.dart | 4 ++-- lib/utilities/prefs.dart | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/electrumx_rpc/electrumx.dart b/lib/electrumx_rpc/electrumx.dart index 81dc67148..847a92aa1 100644 --- a/lib/electrumx_rpc/electrumx.dart +++ b/lib/electrumx_rpc/electrumx.dart @@ -82,7 +82,7 @@ class ElectrumX { static final Finalizer _finalizer = Finalizer( (p0) => p0._torStatusListener?.cancel(), ); - StreamSubscription? _torStatusListener; + StreamSubscription? _torStatusListener; ElectrumX({ required String host, @@ -104,7 +104,7 @@ class ElectrumX { _rpcClient = client; final bus = globalEventBusForTesting ?? GlobalEventBus.instance; - _torStatusListener = bus.on().listen( + _torStatusListener = bus.on().listen( (event) async { // not sure if we need to do anything specific here // switch (event.status) { diff --git a/lib/networking/tor_service.dart b/lib/networking/tor_service.dart index 02d520db6..2a13a8006 100644 --- a/lib/networking/tor_service.dart +++ b/lib/networking/tor_service.dart @@ -29,6 +29,7 @@ class TorService { // already started so just return // could throw an exception here or something so the caller // is explicitly made aware of this + // TODO restart tor after that's been added to the tor-ffi crate return; } @@ -51,6 +52,7 @@ class TorService { // already stopped so just return // could throw an exception here or something so the caller // is explicitly made aware of this + // TODO make sure to kill return; } diff --git a/lib/services/event_bus/events/global/tor_status_changed_event.dart b/lib/services/event_bus/events/global/tor_status_changed_event.dart index cf9cac5ee..6f974bf75 100644 --- a/lib/services/event_bus/events/global/tor_status_changed_event.dart +++ b/lib/services/event_bus/events/global/tor_status_changed_event.dart @@ -12,11 +12,11 @@ import 'package:stackwallet/utilities/logger.dart'; enum TorStatus { enabled, disabled } -class TorStatusChangedEvent { +class TorPreferenceChangedEvent { String? message; TorStatus status; - TorStatusChangedEvent({ + TorPreferenceChangedEvent({ required this.status, this.message, }) { diff --git a/lib/utilities/prefs.dart b/lib/utilities/prefs.dart index 8adb19ce3..027c6037d 100644 --- a/lib/utilities/prefs.dart +++ b/lib/utilities/prefs.dart @@ -911,7 +911,7 @@ class Prefs extends ChangeNotifier { _useTor = useTor; notifyListeners(); GlobalEventBus.instance.fire( - TorStatusChangedEvent( + TorPreferenceChangedEvent( status: useTor ? TorStatus.enabled : TorStatus.disabled, message: "useTor updated in prefs", ),