improve status publishing for SDKSynchronizer
This commit is contained in:
parent
c2777dc520
commit
834842187e
|
@ -393,3 +393,23 @@ extension SyncStatus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extension SyncStatus {
|
||||||
|
init(_ blockProcessorProgress: CompactBlockProgress) {
|
||||||
|
switch blockProcessorProgress {
|
||||||
|
|
||||||
|
case .download(let progressReport):
|
||||||
|
self = SyncStatus.downloading(progressReport)
|
||||||
|
case .validate:
|
||||||
|
self = .validating
|
||||||
|
case .scan(let progressReport):
|
||||||
|
self = .scanning(progressReport)
|
||||||
|
case .enhance(let enhancingReport):
|
||||||
|
self = .enhancing(enhancingReport)
|
||||||
|
case .fetch:
|
||||||
|
self = .fetching
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -643,7 +643,7 @@ public class SDKSynchronizer: Synchronizer {
|
||||||
userInfo[NotificationKeys.progress] = progress
|
userInfo[NotificationKeys.progress] = progress
|
||||||
userInfo[NotificationKeys.blockHeight] = progress.progressHeight
|
userInfo[NotificationKeys.blockHeight] = progress.progressHeight
|
||||||
userInfo[NotificationKeys.blockDate] = progress.progressHeight
|
userInfo[NotificationKeys.blockDate] = progress.progressHeight
|
||||||
|
self.status = SyncStatus(progress)
|
||||||
NotificationCenter.default.post(name: Notification.Name.synchronizerProgressUpdated, object: self, userInfo: userInfo)
|
NotificationCenter.default.post(name: Notification.Name.synchronizerProgressUpdated, object: self, userInfo: userInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue