mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 09:29:48 +00:00
Check for Nodes if exists before adding them in nodes
Fix nullability issue due to early access Fix Nodes_list,yml file structure
This commit is contained in:
parent
9b32c9c956
commit
79fb1b91d4
3 changed files with 22 additions and 8 deletions
|
@ -22,10 +22,10 @@
|
||||||
-
|
-
|
||||||
uri: node.imonero.org:18081
|
uri: node.imonero.org:18081
|
||||||
is_default: false
|
is_default: false
|
||||||
|
-
|
||||||
uri: node.c3pool.com:18081
|
uri: node.c3pool.com:18081
|
||||||
is_default: false
|
is_default: false
|
||||||
|
-
|
||||||
uri: xmr.prprpr.icu:18081
|
uri: xmr.prprpr.icu:18081
|
||||||
is_default: false
|
is_default: false
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,8 @@ Future defaultSettingsMigration(
|
||||||
sharedPreferences: sharedPreferences, nodes: nodes);
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
||||||
await changeLitecoinCurrentElectrumServerToDefault(
|
await changeLitecoinCurrentElectrumServerToDefault(
|
||||||
sharedPreferences: sharedPreferences, nodes: nodes);
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
||||||
|
await changeHavenCurrentNodeToDefault(
|
||||||
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -277,17 +279,29 @@ Future<void> updateNodeTypes({required Box<Node> nodes}) async {
|
||||||
|
|
||||||
Future<void> addBitcoinElectrumServerList({required Box<Node> nodes}) async {
|
Future<void> addBitcoinElectrumServerList({required Box<Node> nodes}) async {
|
||||||
final serverList = await loadBitcoinElectrumServerList();
|
final serverList = await loadBitcoinElectrumServerList();
|
||||||
await nodes.addAll(serverList);
|
for (var node in serverList) {
|
||||||
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
||||||
|
await nodes.add(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addLitecoinElectrumServerList({required Box<Node> nodes}) async {
|
Future<void> addLitecoinElectrumServerList({required Box<Node> nodes}) async {
|
||||||
final serverList = await loadLitecoinElectrumServerList();
|
final serverList = await loadLitecoinElectrumServerList();
|
||||||
await nodes.addAll(serverList);
|
for (var node in serverList) {
|
||||||
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
||||||
|
await nodes.add(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addHavenNodeList({required Box<Node> nodes}) async {
|
Future<void> addHavenNodeList({required Box<Node> nodes}) async {
|
||||||
final nodeList = await loadDefaultHavenNodes();
|
final nodeList = await loadDefaultHavenNodes();
|
||||||
await nodes.addAll(nodeList);
|
for (var node in nodeList) {
|
||||||
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
||||||
|
await nodes.add(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addAddressesForMoneroWallets(
|
Future<void> addAddressesForMoneroWallets(
|
||||||
|
@ -431,7 +445,7 @@ Future<void> resetBitcoinElectrumServer(
|
||||||
final oldElectrumServer = nodeSource.values.firstWhereOrNull(
|
final oldElectrumServer = nodeSource.values.firstWhereOrNull(
|
||||||
(node) => node.uri.toString().contains('electrumx.cakewallet.com'));
|
(node) => node.uri.toString().contains('electrumx.cakewallet.com'));
|
||||||
var cakeWalletNode = nodeSource.values.firstWhereOrNull(
|
var cakeWalletNode = nodeSource.values.firstWhereOrNull(
|
||||||
(node) => node.uri.toString() == cakeWalletBitcoinElectrumUri);
|
(node) => node.uriRaw.toString() == cakeWalletBitcoinElectrumUri);
|
||||||
|
|
||||||
if (cakeWalletNode == null) {
|
if (cakeWalletNode == null) {
|
||||||
cakeWalletNode =
|
cakeWalletNode =
|
||||||
|
|
|
@ -23,12 +23,12 @@ void startAuthenticationStateChange(AuthenticationStore authenticationStore,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == AuthenticationState.allowed) {
|
if (state == AuthenticationState.allowed) {
|
||||||
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
await navigatorKey.currentState?.pushNamedAndRemoveUntil(Routes.dashboard, (route) => false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == AuthenticationState.denied) {
|
if (state == AuthenticationState.denied) {
|
||||||
await navigatorKey.currentState!.pushNamedAndRemoveUntil(Routes.welcome, (_) => false);
|
await navigatorKey.currentState?.pushNamedAndRemoveUntil(Routes.welcome, (_) => false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue