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
11
11
struct WalletView : View {
12
12
@AppStorage ( " balanceDisplayFormat " ) private var balanceFormat : BalanceDisplayFormat =
13
13
. bitcoinSats
14
+ @AppStorage ( " KyotoLastBlockHeight " ) private var kyotoLastHeight : Int = 0
14
15
@Bindable var viewModel : WalletViewModel
15
16
@Binding var sendNavigationPath : NavigationPath
16
17
@State private var isFirstAppear = true
@@ -127,6 +128,19 @@ struct WalletView: View {
127
128
viewModel. getTransactions ( )
128
129
await viewModel. getPrices ( )
129
130
}
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
+ }
130
144
131
145
}
132
146
. navigationDestination ( isPresented: $showAllTransactions) {
You can’t perform that action at this time.
0 commit comments