consistent variable naming

This commit is contained in:
julian 2024-11-26 09:18:35 -06:00
parent d6d4df7822
commit 4197ff40f4
39 changed files with 88 additions and 87 deletions

View file

@ -78,7 +78,7 @@ class DbVersionMigrator with WalletDB {
id: e.id,
useSSL: e.useSSL,
torEnabled: e.torEnabled,
clearEnabled: e.plainEnabled,
clearnetEnabled: e.clearnetEnabled,
),
)
.toList();
@ -91,7 +91,7 @@ class DbVersionMigrator with WalletDB {
id: node.id,
useSSL: node.useSSL,
torEnabled: node.torEnabled,
clearEnabled: node.plainEnabled,
clearnetEnabled: node.clearnetEnabled,
),
prefs: prefs,
failovers: failovers,

View file

@ -55,7 +55,7 @@ class ElectrumXNode {
required this.id,
required this.useSSL,
required this.torEnabled,
required this.clearEnabled,
required this.clearnetEnabled,
});
final String address;
final int port;
@ -63,7 +63,7 @@ class ElectrumXNode {
final String id;
final bool useSSL;
final bool torEnabled;
final bool clearEnabled;
final bool clearnetEnabled;
factory ElectrumXNode.from(ElectrumXNode node) {
return ElectrumXNode(
@ -73,7 +73,7 @@ class ElectrumXNode {
id: node.id,
useSSL: node.useSSL,
torEnabled: node.torEnabled,
clearEnabled: node.clearEnabled,
clearnetEnabled: node.clearnetEnabled,
);
}
@ -210,7 +210,7 @@ class ElectrumXClient {
cryptoCurrency: cryptoCurrency,
netType: TorPlainNetworkOption.fromNodeData(
node.torEnabled,
node.clearEnabled,
node.clearnetEnabled,
),
);
}

View file

@ -42,7 +42,7 @@ class NodeModel {
// @HiveField(11)
final bool torEnabled;
// @HiveField(12)
final bool plainEnabled;
final bool clearnetEnabled;
NodeModel({
required this.host,
@ -55,7 +55,7 @@ class NodeModel {
required this.isFailover,
required this.isDown,
required this.torEnabled,
required this.plainEnabled,
required this.clearnetEnabled,
this.loginName,
this.trusted,
});
@ -72,7 +72,7 @@ class NodeModel {
bool? isDown,
bool? trusted,
bool? torEnabled,
bool? plainEnabled,
bool? clearnetEnabled,
}) {
return NodeModel(
host: host ?? this.host,
@ -87,7 +87,7 @@ class NodeModel {
isDown: isDown ?? this.isDown,
trusted: trusted ?? this.trusted,
torEnabled: torEnabled ?? this.torEnabled,
plainEnabled: plainEnabled ?? this.plainEnabled,
clearnetEnabled: clearnetEnabled ?? this.clearnetEnabled,
);
}
@ -110,7 +110,7 @@ class NodeModel {
map['isDown'] = isDown;
map['trusted'] = trusted;
map['torEnabled'] = torEnabled;
map['plainEnabled'] = plainEnabled;
map['clearEnabled'] = clearnetEnabled;
return map;
}

View file

@ -29,7 +29,7 @@ class NodeModelAdapter extends TypeAdapter<NodeModel> {
isDown: fields[9] as bool,
trusted: fields[10] as bool?,
torEnabled: fields[11] as bool? ?? true,
plainEnabled: fields[12] as bool? ?? true,
clearnetEnabled: fields[12] as bool? ?? true,
);
}
@ -62,7 +62,7 @@ class NodeModelAdapter extends TypeAdapter<NodeModel> {
..writeByte(11)
..write(obj.torEnabled)
..writeByte(12)
..write(obj.plainEnabled);
..write(obj.clearnetEnabled);
}
@override

View file

@ -252,7 +252,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
trusted: formData.trusted!,
isDown: false,
torEnabled: torEnabled,
plainEnabled: plainEnabled,
clearnetEnabled: plainEnabled,
);
await ref.read(nodeServiceChangeNotifierProvider).add(
@ -280,7 +280,7 @@ class _AddEditNodeViewState extends ConsumerState<AddEditNodeView> {
trusted: formData.trusted!,
isDown: false,
torEnabled: torEnabled,
plainEnabled: plainEnabled,
clearnetEnabled: plainEnabled,
);
await ref.read(nodeServiceChangeNotifierProvider).add(
@ -755,9 +755,9 @@ class _NodeFormState extends ConsumerState<NodeForm> {
_isFailover = node.isFailover;
_trusted = node.trusted ?? false;
if (node.torEnabled && !node.plainEnabled) {
if (node.torEnabled && !node.clearnetEnabled) {
netOption = TorPlainNetworkOption.tor;
} else if (node.plainEnabled && !node.torEnabled) {
} else if (node.clearnetEnabled && !node.torEnabled) {
netOption = TorPlainNetworkOption.clear;
} else {
netOption = TorPlainNetworkOption.both;

View file

@ -308,7 +308,7 @@ class _NodeDetailsViewState extends ConsumerState<NodeDetailsView> {
} else {
netOption = TorPlainNetworkOption.fromNodeData(
node.torEnabled,
node.plainEnabled,
node.clearnetEnabled,
);
}
@ -391,7 +391,7 @@ class _NodeDetailsViewState extends ConsumerState<NodeDetailsView> {
TorPlainNetworkOption.tor ||
ref.read(nodeFormDataProvider).netOption ==
TorPlainNetworkOption.both,
plainEnabled:
clearnetEnabled:
ref.read(nodeFormDataProvider).netOption ==
TorPlainNetworkOption.clear ||
ref.read(nodeFormDataProvider).netOption ==

View file

@ -1273,7 +1273,7 @@ abstract class SWB {
isFailover: node['isFailover'] as bool,
isDown: node['isDown'] as bool,
torEnabled: node['torEnabled'] as bool? ?? true,
plainEnabled: node['plainEnabled'] as bool? ?? true,
clearnetEnabled: node['plainEnabled'] as bool? ?? true,
),
node["password"] as String?,
true,

View file

@ -60,7 +60,7 @@ class NodeService extends ChangeNotifier {
isFailover: savedNode.isFailover,
trusted: savedNode.trusted,
torEnabled: savedNode.torEnabled,
plainEnabled: savedNode.plainEnabled,
clearnetEnabled: savedNode.clearnetEnabled,
),
);
}
@ -78,7 +78,7 @@ class NodeService extends ChangeNotifier {
isFailover: primaryNode.isFailover,
trusted: primaryNode.trusted,
torEnabled: primaryNode.torEnabled,
plainEnabled: primaryNode.plainEnabled,
clearnetEnabled: primaryNode.clearnetEnabled,
),
);
}
@ -260,7 +260,7 @@ class NodeService extends ChangeNotifier {
isFailover: true,
torEnabled: nodeMap["torEnabled"] == "true",
isDown: nodeMap["isDown"] == "true",
plainEnabled: nodeMap["plainEnabled"] == "true",
clearnetEnabled: nodeMap["plainEnabled"] == "true",
);
final currentNode = getNodeById(id: nodeMap["id"] as String);
if (currentNode != null) {

View file

@ -137,12 +137,12 @@ class NotificationsService extends ChangeNotifier {
if (node != null) {
if (wallet is ElectrumXInterface) {
if (prefs.useTor) {
if (node.plainEnabled && !node.torEnabled) {
if (node.clearnetEnabled && !node.torEnabled) {
// just ignore I guess??
return;
}
} else {
if (node.torEnabled && !node.plainEnabled) {
if (node.torEnabled && !node.clearnetEnabled) {
// just ignore I guess??
return;
}
@ -155,7 +155,7 @@ class NotificationsService extends ChangeNotifier {
id: node.id,
useSSL: node.useSSL,
torEnabled: node.torEnabled,
clearEnabled: node.plainEnabled,
clearnetEnabled: node.clearnetEnabled,
);
final failovers = nodeService
.failoverNodesFor(currency: coin)
@ -167,7 +167,7 @@ class NotificationsService extends ChangeNotifier {
id: e.id,
useSSL: e.useSSL,
torEnabled: node.torEnabled,
clearEnabled: node.plainEnabled,
clearnetEnabled: node.clearnetEnabled,
),
)
.toList();

View file

@ -78,7 +78,7 @@ class Banano extends NanoCurrency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -240,7 +240,7 @@ class Bitcoin extends Bip39HDCurrency
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
case CryptoCurrencyNetwork.test:
@ -255,7 +255,7 @@ class Bitcoin extends Bip39HDCurrency
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
case CryptoCurrencyNetwork.test4:
@ -270,7 +270,7 @@ class Bitcoin extends Bip39HDCurrency
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -74,7 +74,7 @@ class BitcoinFrost extends FrostCurrency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
case CryptoCurrencyNetwork.test:
@ -89,7 +89,7 @@ class BitcoinFrost extends FrostCurrency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
case CryptoCurrencyNetwork.test4:
@ -104,7 +104,7 @@ class BitcoinFrost extends FrostCurrency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -299,7 +299,7 @@ class Bitcoincash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
case CryptoCurrencyNetwork.test:
@ -314,7 +314,7 @@ class Bitcoincash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -78,7 +78,7 @@ class Cardano extends Bip39Currency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -190,7 +190,7 @@ class Dash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -190,7 +190,7 @@ class Dogecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
case CryptoCurrencyNetwork.test:
@ -205,7 +205,7 @@ class Dogecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -290,7 +290,7 @@ class Ecash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -81,7 +81,7 @@ class Epiccash extends Bip39Currency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -58,7 +58,7 @@ class Ethereum extends Bip39Currency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
@override

View file

@ -232,7 +232,7 @@ class Firo extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
case CryptoCurrencyNetwork.test:
@ -260,7 +260,7 @@ class Firo extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -221,7 +221,7 @@ class Litecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
case CryptoCurrencyNetwork.test:
@ -236,7 +236,7 @@ class Litecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -73,7 +73,7 @@ class Monero extends CryptonoteCurrency {
isDown: false,
trusted: true,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -103,7 +103,7 @@ class Namecoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
// case CryptoCurrencyNetwork.test:
// TODO: [prio=low] Add testnet support.

View file

@ -78,7 +78,7 @@ class Nano extends NanoCurrency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -98,7 +98,7 @@ class Particl extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
// case CryptoCurrencyNetwork.test:
// TODO: [prio=low] Add testnet.

View file

@ -104,7 +104,7 @@ class Peercoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
case CryptoCurrencyNetwork.test:
@ -119,7 +119,7 @@ class Peercoin extends Bip39HDCurrency with ElectrumXCurrencyInterface {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -56,7 +56,7 @@ class Solana extends Bip39Currency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:
throw Exception("Unsupported network: $network");

View file

@ -69,7 +69,7 @@ class Stellar extends Bip39Currency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
case CryptoCurrencyNetwork.test:
@ -84,7 +84,7 @@ class Stellar extends Bip39Currency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -119,7 +119,7 @@ class Tezos extends Bip39Currency {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -73,7 +73,7 @@ class Wownero extends CryptonoteCurrency {
isDown: false,
trusted: true,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
default:

View file

@ -1339,7 +1339,7 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T>
useSSL: node.useSSL,
id: node.id,
torEnabled: node.torEnabled,
clearEnabled: node.plainEnabled,
clearnetEnabled: node.clearnetEnabled,
);
}
@ -1355,7 +1355,7 @@ class BitcoinFrostWallet<T extends FrostCurrency> extends Wallet<T>
id: e.id,
useSSL: e.useSSL,
torEnabled: e.torEnabled,
clearEnabled: e.plainEnabled,
clearnetEnabled: e.clearnetEnabled,
),
)
.toList();

View file

@ -467,7 +467,7 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
final host = Uri.parse(node.host).host;
({InternetAddress host, int port})? proxy;
if (prefs.useTor) {
if (node.plainEnabled && !node.torEnabled) {
if (node.clearnetEnabled && !node.torEnabled) {
libMoneroWallet?.stopAutoSaving();
libMoneroWallet?.stopListeners();
libMoneroWallet?.stopSyncing();
@ -476,7 +476,7 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
}
proxy = TorService.sharedInstance.getProxyInfo();
} else {
if (!node.plainEnabled && node.torEnabled) {
if (!node.clearnetEnabled && node.torEnabled) {
libMoneroWallet?.stopAutoSaving();
libMoneroWallet?.stopListeners();
libMoneroWallet?.stopSyncing();
@ -1041,7 +1041,7 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
final node = getCurrentNode();
if (prefs.useTor) {
if (node.plainEnabled && !node.torEnabled) {
if (node.clearnetEnabled && !node.torEnabled) {
libMoneroWallet?.stopAutoSaving();
libMoneroWallet?.stopListeners();
libMoneroWallet?.stopSyncing();
@ -1049,7 +1049,7 @@ abstract class LibMoneroWallet<T extends CryptonoteCurrency>
throw Exception("TOR - clearnet mismatch");
}
} else {
if (!node.plainEnabled && node.torEnabled) {
if (!node.clearnetEnabled && node.torEnabled) {
libMoneroWallet?.stopAutoSaving();
libMoneroWallet?.stopListeners();
libMoneroWallet?.stopSyncing();

View file

@ -907,7 +907,7 @@ mixin ElectrumXInterface<T extends ElectrumXCurrencyInterface>
useSSL: node.useSSL,
id: node.id,
torEnabled: node.torEnabled,
clearEnabled: node.plainEnabled,
clearnetEnabled: node.clearnetEnabled,
);
}
@ -922,7 +922,7 @@ mixin ElectrumXInterface<T extends ElectrumXCurrencyInterface>
id: e.id,
useSSL: e.useSSL,
torEnabled: e.torEnabled,
clearEnabled: e.plainEnabled,
clearnetEnabled: e.clearnetEnabled,
),
)
.toList();

View file

@ -168,9 +168,9 @@ class _NodeCardState extends ConsumerState<NodeCard> {
enabled: _status == "Disconnected",
onTap: () async {
final TorPlainNetworkOption netOption;
if (_node.torEnabled && !_node.plainEnabled) {
if (_node.torEnabled && !_node.clearnetEnabled) {
netOption = TorPlainNetworkOption.tor;
} else if (_node.plainEnabled && !_node.torEnabled) {
} else if (_node.clearnetEnabled && !_node.torEnabled) {
netOption = TorPlainNetworkOption.clear;
} else {
netOption = TorPlainNetworkOption.both;

View file

@ -258,9 +258,10 @@ class NodeOptionsSheet extends ConsumerWidget {
);
if (context.mounted) {
final TorPlainNetworkOption netOption;
if (node.torEnabled && !node.plainEnabled) {
if (node.torEnabled &&
!node.clearnetEnabled) {
netOption = TorPlainNetworkOption.tor;
} else if (node.plainEnabled &&
} else if (node.clearnetEnabled &&
!node.torEnabled) {
netOption = TorPlainNetworkOption.clear;
} else {

View file

@ -169,7 +169,7 @@ void main() {
id: "some ID",
useSSL: true,
torEnabled: true,
clearEnabled: true,
clearnetEnabled: true,
);
final client =

View file

@ -49,7 +49,7 @@ void main() {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
await service.setPrimaryNodeFor(
coin: Bitcoin(CryptoCurrencyNetwork.main),
@ -132,7 +132,7 @@ void main() {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
final nodeB = NodeModel(
host: "host2",
@ -145,7 +145,7 @@ void main() {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
final nodeC = NodeModel(
host: "host3",
@ -158,7 +158,7 @@ void main() {
isFailover: true,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
);
setUp(() async {

View file

@ -38,7 +38,7 @@ void main() {
isFailover: false,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
),
);
@ -54,7 +54,7 @@ void main() {
isFailover: false,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
),
);
@ -117,7 +117,7 @@ void main() {
isFailover: false,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
),
);
@ -133,7 +133,7 @@ void main() {
isFailover: false,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
),
);
@ -197,7 +197,7 @@ void main() {
isFailover: false,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
),
);
@ -213,7 +213,7 @@ void main() {
isFailover: false,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
),
);

View file

@ -37,7 +37,7 @@ void main() {
isFailover: false,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
));
when(mockNodeService.getPrimaryNodeFor(
@ -52,7 +52,7 @@ void main() {
coinName: "Bitcoin",
isFailover: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
isDown: false));
await tester.pumpWidget(
@ -115,7 +115,7 @@ void main() {
isFailover: false,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
),
);
@ -133,7 +133,7 @@ void main() {
isFailover: false,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
),
);
@ -196,7 +196,7 @@ void main() {
isFailover: false,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
),
);
@ -214,7 +214,7 @@ void main() {
isFailover: false,
isDown: false,
torEnabled: true,
plainEnabled: true,
clearnetEnabled: true,
),
);