mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Progress indicators
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user