File tree Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change 421
421
}
422
422
}
423
423
}
424
+ },
425
+ "Loading wallet..." : {
426
+
424
427
},
425
428
"Navigation Title" : {
426
429
"extractionState" : "stale",
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class HomeViewModel: ObservableObject {
14
14
let bdkClient : BDKClient
15
15
16
16
var homeViewError : AppError ?
17
+ var isWalletLoaded = false
17
18
var showingHomeViewErrorAlert = false
18
19
19
20
init ( bdkClient: BDKClient = . live) {
@@ -23,6 +24,7 @@ class HomeViewModel: ObservableObject {
23
24
func loadWallet( ) {
24
25
do {
25
26
try bdkClient. loadWallet ( )
27
+ isWalletLoaded = true
26
28
} catch let error as DescriptorError {
27
29
let errorMessage : String
28
30
switch error {
Original file line number Diff line number Diff line change @@ -12,22 +12,24 @@ struct HomeView: View {
12
12
@Binding var navigationPath : NavigationPath
13
13
14
14
var body : some View {
15
-
16
15
ZStack {
17
16
Color ( uiColor: UIColor . systemBackground)
18
17
19
- WalletView (
20
- viewModel: . init(
21
- bdkClient: . live,
22
- priceClient: . live
23
- ) ,
24
- sendNavigationPath: $navigationPath
25
- )
26
- . tint ( . primary)
27
- . onAppear {
28
- viewModel. loadWallet ( )
18
+ if !viewModel. isWalletLoaded {
19
+ ProgressView ( " Loading wallet... " )
20
+ } else {
21
+ WalletView (
22
+ viewModel: . init(
23
+ bdkClient: . live,
24
+ priceClient: . live
25
+ ) ,
26
+ sendNavigationPath: $navigationPath
27
+ )
28
+ . tint ( . primary)
29
29
}
30
-
30
+ }
31
+ . onAppear {
32
+ viewModel. loadWallet ( )
31
33
}
32
34
. alert ( isPresented: $viewModel. showingHomeViewErrorAlert) {
33
35
Alert (
You can’t perform that action at this time.
0 commit comments