mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
f17b0f6795
commit
a755cf26a2
@ -112,7 +112,7 @@ public final class ChatControllerInteraction {
|
||||
let displayPsa: (String, ASDisplayNode) -> Void
|
||||
let displayDiceTooltip: (TelegramMediaDice) -> Void
|
||||
let animateDiceSuccess: (Bool) -> Void
|
||||
let greetingStickerNode: () -> (ASDisplayNode, ASDisplayNode, ASDisplayNode, () -> Void)?
|
||||
let greetingStickerNode: () -> (ASDisplayNode, ASDisplayNode, ASDisplayNode, (@escaping () -> Void) -> Void)?
|
||||
let openPeerContextMenu: (Peer, ASDisplayNode, CGRect, ContextGesture?) -> Void
|
||||
let openMessageReplies: (MessageId, Bool, Bool) -> Void
|
||||
let openReplyThreadOriginalMessage: (Message) -> Void
|
||||
@ -202,7 +202,7 @@ public final class ChatControllerInteraction {
|
||||
displayPsa: @escaping (String, ASDisplayNode) -> Void,
|
||||
displayDiceTooltip: @escaping (TelegramMediaDice) -> Void,
|
||||
animateDiceSuccess: @escaping (Bool) -> Void,
|
||||
greetingStickerNode: @escaping () -> (ASDisplayNode, ASDisplayNode, ASDisplayNode, () -> Void)?,
|
||||
greetingStickerNode: @escaping () -> (ASDisplayNode, ASDisplayNode, ASDisplayNode, (@escaping () -> Void) -> Void)?,
|
||||
openPeerContextMenu: @escaping (Peer, ASDisplayNode, CGRect, ContextGesture?) -> Void,
|
||||
openMessageReplies: @escaping (MessageId, Bool, Bool) -> Void,
|
||||
openReplyThreadOriginalMessage: @escaping (Message) -> Void,
|
||||
|
@ -743,14 +743,15 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
var greetingStickerNode: (ASDisplayNode, ASDisplayNode, ASDisplayNode, () -> Void)? {
|
||||
var greetingStickerNode: (ASDisplayNode, ASDisplayNode, ASDisplayNode, (@escaping () -> Void) -> Void)? {
|
||||
if let greetingStickerNode = self.emptyNode?.greetingStickerNode {
|
||||
self.historyNode.itemHeaderNodesAlpha = 0.0
|
||||
return (greetingStickerNode, self, self.historyNode, { [weak self] in
|
||||
self?.historyNode.forEachItemHeaderNode { node in
|
||||
node.alpha = 1.0
|
||||
node.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
}
|
||||
let historyNode = self.historyNode
|
||||
historyNode.alpha = 0.0
|
||||
return (greetingStickerNode, self, self.historyNode, { completion in
|
||||
historyNode.alpha = 1.0
|
||||
historyNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2, completion: { _ in
|
||||
completion()
|
||||
})
|
||||
})
|
||||
} else {
|
||||
return nil
|
||||
|
@ -152,7 +152,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
private var animatingGreeting = false
|
||||
private weak var greetingStickerParentNode: ASDisplayNode?
|
||||
private weak var greetingStickerListNode: ASDisplayNode?
|
||||
private var greetingCompletion: (() -> Void)?
|
||||
private var greetingCompletion: ((@escaping () -> Void) -> Void)?
|
||||
|
||||
private var swipeToReplyNode: ChatMessageSwipeToReplyNode?
|
||||
private var swipeToReplyFeedback: HapticFeedback?
|
||||
@ -403,7 +403,6 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
self.greetingStickerParentNode = parentNode
|
||||
self.greetingStickerListNode = listNode
|
||||
self.greetingCompletion = greetingCompletion
|
||||
self.dateAndStatusNode.alpha = 0.0
|
||||
} else {
|
||||
animationNode = AnimatedStickerNode()
|
||||
animationNode.started = { [weak self] in
|
||||
@ -972,28 +971,27 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
parentNode.addSubnode(animationNode)
|
||||
animationNode.frame = initialFrame
|
||||
|
||||
var targetPosition = initialFrame.center.y
|
||||
var targetPositionY = initialFrame.center.y
|
||||
if let listNode = strongSelf.greetingStickerListNode as? ListView {
|
||||
targetPosition = listNode.frame.height - listNode.insets.top - animationNodeFrame.height / 2.0 - 12.0
|
||||
targetPositionY = listNode.frame.height - listNode.insets.top - animationNodeFrame.height / 2.0 - 12.0
|
||||
}
|
||||
let targetPosition = CGPoint(x: animationNodeFrame.midX, y: targetPositionY)
|
||||
|
||||
let targetScale = animationNodeFrame.width / initialFrame.width
|
||||
animationNode.layer.animateScale(from: 1.0, to: targetScale, duration: 0.3, removeOnCompletion: false)
|
||||
animationNode.layer.animatePosition(from: initialFrame.center, to: CGPoint(x: animationNodeFrame.midX, y: targetPosition), duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, completion: { [weak self] finished in
|
||||
|
||||
animationNode.layer.animatePosition(from: initialFrame.center, to: targetPosition, duration: 0.4, mediaTimingFunction: CAMediaTimingFunction(controlPoints: 0.3, 0.0, 0.0, 1.0), removeOnCompletion: false, completion: { [weak self] finished in
|
||||
if let strongSelf = self {
|
||||
animationNode.layer.removeAllAnimations()
|
||||
strongSelf.animationNode?.frame = animationNodeFrame
|
||||
strongSelf.contextSourceNode.contentNode.insertSubnode(animationNode, aboveSubnode: strongSelf.imageNode)
|
||||
|
||||
if let animationNode = strongSelf.animationNode as? AnimatedStickerNode {
|
||||
animationNode.updateLayout(size: updatedContentFrame.insetBy(dx: imageInset, dy: imageInset).size)
|
||||
}
|
||||
|
||||
strongSelf.dateAndStatusNode.alpha = 1.0
|
||||
strongSelf.dateAndStatusNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
|
||||
strongSelf.greetingCompletion?()
|
||||
strongSelf.animatingGreeting = false
|
||||
strongSelf.greetingCompletion?({
|
||||
animationNode.layer.removeAllAnimations()
|
||||
strongSelf.animationNode?.frame = animationNodeFrame
|
||||
strongSelf.contextSourceNode.contentNode.insertSubnode(animationNode, aboveSubnode: strongSelf.imageNode)
|
||||
|
||||
if let animationNode = strongSelf.animationNode as? AnimatedStickerNode {
|
||||
animationNode.updateLayout(size: updatedContentFrame.insetBy(dx: imageInset, dy: imageInset).size)
|
||||
}
|
||||
strongSelf.animatingGreeting = false
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user