File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,14 @@ import Observation
1313@Observable
1414class WalletViewModel {
1515 let bdkClient : BDKClient
16+ let keyClient : KeyClient
1617 let priceClient : PriceClient
1718
1819 var balanceTotal : UInt64 = 0
20+ var canSend : Bool {
21+ guard let backupInfo = try ? keyClient. getBackupInfo ( ) else { return false }
22+ return backupInfo. descriptor. contains ( " tprv " ) || backupInfo. descriptor. contains ( " xprv " )
23+ }
1924 var inspectedScripts : UInt64 = 0
2025 var price : Double = 0.00
2126 var progress : Float = 0.0
@@ -35,11 +40,13 @@ class WalletViewModel {
3540
3641 init (
3742 bdkClient: BDKClient = . live,
43+ keyClient: KeyClient = . live,
3844 priceClient: PriceClient = . live,
3945 transactions: [ CanonicalTx ] = [ ] ,
4046 walletSyncState: WalletSyncState = . notStarted
4147 ) {
4248 self . bdkClient = bdkClient
49+ self . keyClient = keyClient
4350 self . priceClient = priceClient
4451 self . transactions = transactions
4552 self . walletSyncState = walletSyncState
Original file line number Diff line number Diff line change @@ -191,8 +191,9 @@ struct WalletView: View {
191191 NavigationLink ( value: NavigationDestination . address) {
192192 Image ( systemName: " qrcode.viewfinder " )
193193 . font ( . title)
194- . foregroundStyle ( . primary)
194+ . foregroundStyle ( viewModel . canSend ? . primary : . secondary )
195195 }
196+ . disabled ( !viewModel. canSend)
196197 }
197198 . padding ( [ . horizontal, . bottom] )
198199
You can’t perform that action at this time.
0 commit comments