@@ -390,14 +390,6 @@ final class ChatSendMessageActionSheetControllerNode: ViewControllerTracingNode,
390390 intermediateCompletion ( )
391391 } )
392392
393- Queue . mainQueue ( ) . after ( 0.7 ) {
394- completedAlpha = true
395- completedButton = true
396- completedBubble = true
397- completedEffect = true
398- intermediateCompletion ( )
399- }
400-
401393 self . dimNode. layer. animateAlpha ( from: 1.0 , to: 0.0 , duration: 0.3 , removeOnCompletion: false )
402394 self . contentContainerNode. layer. animateAlpha ( from: 1.0 , to: 0.0 , duration: 0.2 , removeOnCompletion: false , completion: { _ in } )
403395
@@ -453,13 +445,21 @@ final class ChatSendMessageActionSheetControllerNode: ViewControllerTracingNode,
453445 let textOffset = self . textInputNode. textView. contentSize. height - self . textInputNode. textView. contentOffset. y - self . textInputNode. textView. frame. height
454446 self . fromMessageTextNode. layer. animatePosition ( from: CGPoint ( ) , to: CGPoint ( x: 0.0 , y: delta * 2.0 + textOffset) , duration: duration, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false , additive: true )
455447 self . toMessageTextNode. layer. animatePosition ( from: CGPoint ( ) , to: CGPoint ( x: 0.0 , y: delta * 2.0 + textOffset) , duration: duration, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false , additive: true )
448+ } else {
449+ completedBubble = true
456450 }
457451
458452 self . contentContainerNode. layer. animatePosition ( from: CGPoint ( ) , to: CGPoint ( x: 160.0 , y: 0.0 ) , duration: duration, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false , additive: true )
459453 self . contentContainerNode. layer. animateScale ( from: 1.0 , to: 0.4 , duration: duration, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false )
460454 }
461455 }
462456
457+ func scrollViewDidScroll( _ scrollView: UIScrollView ) {
458+ if let layout = self . validLayout {
459+ self . containerLayoutUpdated ( layout, transition: . immediate)
460+ }
461+ }
462+
463463 func containerLayoutUpdated( _ layout: ContainerViewLayout , transition: ContainedViewLayoutTransition ) {
464464 self . validLayout = layout
465465
@@ -484,10 +484,13 @@ final class ChatSendMessageActionSheetControllerNode: ViewControllerTracingNode,
484484 let insets = layout. insets ( options: [ . statusBar, . input] )
485485 let inputHeight = layout. inputHeight ?? 0.0
486486
487+ let contentOffset = self . scrollNode. view. contentOffset. y
488+
487489 var contentOrigin = CGPoint ( x: layout. size. width - sideInset - contentSize. width - layout. safeInsets. right, y: layout. size. height - 6.0 - insets. bottom - contentSize. height)
488490 if inputHeight > 0.0 {
489491 contentOrigin. y += 60.0
490492 }
493+ contentOrigin. y = min ( contentOrigin. y + contentOffset, layout. size. height - 6.0 - layout. intrinsicInsets. bottom - contentSize. height)
491494
492495 transition. updateFrame ( node: self . contentContainerNode, frame: CGRect ( origin: contentOrigin, size: contentSize) )
493496 var nextY : CGFloat = 0.0
@@ -502,6 +505,7 @@ final class ChatSendMessageActionSheetControllerNode: ViewControllerTracingNode,
502505 if inputHeight. isZero {
503506 sendButtonFrame. origin. y -= 60.0
504507 }
508+ sendButtonFrame. origin. y = min ( sendButtonFrame. origin. y + contentOffset, layout. size. height - layout. intrinsicInsets. bottom - initialSendButtonFrame. height)
505509 transition. updateFrame ( node: self . sendButtonNode, frame: sendButtonFrame)
506510
507511 var messageFrame = self . textFieldFrame
0 commit comments