Skip to content

Commit c1977a0

Browse files
committed
ui: show connected if progress or height
1 parent 862f3f1 commit c1977a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

BDKSwiftExampleWallet/View Model/WalletViewModel.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ class WalletViewModel {
110110
if self.bdkClient.getClientType() != .kyoto { return }
111111
if let progress = notification.userInfo?["progress"] as? Float {
112112
self.updateKyotoProgress(progress)
113+
// Consider any progress update as evidence of an active connection
114+
// so the UI does not falsely show a red disconnected indicator while syncing.
115+
if progress > 0 {
116+
self.isKyotoConnected = true
117+
}
113118

114119
// Update sync state based on Kyoto progress
115120
if progress >= 100 {
@@ -150,6 +155,8 @@ class WalletViewModel {
150155
if self.bdkClient.getClientType() != .kyoto { return }
151156
if let height = notification.userInfo?["height"] as? UInt32 {
152157
self.currentBlockHeight = height
158+
// Receiving chain height implies we have peer connectivity
159+
self.isKyotoConnected = true
153160
// Auto-refresh wallet data when Kyoto receives new blocks
154161
self.getBalance()
155162
self.getTransactions()

0 commit comments

Comments
 (0)