diff --git a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart index 47458a7d8..bb7deb50b 100644 --- a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart +++ b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart @@ -1072,13 +1072,18 @@ class BitcoinCashWallet extends CoinServiceAPI void _periodicPingCheck() async { bool hasNetwork = await testNetworkConnection(); - _isConnected = hasNetwork; + if (_isConnected != hasNetwork) { NodeConnectionStatus status = hasNetwork ? NodeConnectionStatus.connected : NodeConnectionStatus.disconnected; GlobalEventBus.instance .fire(NodeConnectionStatusChangedEvent(status, walletId, coin)); + + _isConnected = hasNetwork; + if (hasNetwork) { + unawaited(refresh()); + } } } diff --git a/lib/services/coins/dogecoin/dogecoin_wallet.dart b/lib/services/coins/dogecoin/dogecoin_wallet.dart index cc081539c..fe0cb5751 100644 --- a/lib/services/coins/dogecoin/dogecoin_wallet.dart +++ b/lib/services/coins/dogecoin/dogecoin_wallet.dart @@ -1058,13 +1058,18 @@ class DogecoinWallet extends CoinServiceAPI void _periodicPingCheck() async { bool hasNetwork = await testNetworkConnection(); - _isConnected = hasNetwork; + if (_isConnected != hasNetwork) { NodeConnectionStatus status = hasNetwork ? NodeConnectionStatus.connected : NodeConnectionStatus.disconnected; GlobalEventBus.instance .fire(NodeConnectionStatusChangedEvent(status, walletId, coin)); + + _isConnected = hasNetwork; + if (hasNetwork) { + unawaited(refresh()); + } } } diff --git a/lib/services/coins/ecash/ecash_wallet.dart b/lib/services/coins/ecash/ecash_wallet.dart index 4459c3fbc..f2ee64632 100644 --- a/lib/services/coins/ecash/ecash_wallet.dart +++ b/lib/services/coins/ecash/ecash_wallet.dart @@ -2679,13 +2679,18 @@ class ECashWallet extends CoinServiceAPI void _periodicPingCheck() async { bool hasNetwork = await testNetworkConnection(); - _isConnected = hasNetwork; + if (_isConnected != hasNetwork) { NodeConnectionStatus status = hasNetwork ? NodeConnectionStatus.connected : NodeConnectionStatus.disconnected; GlobalEventBus.instance .fire(NodeConnectionStatusChangedEvent(status, walletId, coin)); + + _isConnected = hasNetwork; + if (hasNetwork) { + unawaited(refresh()); + } } } diff --git a/lib/services/coins/epiccash/epiccash_wallet.dart b/lib/services/coins/epiccash/epiccash_wallet.dart index 137be8001..043c01770 100644 --- a/lib/services/coins/epiccash/epiccash_wallet.dart +++ b/lib/services/coins/epiccash/epiccash_wallet.dart @@ -1620,13 +1620,18 @@ class EpicCashWallet extends CoinServiceAPI void _periodicPingCheck() async { bool hasNetwork = await testNetworkConnection(); - _isConnected = hasNetwork; + if (_isConnected != hasNetwork) { NodeConnectionStatus status = hasNetwork ? NodeConnectionStatus.connected : NodeConnectionStatus.disconnected; GlobalEventBus.instance .fire(NodeConnectionStatusChangedEvent(status, walletId, coin)); + + _isConnected = hasNetwork; + if (hasNetwork) { + unawaited(refresh()); + } } } diff --git a/lib/services/coins/firo/firo_wallet.dart b/lib/services/coins/firo/firo_wallet.dart index fa9cfca5c..1287fc237 100644 --- a/lib/services/coins/firo/firo_wallet.dart +++ b/lib/services/coins/firo/firo_wallet.dart @@ -985,13 +985,18 @@ class FiroWallet extends CoinServiceAPI void _periodicPingCheck() async { bool hasNetwork = await testNetworkConnection(); - _isConnected = hasNetwork; + if (_isConnected != hasNetwork) { NodeConnectionStatus status = hasNetwork ? NodeConnectionStatus.connected : NodeConnectionStatus.disconnected; GlobalEventBus.instance .fire(NodeConnectionStatusChangedEvent(status, walletId, coin)); + + _isConnected = hasNetwork; + if (hasNetwork) { + unawaited(refresh()); + } } } diff --git a/lib/services/coins/litecoin/litecoin_wallet.dart b/lib/services/coins/litecoin/litecoin_wallet.dart index 765f3d81a..4acbbf1c3 100644 --- a/lib/services/coins/litecoin/litecoin_wallet.dart +++ b/lib/services/coins/litecoin/litecoin_wallet.dart @@ -1189,13 +1189,18 @@ class LitecoinWallet extends CoinServiceAPI void _periodicPingCheck() async { bool hasNetwork = await testNetworkConnection(); - _isConnected = hasNetwork; + if (_isConnected != hasNetwork) { NodeConnectionStatus status = hasNetwork ? NodeConnectionStatus.connected : NodeConnectionStatus.disconnected; GlobalEventBus.instance .fire(NodeConnectionStatusChangedEvent(status, walletId, coin)); + + _isConnected = hasNetwork; + if (hasNetwork) { + unawaited(refresh()); + } } } diff --git a/lib/services/coins/namecoin/namecoin_wallet.dart b/lib/services/coins/namecoin/namecoin_wallet.dart index 640b2cba0..41122a84b 100644 --- a/lib/services/coins/namecoin/namecoin_wallet.dart +++ b/lib/services/coins/namecoin/namecoin_wallet.dart @@ -1179,13 +1179,18 @@ class NamecoinWallet extends CoinServiceAPI void _periodicPingCheck() async { bool hasNetwork = await testNetworkConnection(); - _isConnected = hasNetwork; + if (_isConnected != hasNetwork) { NodeConnectionStatus status = hasNetwork ? NodeConnectionStatus.connected : NodeConnectionStatus.disconnected; GlobalEventBus.instance .fire(NodeConnectionStatusChangedEvent(status, walletId, coin)); + + _isConnected = hasNetwork; + if (hasNetwork) { + unawaited(refresh()); + } } } diff --git a/lib/services/coins/particl/particl_wallet.dart b/lib/services/coins/particl/particl_wallet.dart index 34e5ede45..83d8d55ec 100644 --- a/lib/services/coins/particl/particl_wallet.dart +++ b/lib/services/coins/particl/particl_wallet.dart @@ -1106,13 +1106,18 @@ class ParticlWallet extends CoinServiceAPI void _periodicPingCheck() async { bool hasNetwork = await testNetworkConnection(); - _isConnected = hasNetwork; + if (_isConnected != hasNetwork) { NodeConnectionStatus status = hasNetwork ? NodeConnectionStatus.connected : NodeConnectionStatus.disconnected; GlobalEventBus.instance .fire(NodeConnectionStatusChangedEvent(status, walletId, coin)); + + _isConnected = hasNetwork; + if (hasNetwork) { + unawaited(refresh()); + } } }