Skip to content

Commit a97544c

Browse files
committed
set the progress to 20 percent after startup
1 parent b4db0ae commit a97544c

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

BDKSwiftExampleWallet/Extensions/BDK+Extensions/CbfClient+Extensions.swift

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ extension CbfClient {
1919
.build(wallet: wallet)
2020

2121
components.node.run()
22+
23+
// Send initial 20% progress after successful node startup
24+
NotificationCenter.default.post(
25+
name: NSNotification.Name("KyotoProgressUpdate"),
26+
object: nil,
27+
userInfo: ["progress": Float(0.2)]
28+
)
29+
2230
components.client.startBackgroundMonitoring()
2331

2432
return (client: components.client, node: components.node)
@@ -30,19 +38,7 @@ extension CbfClient {
3038
func startBackgroundMonitoring() {
3139
Task {
3240
while true {
33-
if let log = try? await self.nextLog() {
34-
// Parse specific sync stage messages
35-
if log.contains("Attempting to load headers from the database") {
36-
await MainActor.run {
37-
NotificationCenter.default.post(
38-
name: NSNotification.Name("KyotoProgressUpdate"),
39-
object: nil,
40-
userInfo: ["progress": Float(0.2)]
41-
)
42-
}
43-
}
44-
}
45-
41+
if let log = try? await self.nextLog() { }
4642
}
4743
}
4844

0 commit comments

Comments
 (0)