mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +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(
|
static final Finalizer<ElectrumX> _finalizer = Finalizer(
|
||||||
(p0) => p0._torStatusListener?.cancel(),
|
(p0) => p0._torStatusListener?.cancel(),
|
||||||
);
|
);
|
||||||
StreamSubscription<TorStatusChangedEvent>? _torStatusListener;
|
StreamSubscription<TorPreferenceChangedEvent>? _torStatusListener;
|
||||||
|
|
||||||
ElectrumX({
|
ElectrumX({
|
||||||
required String host,
|
required String host,
|
||||||
|
@ -104,7 +104,7 @@ class ElectrumX {
|
||||||
_rpcClient = client;
|
_rpcClient = client;
|
||||||
|
|
||||||
final bus = globalEventBusForTesting ?? GlobalEventBus.instance;
|
final bus = globalEventBusForTesting ?? GlobalEventBus.instance;
|
||||||
_torStatusListener = bus.on<TorStatusChangedEvent>().listen(
|
_torStatusListener = bus.on<TorPreferenceChangedEvent>().listen(
|
||||||
(event) async {
|
(event) async {
|
||||||
// not sure if we need to do anything specific here
|
// not sure if we need to do anything specific here
|
||||||
// switch (event.status) {
|
// switch (event.status) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ class TorService {
|
||||||
// already started so just return
|
// already started so just return
|
||||||
// could throw an exception here or something so the caller
|
// could throw an exception here or something so the caller
|
||||||
// is explicitly made aware of this
|
// is explicitly made aware of this
|
||||||
|
// TODO restart tor after that's been added to the tor-ffi crate
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ class TorService {
|
||||||
// already stopped so just return
|
// already stopped so just return
|
||||||
// could throw an exception here or something so the caller
|
// could throw an exception here or something so the caller
|
||||||
// is explicitly made aware of this
|
// is explicitly made aware of this
|
||||||
|
// TODO make sure to kill
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@ import 'package:stackwallet/utilities/logger.dart';
|
||||||
|
|
||||||
enum TorStatus { enabled, disabled }
|
enum TorStatus { enabled, disabled }
|
||||||
|
|
||||||
class TorStatusChangedEvent {
|
class TorPreferenceChangedEvent {
|
||||||
String? message;
|
String? message;
|
||||||
TorStatus status;
|
TorStatus status;
|
||||||
|
|
||||||
TorStatusChangedEvent({
|
TorPreferenceChangedEvent({
|
||||||
required this.status,
|
required this.status,
|
||||||
this.message,
|
this.message,
|
||||||
}) {
|
}) {
|
||||||
|
|
|
@ -911,7 +911,7 @@ class Prefs extends ChangeNotifier {
|
||||||
_useTor = useTor;
|
_useTor = useTor;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
GlobalEventBus.instance.fire(
|
GlobalEventBus.instance.fire(
|
||||||
TorStatusChangedEvent(
|
TorPreferenceChangedEvent(
|
||||||
status: useTor ? TorStatus.enabled : TorStatus.disabled,
|
status: useTor ? TorStatus.enabled : TorStatus.disabled,
|
||||||
message: "useTor updated in prefs",
|
message: "useTor updated in prefs",
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue