mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
TorStatusChangedEvent->TorPreferenceChangedEvent
This commit is contained in:
parent
67beaf21cd
commit
3e36723da3
4 changed files with 7 additions and 5 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
}) {
|
||||
|
|
|
@ -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",
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue