diff --git a/submodules/TelegramUI/Sources/CreateChannelController.swift b/submodules/TelegramUI/Sources/CreateChannelController.swift index 9d54534f0b..7b9f0965f5 100644 --- a/submodules/TelegramUI/Sources/CreateChannelController.swift +++ b/submodules/TelegramUI/Sources/CreateChannelController.swift @@ -368,7 +368,7 @@ public func createChannelController(context: AccountContext) -> ViewController { } if let timestamp = videoStartTimestamp { - videoStartTimestamp = max(0.0, min(timestamp, result.duration)) + videoStartTimestamp = max(0.0, min(timestamp, result.duration - 0.05)) } var value = stat() diff --git a/submodules/TelegramUI/Sources/CreateGroupController.swift b/submodules/TelegramUI/Sources/CreateGroupController.swift index 638e69dff8..c4e5a59f15 100644 --- a/submodules/TelegramUI/Sources/CreateGroupController.swift +++ b/submodules/TelegramUI/Sources/CreateGroupController.swift @@ -626,7 +626,7 @@ public func createGroupControllerImpl(context: AccountContext, peerIds: [PeerId] } if let timestamp = videoStartTimestamp { - videoStartTimestamp = max(0.0, min(timestamp, result.duration)) + videoStartTimestamp = max(0.0, min(timestamp, result.duration - 0.05)) } var value = stat() diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift index 4156b6d872..9285dca119 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift @@ -1069,22 +1069,7 @@ final class PeerInfoAvatarTransformContainerNode: ASDisplayNode { self.tapped?() } } - - func reattachVideoNode() { - if let videoNode = self.videoNode { - let maskPath = UIBezierPath(ovalIn: CGRect(origin: CGPoint(), size: self.avatarNode.frame.size)) - let shape = CAShapeLayer() - shape.path = maskPath.cgPath - videoNode.layer.mask = shape - - videoNode.transform = CATransform3DIdentity - videoNode.updateLayout(size: self.avatarNode.frame.size, transition: .immediate) - videoNode.frame = self.avatarNode.frame - - self.addSubnode(videoNode) - } - } - + func updateTransitionFraction(_ fraction: CGFloat, transition: ContainedViewLayoutTransition) { if let videoNode = self.videoNode { if case .immediate = transition, fraction == 1.0 { @@ -2287,6 +2272,7 @@ final class PeerInfoHeaderNode: ASDisplayNode { private(set) var isAvatarExpanded: Bool private(set) var twoLineInfo = false var skipCollapseCompletion = false + var ignoreCollapse = false let avatarListNode: PeerInfoAvatarListNode @@ -2837,7 +2823,7 @@ final class PeerInfoHeaderNode: ASDisplayNode { } self.avatarListNode.listContainerNode.update(size: expandedAvatarListSize, peer: peer, isExpanded: self.isAvatarExpanded, transition: transition) - if self.avatarListNode.listContainerNode.isCollapsing { + if self.avatarListNode.listContainerNode.isCollapsing && !self.ignoreCollapse { self.avatarListNode.avatarContainerNode.canAttachVideo = false } diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 89772744d6..74abaee9b2 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -3990,13 +3990,11 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD } if self.headerNode.isAvatarExpanded { + self.headerNode.ignoreCollapse = true self.headerNode.updateIsAvatarExpanded(false, transition: .immediate) self.updateNavigationExpansionPresentation(isExpanded: false, animated: true) } - if let (layout, navigationHeight) = self.validLayout { - self.scrollNode.view.setContentOffset(CGPoint(), animated: false) - self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false) - } + self.scrollNode.view.setContentOffset(CGPoint(), animated: false) let resource = LocalFileMediaResource(fileId: arc4random64()) self.context.account.postbox.mediaBox.storeResourceData(resource.id, data: data) @@ -4006,6 +4004,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD if let (layout, navigationHeight) = self.validLayout { self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false) } + self.headerNode.ignoreCollapse = false let postbox = self.context.account.postbox let signal = self.isSettings ? updateAccountPhoto(account: self.context.account, resource: resource, videoResource: nil, videoStartTimestamp: nil, mapResourceToAvatarSizes: { resource, representations in @@ -4036,13 +4035,11 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD } if self.headerNode.isAvatarExpanded { + self.headerNode.ignoreCollapse = true self.headerNode.updateIsAvatarExpanded(false, transition: .immediate) self.updateNavigationExpansionPresentation(isExpanded: false, animated: true) } - if let (layout, navigationHeight) = self.validLayout { - self.scrollNode.view.setContentOffset(CGPoint(), animated: false) - self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false) - } + self.scrollNode.view.setContentOffset(CGPoint(), animated: false) let photoResource = LocalFileMediaResource(fileId: arc4random64()) self.context.account.postbox.mediaBox.storeResourceData(photoResource.id, data: data) @@ -4052,6 +4049,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD if let (layout, navigationHeight) = self.validLayout { self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false) } + self.headerNode.ignoreCollapse = false var videoStartTimestamp: Double? = nil if let adjustments = adjustments, adjustments.videoStartValue > 0.0 { @@ -4083,7 +4081,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD } if let timestamp = videoStartTimestamp { - videoStartTimestamp = max(0.0, min(timestamp, result.duration)) + videoStartTimestamp = max(0.0, min(timestamp, result.duration - 0.05)) } var value = stat()