Progress indicators

This commit is contained in:
Ali
2023-10-20 14:32:12 +04:00
parent 89fbca6fdb
commit dd46ccd6ed
14 changed files with 558 additions and 163 deletions

View File

@@ -130,6 +130,8 @@ public class ChatMessageReplyInfoNode: ASDisplayNode {
private var previousMediaReference: AnyMediaReference?
private var expiredStoryIconView: UIImageView?
private var currentProgressDisposable: Disposable?
override public init() {
self.backgroundView = MessageInlineBlockBackgroundView(frame: CGRect())
@@ -144,6 +146,24 @@ public class ChatMessageReplyInfoNode: ASDisplayNode {
self.addSubnode(self.contentNode)
}
deinit {
self.currentProgressDisposable?.dispose()
}
public func makeProgress() -> Promise<Bool> {
let progress = Promise<Bool>()
self.currentProgressDisposable?.dispose()
self.currentProgressDisposable = (progress.get()
|> distinctUntilChanged
|> deliverOnMainQueue).start(next: { [weak self] hasProgress in
guard let self else {
return
}
self.backgroundView.displayProgress = hasProgress
})
return progress
}
public static func asyncLayout(_ maybeNode: ChatMessageReplyInfoNode?) -> (_ arguments: Arguments) -> (CGSize, (CGSize, Bool, ListViewItemUpdateAnimation) -> ChatMessageReplyInfoNode) {
let titleNodeLayout = TextNode.asyncLayout(maybeNode?.titleNode)
let textNodeLayout = TextNodeWithEntities.asyncLayout(maybeNode?.textNode)