Added Instant View 2.0 components support

This commit is contained in:
Ilya Laktyushin
2018-11-02 11:52:37 +04:00
parent 04b200586f
commit ca6c287be4
59 changed files with 5040 additions and 2743 deletions

View File

@@ -1916,7 +1916,8 @@ class ChatMessageBubbleItemNode: ChatMessageItemView {
}
self.item?.controllerInteraction.cancelInteractiveKeyboardGestures()
case .changed:
let translation = recognizer.translation(in: self.view)
var translation = recognizer.translation(in: self.view)
translation.x = max(-80.0, min(0.0, translation.x))
var animateReplyNodeIn = false
if (translation.x < -45.0) != (self.currentSwipeToReplyTranslation < -45.0) {
if translation.x < -45.0, self.swipeToReplyNode == nil, let item = self.item {
@@ -1938,6 +1939,8 @@ class ChatMessageBubbleItemNode: ChatMessageItemView {
if animateReplyNodeIn {
swipeToReplyNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.12)
swipeToReplyNode.layer.animateSpring(from: 0.1 as NSNumber, to: 1.0 as NSNumber, keyPath: "transform.scale", duration: 0.4)
} else {
swipeToReplyNode.alpha = min(1.0, abs(translation.x / 45.0))
}
}
case .cancelled, .ended: