TorStatusChangedEvent->TorPreferenceChangedEvent

This commit is contained in:
sneurlax 2023-09-07 15:37:23 -05:00
parent 67beaf21cd
commit 3e36723da3
4 changed files with 7 additions and 5 deletions

View file

@ -82,7 +82,7 @@ class ElectrumX {
static final Finalizer<ElectrumX> _finalizer = Finalizer(
(p0) => p0._torStatusListener?.cancel(),
);
StreamSubscription<TorStatusChangedEvent>? _torStatusListener;
StreamSubscription<TorPreferenceChangedEvent>? _torStatusListener;
ElectrumX({
required String host,
@ -104,7 +104,7 @@ class ElectrumX {
_rpcClient = client;
final bus = globalEventBusForTesting ?? GlobalEventBus.instance;
_torStatusListener = bus.on<TorStatusChangedEvent>().listen(
_torStatusListener = bus.on<TorPreferenceChangedEvent>().listen(
(event) async {
// not sure if we need to do anything specific here
// switch (event.status) {

View file

@ -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;
}

View file

@ -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,
}) {

View file

@ -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",
),