Tor kill switch getter name refactor and bugfix

This commit is contained in:
julian 2023-09-13 10:33:44 -06:00
parent af88673df1
commit 4b518243c6
4 changed files with 17 additions and 12 deletions

View file

@ -190,7 +190,7 @@ class ElectrumX {
// But Tor isn't enabled...
if (!_torService.enabled) {
// 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.
Logging.instance.log(
"Tor preference set but Tor is not enabled, killswitch not set, connecting to ElectrumX through clearnet",

View file

@ -170,12 +170,12 @@ class _TorSettingsViewState extends ConsumerState<TorSettingsView> {
child: DraggableSwitchButton(
isOn: ref.watch(
prefsChangeNotifierProvider
.select((value) => value.torKillswitch),
.select((value) => value.torKillSwitch),
),
onValueChanged: (newValue) {
ref
.read(prefsChangeNotifierProvider)
.torKillswitch = newValue;
.torKillSwitch = newValue;
},
),
),

View file

@ -383,12 +383,12 @@ class _TorSettingsState extends ConsumerState<TorSettings> {
child: DraggableSwitchButton(
isOn: ref.watch(
prefsChangeNotifierProvider
.select((value) => value.torKillswitch),
.select((value) => value.torKillSwitch),
),
onValueChanged: (newValue) {
ref
.read(prefsChangeNotifierProvider)
.torKillswitch = newValue;
.torKillSwitch = newValue;
},
),
),

View file

@ -399,14 +399,17 @@ class Prefs extends ChangeNotifier {
// tor
bool _torKillswitch = false;
bool _torKillswitch = true;
bool get torKillswitch => _torKillswitch;
bool get torKillSwitch => _torKillswitch;
set torKillswitch(bool torKillswitch) {
if (_torKillswitch != showTestNetCoins) {
set torKillSwitch(bool torKillswitch) {
if (_torKillswitch != torKillswitch) {
DB.instance.put<dynamic>(
boxName: DB.boxNamePrefs, key: "torKillswitch", value: torKillswitch);
boxName: DB.boxNamePrefs,
key: "torKillswitch",
value: torKillswitch,
);
_torKillswitch = torKillswitch;
notifyListeners();
}
@ -414,8 +417,10 @@ class Prefs extends ChangeNotifier {
Future<bool> _getTorKillswitch() async {
return await DB.instance.get<dynamic>(
boxName: DB.boxNamePrefs, key: "torKillswitch") as bool? ??
false;
boxName: DB.boxNamePrefs,
key: "torKillswitch",
) as bool? ??
true;
}
// show testnet coins