From cb1922d2c75eb185d52445300867c865d5e00de5 Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 7 Jun 2023 12:28:11 -0600 Subject: [PATCH] fix: (ba)nano testNetworkConnection always returning false --- lib/services/coins/banano/banano_wallet.dart | 13 ++++--------- lib/services/coins/nano/nano_wallet.dart | 13 ++++--------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/lib/services/coins/banano/banano_wallet.dart b/lib/services/coins/banano/banano_wallet.dart index 23c219b00..f472fe38b 100644 --- a/lib/services/coins/banano/banano_wallet.dart +++ b/lib/services/coins/banano/banano_wallet.dart @@ -756,15 +756,10 @@ class BananoWallet extends CoinServiceAPI } @override - Future testNetworkConnection() { - http - .get(Uri.parse("${getCurrentNode().host}?action=version")) - .then((response) { - if (response.statusCode == 200) { - return true; - } - }); - return Future.value(false); + Future testNetworkConnection() async { + final uri = Uri.parse("${getCurrentNode().host}?action=version"); + final response = await http.get(uri); + return response.statusCode == 200; } Timer? _networkAliveTimer; diff --git a/lib/services/coins/nano/nano_wallet.dart b/lib/services/coins/nano/nano_wallet.dart index 2bfd42db6..36b688cfc 100644 --- a/lib/services/coins/nano/nano_wallet.dart +++ b/lib/services/coins/nano/nano_wallet.dart @@ -775,15 +775,10 @@ class NanoWallet extends CoinServiceAPI } @override - Future testNetworkConnection() { - http - .get(Uri.parse("${getCurrentNode().host}?action=version")) - .then((response) { - if (response.statusCode == 200) { - return true; - } - }); - return Future.value(false); + Future testNetworkConnection() async { + final uri = Uri.parse("${getCurrentNode().host}?action=version"); + final response = await http.get(uri); + return response.statusCode == 200; } Timer? _networkAliveTimer;