mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
1b05fde193
@ -261,6 +261,26 @@ public extension CALayer {
|
||||
}
|
||||
self.animate(from: NSValue(cgRect: from), to: NSValue(cgRect: to), keyPath: "bounds", timingFunction: timingFunction, duration: duration, delay: delay, mediaTimingFunction: mediaTimingFunction, removeOnCompletion: removeOnCompletion, additive: additive, completion: completion)
|
||||
}
|
||||
|
||||
func animateWidth(from: CGFloat, to: CGFloat, duration: Double, delay: Double = 0.0, timingFunction: String, mediaTimingFunction: CAMediaTimingFunction? = nil, removeOnCompletion: Bool = true, additive: Bool = false, force: Bool = false, completion: ((Bool) -> Void)? = nil) {
|
||||
if from == to && !force {
|
||||
if let completion = completion {
|
||||
completion(true)
|
||||
}
|
||||
return
|
||||
}
|
||||
self.animate(from: from as NSNumber, to: to as NSNumber, keyPath: "bounds.size.width", timingFunction: timingFunction, duration: duration, delay: delay, mediaTimingFunction: mediaTimingFunction, removeOnCompletion: removeOnCompletion, additive: additive, completion: completion)
|
||||
}
|
||||
|
||||
func animateHeight(from: CGFloat, to: CGFloat, duration: Double, delay: Double = 0.0, timingFunction: String, mediaTimingFunction: CAMediaTimingFunction? = nil, removeOnCompletion: Bool = true, additive: Bool = false, force: Bool = false, completion: ((Bool) -> Void)? = nil) {
|
||||
if from == to && !force {
|
||||
if let completion = completion {
|
||||
completion(true)
|
||||
}
|
||||
return
|
||||
}
|
||||
self.animate(from: from as NSNumber, to: to as NSNumber, keyPath: "bounds.size.height", timingFunction: timingFunction, duration: duration, delay: delay, mediaTimingFunction: mediaTimingFunction, removeOnCompletion: removeOnCompletion, additive: additive, completion: completion)
|
||||
}
|
||||
|
||||
func animateBoundsOriginXAdditive(from: CGFloat, to: CGFloat, duration: Double, timingFunction: String = CAMediaTimingFunctionName.easeInEaseOut.rawValue, mediaTimingFunction: CAMediaTimingFunction? = nil, removeOnCompletion: Bool = true, completion: ((Bool) -> Void)? = nil) {
|
||||
self.animate(from: from as NSNumber, to: to as NSNumber, keyPath: "bounds.origin.x", timingFunction: timingFunction, duration: duration, mediaTimingFunction: mediaTimingFunction, removeOnCompletion: removeOnCompletion, additive: true, completion: completion)
|
||||
|
@ -394,6 +394,21 @@ public extension ContainedViewLayoutTransition {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func animateFrame(layer: CALayer, from frame: CGRect, to toFrame: CGRect? = nil, removeOnCompletion: Bool = true, additive: Bool = false, completion: ((Bool) -> Void)? = nil) {
|
||||
switch self {
|
||||
case .immediate:
|
||||
if let completion = completion {
|
||||
completion(true)
|
||||
}
|
||||
case let .animated(duration, curve):
|
||||
layer.animateFrame(from: frame, to: toFrame ?? layer.frame, duration: duration, timingFunction: curve.timingFunction, mediaTimingFunction: curve.mediaTimingFunction, removeOnCompletion: removeOnCompletion, additive: additive, completion: { result in
|
||||
if let completion = completion {
|
||||
completion(result)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func animateBounds(layer: CALayer, from bounds: CGRect, removeOnCompletion: Bool = true, completion: ((Bool) -> Void)? = nil) {
|
||||
switch self {
|
||||
@ -409,6 +424,36 @@ public extension ContainedViewLayoutTransition {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func animateWidthAdditive(layer: CALayer, value: CGFloat, removeOnCompletion: Bool = true, completion: ((Bool) -> Void)? = nil) {
|
||||
switch self {
|
||||
case .immediate:
|
||||
if let completion = completion {
|
||||
completion(true)
|
||||
}
|
||||
case let .animated(duration, curve):
|
||||
layer.animateWidth(from: value, to: 0.0, duration: duration, timingFunction: curve.timingFunction, mediaTimingFunction: curve.mediaTimingFunction, removeOnCompletion: removeOnCompletion, additive: true, completion: { result in
|
||||
if let completion = completion {
|
||||
completion(result)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func animateHeightAdditive(layer: CALayer, value: CGFloat, removeOnCompletion: Bool = true, completion: ((Bool) -> Void)? = nil) {
|
||||
switch self {
|
||||
case .immediate:
|
||||
if let completion = completion {
|
||||
completion(true)
|
||||
}
|
||||
case let .animated(duration, curve):
|
||||
layer.animateHeight(from: value, to: 0.0, duration: duration, timingFunction: curve.timingFunction, mediaTimingFunction: curve.mediaTimingFunction, removeOnCompletion: removeOnCompletion, additive: true, completion: { result in
|
||||
if let completion = completion {
|
||||
completion(result)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func animateOffsetAdditive(node: ASDisplayNode, offset: CGFloat) {
|
||||
switch self {
|
||||
@ -429,6 +474,17 @@ public extension ContainedViewLayoutTransition {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func animateHorizontalOffsetAdditive(layer: CALayer, offset: CGFloat, completion: (() -> Void)? = nil) {
|
||||
switch self {
|
||||
case .immediate:
|
||||
break
|
||||
case let .animated(duration, curve):
|
||||
layer.animateBoundsOriginXAdditive(from: offset, to: 0.0, duration: duration, timingFunction: curve.timingFunction, mediaTimingFunction: curve.mediaTimingFunction, completion: { _ in
|
||||
completion?()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func animateOffsetAdditive(layer: CALayer, offset: CGFloat, completion: (() -> Void)? = nil) {
|
||||
switch self {
|
||||
@ -470,13 +526,13 @@ public extension ContainedViewLayoutTransition {
|
||||
}
|
||||
}
|
||||
|
||||
func animatePositionAdditive(layer: CALayer, offset: CGPoint, to toOffset: CGPoint = CGPoint(), removeOnCompletion: Bool = true, completion: (() -> Void)? = nil) {
|
||||
func animatePositionAdditive(layer: CALayer, offset: CGPoint, to toOffset: CGPoint = CGPoint(), removeOnCompletion: Bool = true, completion: ((Bool) -> Void)? = nil) {
|
||||
switch self {
|
||||
case .immediate:
|
||||
completion?()
|
||||
completion?(true)
|
||||
case let .animated(duration, curve):
|
||||
layer.animatePosition(from: offset, to: toOffset, duration: duration, timingFunction: curve.timingFunction, mediaTimingFunction: curve.mediaTimingFunction, removeOnCompletion: removeOnCompletion, additive: true, completion: { _ in
|
||||
completion?()
|
||||
layer.animatePosition(from: offset, to: toOffset, duration: duration, timingFunction: curve.timingFunction, mediaTimingFunction: curve.mediaTimingFunction, removeOnCompletion: removeOnCompletion, additive: true, completion: { result in
|
||||
completion?(result)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1177,7 +1233,92 @@ public extension ContainedViewLayoutTransition {
|
||||
}
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
public struct CombinedTransition {
|
||||
public var horizontal: ContainedViewLayoutTransition
|
||||
public var vertical: ContainedViewLayoutTransition
|
||||
|
||||
public var isAnimated: Bool {
|
||||
return self.horizontal.isAnimated || self.vertical.isAnimated
|
||||
}
|
||||
|
||||
public init(horizontal: ContainedViewLayoutTransition, vertical: ContainedViewLayoutTransition) {
|
||||
self.horizontal = horizontal
|
||||
self.vertical = vertical
|
||||
}
|
||||
|
||||
public func animateFrame(layer: CALayer, from fromFrame: CGRect, completion: ((Bool) -> Void)? = nil) {
|
||||
//self.horizontal.animateFrame(layer: layer, from: fromFrame, completion: completion)
|
||||
//return;
|
||||
|
||||
let toFrame = layer.frame
|
||||
|
||||
enum Keys: CaseIterable {
|
||||
case positionX, positionY
|
||||
case sizeWidth, sizeHeight
|
||||
}
|
||||
var remainingKeys = Keys.allCases
|
||||
var completedValue = true
|
||||
let completeKey: (Keys, Bool) -> Void = { key, completed in
|
||||
remainingKeys.removeAll(where: { $0 == key })
|
||||
if !completed {
|
||||
completedValue = false
|
||||
}
|
||||
if remainingKeys.isEmpty {
|
||||
completion?(completedValue)
|
||||
}
|
||||
}
|
||||
|
||||
self.horizontal.animatePositionAdditive(layer: layer, offset: CGPoint(x: fromFrame.midX - toFrame.midX, y: 0.0), completion: { result in
|
||||
completeKey(.positionX, result)
|
||||
})
|
||||
self.vertical.animatePositionAdditive(layer: layer, offset: CGPoint(x: 0.0, y: fromFrame.midY - toFrame.midY), completion: { result in
|
||||
completeKey(.positionY, result)
|
||||
})
|
||||
|
||||
//self.horizontal.animateHorizontalOffsetAdditive(layer: layer, offset: (fromFrame.width - toFrame.width) / 4.0)
|
||||
//self.vertical.animateOffsetAdditive(layer: layer, offset: (fromFrame.height - toFrame.height) / 2.0)
|
||||
|
||||
self.horizontal.animateWidthAdditive(layer: layer, value: fromFrame.width - toFrame.width, completion: { result in
|
||||
completeKey(.sizeWidth, result)
|
||||
})
|
||||
self.vertical.animateHeightAdditive(layer: layer, value: fromFrame.height - toFrame.height, completion: { result in
|
||||
completeKey(.sizeHeight, result)
|
||||
})
|
||||
}
|
||||
|
||||
public func updateFrame(layer: CALayer, frame: CGRect, completion: ((Bool) -> Void)? = nil) {
|
||||
let fromFrame = layer.frame
|
||||
layer.frame = frame
|
||||
self.animateFrame(layer: layer, from: fromFrame, completion: completion)
|
||||
}
|
||||
|
||||
public func updatePosition(layer: CALayer, position: CGPoint, completion: ((Bool) -> Void)? = nil) {
|
||||
let fromPosition = layer.position
|
||||
layer.position = position
|
||||
|
||||
enum Keys: CaseIterable {
|
||||
case positionX, positionY
|
||||
}
|
||||
var remainingKeys = Keys.allCases
|
||||
var completedValue = true
|
||||
let completeKey: (Keys, Bool) -> Void = { key, completed in
|
||||
remainingKeys.removeAll(where: { $0 == key })
|
||||
if !completed {
|
||||
completedValue = false
|
||||
}
|
||||
if remainingKeys.isEmpty {
|
||||
completion?(completedValue)
|
||||
}
|
||||
}
|
||||
|
||||
self.horizontal.animatePositionAdditive(layer: layer, offset: CGPoint(x: fromPosition.x - position.x, y: 0.0), completion: { result in
|
||||
completeKey(.positionX, result)
|
||||
})
|
||||
self.vertical.animatePositionAdditive(layer: layer, offset: CGPoint(x: 0.0, y: fromPosition.y - position.y), completion: { result in
|
||||
completeKey(.positionY, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
public extension ContainedViewLayoutTransition {
|
||||
func animateView(_ f: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) {
|
||||
@ -1192,5 +1333,3 @@ public extension ContainedViewLayoutTransition {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -448,7 +448,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
||||
panelControlDisabledColor: UIColor(rgb: 0x808080, alpha: 0.5),
|
||||
panelControlDestructiveColor: UIColor(rgb: 0xff3b30),
|
||||
inputBackgroundColor: UIColor(rgb: 0x060606),
|
||||
inputStrokeColor: UIColor(rgb: 0x353537),
|
||||
inputStrokeColor: UIColor(rgb: 0xffffff, alpha: 0.1),
|
||||
inputPlaceholderColor: UIColor(rgb: 0x7b7b7b),
|
||||
inputTextColor: UIColor(rgb: 0xffffff),
|
||||
inputControlColor: UIColor(rgb: 0x7b7b7b),
|
||||
|
@ -345,7 +345,7 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio
|
||||
secondaryTextColor: UIColor(rgb: 0x787878),
|
||||
controlColor: UIColor(rgb: 0x7e8791),
|
||||
accentTextColor: UIColor(rgb: 0x007ee5),
|
||||
blurredBackgroundColor: UIColor(rgb: 0xf7f7f7, alpha: 0.86),
|
||||
blurredBackgroundColor: UIColor(rgb: 0xf2f2f2, alpha: 0.8),
|
||||
opaqueBackgroundColor: UIColor(rgb: 0xf7f7f7).mixedWith(.white, alpha: 0.14),
|
||||
separatorColor: UIColor(rgb: 0xc8c7cc),
|
||||
badgeBackgroundColor: UIColor(rgb: 0xff3b30),
|
||||
@ -374,7 +374,7 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio
|
||||
let navigationSearchBar = PresentationThemeNavigationSearchBar(
|
||||
backgroundColor: UIColor(rgb: 0xffffff),
|
||||
accentColor: UIColor(rgb: 0x007ee5),
|
||||
inputFillColor: UIColor(rgb: 0xe9e9e9),
|
||||
inputFillColor: UIColor(rgb: 0x000000, alpha: 0.06),
|
||||
inputTextColor: UIColor(rgb: 0x000000),
|
||||
inputPlaceholderTextColor: UIColor(rgb: 0x8e8e93),
|
||||
inputIconColor: UIColor(rgb: 0x8e8e93),
|
||||
@ -669,7 +669,7 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio
|
||||
panelControlDisabledColor: UIColor(rgb: 0x727b87, alpha: 0.5),
|
||||
panelControlDestructiveColor: UIColor(rgb: 0xff3b30),
|
||||
inputBackgroundColor: UIColor(rgb: 0xffffff),
|
||||
inputStrokeColor: UIColor(rgb: 0xd9dcdf),
|
||||
inputStrokeColor: UIColor(rgb: 0x000000, alpha: 0.1),
|
||||
inputPlaceholderColor: UIColor(rgb: 0xbebec0),
|
||||
inputTextColor: UIColor(rgb: 0x000000),
|
||||
inputControlColor: UIColor(rgb: 0xa0a7b0),
|
||||
|
@ -234,7 +234,7 @@ class ChatMessageBackground: ASDisplayNode {
|
||||
self.outlineImageNode.image = outlineImage
|
||||
}
|
||||
|
||||
func animateFrom(sourceView: UIView, transition: ContainedViewLayoutTransition) {
|
||||
func animateFrom(sourceView: UIView, transition: CombinedTransition) {
|
||||
if transition.isAnimated {
|
||||
self.imageNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.1)
|
||||
self.outlineImageNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.1)
|
||||
@ -245,9 +245,9 @@ class ChatMessageBackground: ASDisplayNode {
|
||||
sourceView?.removeFromSuperview()
|
||||
})
|
||||
|
||||
transition.animateFrame(node: self.imageNode, from: sourceView.frame)
|
||||
transition.animateFrame(node: self.outlineImageNode, from: sourceView.frame)
|
||||
transition.updateFrame(view: sourceView, frame: CGRect(origin: self.imageNode.frame.origin, size: CGSize(width: self.imageNode.frame.width - 7.0, height: self.imageNode.frame.height)))
|
||||
transition.animateFrame(layer: self.imageNode.layer, from: sourceView.frame)
|
||||
transition.animateFrame(layer: self.outlineImageNode.layer, from: sourceView.frame)
|
||||
transition.updateFrame(layer: sourceView.layer, frame: CGRect(origin: self.imageNode.frame.origin, size: CGSize(width: self.imageNode.frame.width - 7.0, height: self.imageNode.frame.height)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,16 @@ final class ChatMessageBubbleBackdrop: ASDisplayNode {
|
||||
})
|
||||
}
|
||||
|
||||
func animateFrom(sourceView: UIView, mediaBox: MediaBox, transition: ContainedViewLayoutTransition) {
|
||||
func updateFrame(_ value: CGRect, transition: CombinedTransition, completion: @escaping () -> Void = {}) {
|
||||
if let maskView = self.maskView {
|
||||
transition.updateFrame(layer: maskView.layer, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: value.size.width, height: value.size.height)).insetBy(dx: -maskInset, dy: -maskInset))
|
||||
}
|
||||
transition.updateFrame(layer: self.layer, frame: value, completion: { _ in
|
||||
completion()
|
||||
})
|
||||
}
|
||||
|
||||
func animateFrom(sourceView: UIView, mediaBox: MediaBox, transition: CombinedTransition) {
|
||||
if transition.isAnimated {
|
||||
let previousFrame = self.frame
|
||||
self.updateFrame(CGRect(origin: CGPoint(x: previousFrame.minX, y: sourceView.frame.minY), size: sourceView.frame.size), transition: .immediate)
|
||||
|
@ -665,26 +665,27 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
}
|
||||
}
|
||||
|
||||
func animateContentFromTextInputField(textInput: ChatMessageTransitionNode.Source.TextInput, horizontalTransition: ContainedViewLayoutTransition, verticalTransition: ContainedViewLayoutTransition) {
|
||||
func animateContentFromTextInputField(textInput: ChatMessageTransitionNode.Source.TextInput, transition: CombinedTransition) {
|
||||
guard let item = self.item else {
|
||||
return
|
||||
}
|
||||
let widthDifference = self.backgroundNode.frame.width - textInput.backgroundView.frame.width
|
||||
let heightDifference = self.backgroundNode.frame.height - textInput.backgroundView.frame.height
|
||||
|
||||
horizontalTransition.animateFrame(node: self.clippingNode, from: CGRect(origin: CGPoint(x: self.clippingNode.frame.minX, y: textInput.backgroundView.frame.minY), size: textInput.backgroundView.frame.size))
|
||||
horizontalTransition.animateOffsetAdditive(layer: self.clippingNode.layer, offset: textInput.backgroundView.frame.minY - self.clippingNode.frame.minY)
|
||||
transition.animateFrame(layer: self.clippingNode.layer, from: CGRect(origin: CGPoint(x: self.clippingNode.frame.minX, y: textInput.backgroundView.frame.minY), size: textInput.backgroundView.frame.size))
|
||||
|
||||
self.backgroundWallpaperNode.animateFrom(sourceView: textInput.backgroundView, mediaBox: item.context.account.postbox.mediaBox, transition: horizontalTransition)
|
||||
self.backgroundNode.animateFrom(sourceView: textInput.backgroundView, transition: horizontalTransition)
|
||||
transition.vertical.animateOffsetAdditive(layer: self.clippingNode.layer, offset: textInput.backgroundView.frame.minY - self.clippingNode.frame.minY)
|
||||
|
||||
self.backgroundWallpaperNode.animateFrom(sourceView: textInput.backgroundView, mediaBox: item.context.account.postbox.mediaBox, transition: transition)
|
||||
self.backgroundNode.animateFrom(sourceView: textInput.backgroundView, transition: transition)
|
||||
|
||||
for contentNode in self.contentNodes {
|
||||
if let contentNode = contentNode as? ChatMessageTextBubbleContentNode {
|
||||
let localSourceContentFrame = self.mainContextSourceNode.contentNode.view.convert(textInput.contentView.frame.offsetBy(dx: self.mainContextSourceNode.contentRect.minX, dy: self.mainContextSourceNode.contentRect.minY), to: contentNode.view)
|
||||
textInput.contentView.frame = localSourceContentFrame
|
||||
contentNode.animateFrom(sourceView: textInput.contentView, widthDifference: widthDifference, transition: horizontalTransition)
|
||||
contentNode.animateFrom(sourceView: textInput.contentView, scrollOffset: textInput.scrollOffset, widthDifference: widthDifference, transition: transition)
|
||||
} else if let contentNode = contentNode as? ChatMessageWebpageBubbleContentNode {
|
||||
horizontalTransition.animatePositionAdditive(node: contentNode, offset: CGPoint(x: 0.0, y: heightDifference))
|
||||
transition.vertical.animatePositionAdditive(node: contentNode, offset: CGPoint(x: 0.0, y: heightDifference))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -641,7 +641,7 @@ class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
return self.statusNode
|
||||
}
|
||||
|
||||
func animateFrom(sourceView: UIView, widthDifference: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
func animateFrom(sourceView: UIView, scrollOffset: CGFloat, widthDifference: CGFloat, transition: CombinedTransition) {
|
||||
self.view.addSubview(sourceView)
|
||||
|
||||
sourceView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.1, removeOnCompletion: false, completion: { [weak sourceView] _ in
|
||||
@ -651,13 +651,13 @@ class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
|
||||
let offset = CGPoint(
|
||||
x: sourceView.frame.minX - (self.textNode.frame.minX - 0.0),
|
||||
y: sourceView.frame.minY - (self.textNode.frame.minY - 3.0)
|
||||
y: sourceView.frame.minY - (self.textNode.frame.minY - 3.0) - scrollOffset
|
||||
)
|
||||
|
||||
transition.animatePositionAdditive(node: self.textNode, offset: offset)
|
||||
transition.vertical.animatePositionAdditive(node: self.textNode, offset: offset)
|
||||
transition.updatePosition(layer: sourceView.layer, position: CGPoint(x: sourceView.layer.position.x - offset.x, y: sourceView.layer.position.y - offset.y))
|
||||
|
||||
self.statusNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
|
||||
transition.animatePositionAdditive(node: self.statusNode, offset: CGPoint(x: -widthDifference, y: 0.0))
|
||||
transition.horizontal.animatePositionAdditive(node: self.statusNode, offset: CGPoint(x: -widthDifference, y: 0.0))
|
||||
}
|
||||
}
|
||||
|
@ -117,11 +117,13 @@ final class ChatMessageTransitionNode: ASDisplayNode {
|
||||
let backgroundView: UIView
|
||||
let contentView: UIView
|
||||
let sourceRect: CGRect
|
||||
let scrollOffset: CGFloat
|
||||
|
||||
init(backgroundView: UIView, contentView: UIView, sourceRect: CGRect) {
|
||||
init(backgroundView: UIView, contentView: UIView, sourceRect: CGRect, scrollOffset: CGFloat) {
|
||||
self.backgroundView = backgroundView
|
||||
self.contentView = contentView
|
||||
self.sourceRect = sourceRect
|
||||
self.scrollOffset = scrollOffset
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,15 +241,12 @@ final class ChatMessageTransitionNode: ASDisplayNode {
|
||||
self.containerNode.addSubnode(self.contextSourceNode.contentNode)
|
||||
|
||||
let targetAbsoluteRect = self.contextSourceNode.view.convert(self.contextSourceNode.contentRect, to: self.view)
|
||||
if abs(targetAbsoluteRect.minY - 691.6666666666666) > 0.1 {
|
||||
assert(true)
|
||||
}
|
||||
|
||||
let sourceRect = self.view.convert(initialTextInput.sourceRect, from: nil)
|
||||
let sourceBackgroundAbsoluteRect = initialTextInput.backgroundView.frame.offsetBy(dx: sourceRect.minX, dy: sourceRect.minY)
|
||||
let sourceAbsoluteRect = CGRect(origin: CGPoint(x: sourceBackgroundAbsoluteRect.minX, y: sourceBackgroundAbsoluteRect.maxY - self.contextSourceNode.contentRect.height), size: self.contextSourceNode.contentRect.size)
|
||||
|
||||
let textInput = ChatMessageTransitionNode.Source.TextInput(backgroundView: initialTextInput.backgroundView, contentView: initialTextInput.contentView, sourceRect: sourceRect)
|
||||
let textInput = ChatMessageTransitionNode.Source.TextInput(backgroundView: initialTextInput.backgroundView, contentView: initialTextInput.contentView, sourceRect: sourceRect, scrollOffset: initialTextInput.scrollOffset)
|
||||
|
||||
textInput.backgroundView.frame = CGRect(origin: CGPoint(x: 0.0, y: sourceAbsoluteRect.height - sourceBackgroundAbsoluteRect.height), size: textInput.backgroundView.bounds.size)
|
||||
textInput.contentView.frame = textInput.contentView.frame.offsetBy(dx: 0.0, dy: sourceAbsoluteRect.height - sourceBackgroundAbsoluteRect.height)
|
||||
@ -266,8 +265,10 @@ final class ChatMessageTransitionNode: ASDisplayNode {
|
||||
let transition: ContainedViewLayoutTransition = .animated(duration: horizontalDuration, curve: .custom(0.33, 0.0, 0.0, 1.0))
|
||||
let verticalTransition: ContainedViewLayoutTransition = .animated(duration: verticalDuration, curve: .custom(0.33, 0.0, 0.0, 1.0))
|
||||
|
||||
let combinedTransition = CombinedTransition(horizontal: transition, vertical: verticalTransition)
|
||||
|
||||
if let itemNode = self.itemNode as? ChatMessageBubbleItemNode {
|
||||
itemNode.animateContentFromTextInputField(textInput: textInput, horizontalTransition: transition, verticalTransition: verticalTransition)
|
||||
itemNode.animateContentFromTextInputField(textInput: textInput, transition: combinedTransition)
|
||||
if let sourceReplyPanel = sourceReplyPanel {
|
||||
itemNode.animateReplyPanel(sourceReplyPanel: sourceReplyPanel, horizontalTransition: transition, verticalTransition: verticalTransition)
|
||||
}
|
||||
|
@ -622,7 +622,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
||||
accessoryButtonsWidth += button.buttonWidth
|
||||
}
|
||||
|
||||
textInputNode.frame = CGRect(origin: CGPoint(x: self.textInputViewInternalInsets.left, y: self.textInputViewInternalInsets.top), size: CGSize(width: textInputFrame.size.width - (self.textInputViewInternalInsets.left + self.textInputViewInternalInsets.right + accessoryButtonsWidth), height: textInputFrame.size.height - self.textInputViewInternalInsets.top - self.textInputViewInternalInsets.bottom))
|
||||
textInputNode.frame = CGRect(origin: CGPoint(x: self.textInputViewInternalInsets.left, y: self.textInputViewInternalInsets.top), size: CGSize(width: textInputFrame.size.width - (self.textInputViewInternalInsets.left + self.textInputViewInternalInsets.right), height: textInputFrame.size.height - self.textInputViewInternalInsets.top - self.textInputViewInternalInsets.bottom))
|
||||
}
|
||||
|
||||
self.textInputBackgroundNode.isUserInteractionEnabled = false
|
||||
@ -671,7 +671,8 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
||||
|
||||
let textFieldHeight: CGFloat
|
||||
if let textInputNode = self.textInputNode {
|
||||
let measuredHeight = textInputNode.measure(CGSize(width: width - textFieldInsets.left - textFieldInsets.right - self.textInputViewInternalInsets.left - self.textInputViewInternalInsets.right - accessoryButtonsWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
let maxTextWidth = width - textFieldInsets.left - textFieldInsets.right - self.textInputViewInternalInsets.left - self.textInputViewInternalInsets.right
|
||||
let measuredHeight = textInputNode.measure(CGSize(width: maxTextWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
let unboundTextFieldHeight = max(textFieldMinHeight, ceil(measuredHeight.height))
|
||||
|
||||
let maxNumberOfLines = min(12, (Int(fieldMaxHeight - 11.0) - 33) / 22)
|
||||
@ -1311,7 +1312,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
||||
transition.updateAlpha(node: self.textInputContainer, alpha: audioRecordingItemsAlpha)
|
||||
|
||||
if let textInputNode = self.textInputNode {
|
||||
let textFieldFrame = CGRect(origin: CGPoint(x: self.textInputViewInternalInsets.left, y: self.textInputViewInternalInsets.top), size: CGSize(width: textInputFrame.size.width - (self.textInputViewInternalInsets.left + self.textInputViewInternalInsets.right + accessoryButtonsWidth), height: textInputFrame.size.height - self.textInputViewInternalInsets.top - textInputViewInternalInsets.bottom))
|
||||
let textFieldFrame = CGRect(origin: CGPoint(x: self.textInputViewInternalInsets.left, y: self.textInputViewInternalInsets.top), size: CGSize(width: textInputFrame.size.width - (self.textInputViewInternalInsets.left + self.textInputViewInternalInsets.right), height: textInputFrame.size.height - self.textInputViewInternalInsets.top - textInputViewInternalInsets.bottom))
|
||||
let shouldUpdateLayout = textFieldFrame.size != textInputNode.frame.size
|
||||
transition.updateFrame(node: textInputNode, frame: textFieldFrame)
|
||||
if shouldUpdateLayout {
|
||||
@ -2222,7 +2223,8 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
||||
return ChatMessageTransitionNode.Source.TextInput(
|
||||
backgroundView: backgroundView,
|
||||
contentView: contentView,
|
||||
sourceRect: self.view.convert(self.bounds, to: nil)
|
||||
sourceRect: self.view.convert(self.bounds, to: nil),
|
||||
scrollOffset: textInputNode.textView.contentOffset.y
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -734,7 +734,7 @@ final class OverlayPlayerControlsNode: ASDisplayNode {
|
||||
copyView.frame = previousAlbumArtNodeFrame
|
||||
copyView.center = largeAlbumArtFrame.center
|
||||
self.view.insertSubview(copyView, belowSubview: largeAlbumArtNode.view)
|
||||
transition.animatePositionAdditive(layer: copyView.layer, offset: CGPoint(x: previousAlbumArtNodeFrame.center.x - largeAlbumArtFrame.center.x, y: previousAlbumArtNodeFrame.center.y - largeAlbumArtFrame.center.y), completion: { [weak copyView] in
|
||||
transition.animatePositionAdditive(layer: copyView.layer, offset: CGPoint(x: previousAlbumArtNodeFrame.center.x - largeAlbumArtFrame.center.x, y: previousAlbumArtNodeFrame.center.y - largeAlbumArtFrame.center.y), completion: { [weak copyView] _ in
|
||||
copyView?.removeFromSuperview()
|
||||
})
|
||||
//copyView.layer.animatePosition(from: CGPoint(x: -50.0, y: 0.0), to: CGPoint(), duration: 0.15, timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, additive: true)
|
||||
|
@ -5703,7 +5703,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
})
|
||||
}
|
||||
} else if let currentPaneKey = self.paneContainerNode.currentPaneKey, case .members = currentPaneKey {
|
||||
self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, mode: .list, placeholder: self.presentationData.strings.Common_Search, contentNode: ChannelMembersSearchContainerNode(context: self.context, forceTheme: nil, peerId: self.peerId, mode: .searchMembers, filters: [], searchContext: self.groupMembersSearchContext, openPeer: { [weak self] peer, participant in
|
||||
self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, mode: .list, placeholder: self.presentationData.strings.Common_Search, hasBackground: true, hasSeparator: true, contentNode: ChannelMembersSearchContainerNode(context: self.context, forceTheme: nil, peerId: self.peerId, mode: .searchMembers, filters: [], searchContext: self.groupMembersSearchContext, openPeer: { [weak self] peer, participant in
|
||||
self?.openPeer(peerId: peer.id, navigation: .info)
|
||||
}, updateActivity: { _ in
|
||||
}, pushController: { [weak self] c in
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit dbdceac3ec178b623d4356b6096432f524940bb0
|
||||
Subproject commit f7319dc6b8cf10fc1eec3b21a7d26f92a43fb956
|
Loading…
x
Reference in New Issue
Block a user