File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
BDKSwiftExampleWallet/View Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import SwiftUI
1111struct WalletView : View {
1212 @AppStorage ( " balanceDisplayFormat " ) private var balanceFormat : BalanceDisplayFormat =
1313 . bitcoinSats
14+ @AppStorage ( " KyotoLastBlockHeight " ) private var kyotoLastHeight : Int = 0
1415 @Bindable var viewModel : WalletViewModel
1516 @Binding var sendNavigationPath : NavigationPath
1617 @State private var isFirstAppear = true
@@ -127,6 +128,19 @@ struct WalletView: View {
127128 viewModel. getTransactions ( )
128129 await viewModel. getPrices ( )
129130 }
131+ . onAppear {
132+ // Seed height from AppStorage on first show to avoid displaying 0 when Kyoto is active
133+ if viewModel. isKyotoClient,
134+ viewModel. currentBlockHeight == 0 ,
135+ kyotoLastHeight > 0 {
136+ viewModel. currentBlockHeight = UInt32 ( kyotoLastHeight)
137+ }
138+ }
139+ . onChange ( of: viewModel. currentBlockHeight) { _, newValue in
140+ if newValue > 0 {
141+ kyotoLastHeight = Int ( newValue)
142+ }
143+ }
130144
131145 }
132146 . navigationDestination ( isPresented: $showAllTransactions) {
You can’t perform that action at this time.
0 commit comments