mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-03 09:19:22 +00:00
Tor kill switch getter name refactor and bugfix
This commit is contained in:
parent
af88673df1
commit
4b518243c6
4 changed files with 17 additions and 12 deletions
|
@ -190,7 +190,7 @@ class ElectrumX {
|
||||||
// But Tor isn't enabled...
|
// But Tor isn't enabled...
|
||||||
if (!_torService.enabled) {
|
if (!_torService.enabled) {
|
||||||
// And the killswitch isn't set...
|
// And the killswitch isn't set...
|
||||||
if (!_prefs.torKillswitch) {
|
if (!_prefs.torKillSwitch) {
|
||||||
// Then we'll just proceed and connect to ElectrumX through clearnet at the bottom of this function.
|
// Then we'll just proceed and connect to ElectrumX through clearnet at the bottom of this function.
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
"Tor preference set but Tor is not enabled, killswitch not set, connecting to ElectrumX through clearnet",
|
"Tor preference set but Tor is not enabled, killswitch not set, connecting to ElectrumX through clearnet",
|
||||||
|
|
|
@ -170,12 +170,12 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
|
||||||
child: DraggableSwitchButton(
|
child: DraggableSwitchButton(
|
||||||
isOn: ref.watch(
|
isOn: ref.watch(
|
||||||
prefsChangeNotifierProvider
|
prefsChangeNotifierProvider
|
||||||
.select((value) => value.torKillswitch),
|
.select((value) => value.torKillSwitch),
|
||||||
),
|
),
|
||||||
onValueChanged: (newValue) {
|
onValueChanged: (newValue) {
|
||||||
ref
|
ref
|
||||||
.read(prefsChangeNotifierProvider)
|
.read(prefsChangeNotifierProvider)
|
||||||
.torKillswitch = newValue;
|
.torKillSwitch = newValue;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -383,12 +383,12 @@ class _TorSettingsState extends ConsumerState<TorSettings> {
|
||||||
child: DraggableSwitchButton(
|
child: DraggableSwitchButton(
|
||||||
isOn: ref.watch(
|
isOn: ref.watch(
|
||||||
prefsChangeNotifierProvider
|
prefsChangeNotifierProvider
|
||||||
.select((value) => value.torKillswitch),
|
.select((value) => value.torKillSwitch),
|
||||||
),
|
),
|
||||||
onValueChanged: (newValue) {
|
onValueChanged: (newValue) {
|
||||||
ref
|
ref
|
||||||
.read(prefsChangeNotifierProvider)
|
.read(prefsChangeNotifierProvider)
|
||||||
.torKillswitch = newValue;
|
.torKillSwitch = newValue;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -399,14 +399,17 @@ class Prefs extends ChangeNotifier {
|
||||||
|
|
||||||
// tor
|
// tor
|
||||||
|
|
||||||
bool _torKillswitch = false;
|
bool _torKillswitch = true;
|
||||||
|
|
||||||
bool get torKillswitch => _torKillswitch;
|
bool get torKillSwitch => _torKillswitch;
|
||||||
|
|
||||||
set torKillswitch(bool torKillswitch) {
|
set torKillSwitch(bool torKillswitch) {
|
||||||
if (_torKillswitch != showTestNetCoins) {
|
if (_torKillswitch != torKillswitch) {
|
||||||
DB.instance.put<dynamic>(
|
DB.instance.put<dynamic>(
|
||||||
boxName: DB.boxNamePrefs, key: "torKillswitch", value: torKillswitch);
|
boxName: DB.boxNamePrefs,
|
||||||
|
key: "torKillswitch",
|
||||||
|
value: torKillswitch,
|
||||||
|
);
|
||||||
_torKillswitch = torKillswitch;
|
_torKillswitch = torKillswitch;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
@ -414,8 +417,10 @@ class Prefs extends ChangeNotifier {
|
||||||
|
|
||||||
Future<bool> _getTorKillswitch() async {
|
Future<bool> _getTorKillswitch() async {
|
||||||
return await DB.instance.get<dynamic>(
|
return await DB.instance.get<dynamic>(
|
||||||
boxName: DB.boxNamePrefs, key: "torKillswitch") as bool? ??
|
boxName: DB.boxNamePrefs,
|
||||||
false;
|
key: "torKillswitch",
|
||||||
|
) as bool? ??
|
||||||
|
true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// show testnet coins
|
// show testnet coins
|
||||||
|
|
Loading…
Reference in a new issue