diff --git a/submodules/Components/ReactionButtonListComponent/Sources/ReactionButtonListComponent.swift b/submodules/Components/ReactionButtonListComponent/Sources/ReactionButtonListComponent.swift index e503c80d2b..86c93bbbeb 100644 --- a/submodules/Components/ReactionButtonListComponent/Sources/ReactionButtonListComponent.swift +++ b/submodules/Components/ReactionButtonListComponent/Sources/ReactionButtonListComponent.swift @@ -209,7 +209,7 @@ public final class ReactionButtonComponent: Component { transition: .immediate, component: AnyComponent(Text( text: text, - font: Font.regular(11.0), + font: Font.medium(11.0), color: UIColor(argb: component.isSelected ? component.colors.selectedForeground : component.colors.deselectedForeground) )), environment: {}, diff --git a/submodules/ReactionSelectionNode/Sources/ReactionContextNode.swift b/submodules/ReactionSelectionNode/Sources/ReactionContextNode.swift index 6cf8a9592f..b5171707b8 100644 --- a/submodules/ReactionSelectionNode/Sources/ReactionContextNode.swift +++ b/submodules/ReactionSelectionNode/Sources/ReactionContextNode.swift @@ -562,7 +562,7 @@ public final class ReactionContextNode: ASDisplayNode, UIScrollViewDelegate { additionalAnimationNode.visibility = true }) - DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 2.0 * UIView.animationDurationFactor(), execute: { + DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 2.0, execute: { self.animateFromItemNodeToReaction(itemNode: itemNode, targetView: targetView, hideNode: hideNode, completion: { mainAnimationCompleted = true intermediateCompletion() diff --git a/submodules/ReactionSelectionNode/Sources/ReactionSelectionNode.swift b/submodules/ReactionSelectionNode/Sources/ReactionSelectionNode.swift index 14335c656a..b6644e6dc7 100644 --- a/submodules/ReactionSelectionNode/Sources/ReactionSelectionNode.swift +++ b/submodules/ReactionSelectionNode/Sources/ReactionSelectionNode.swift @@ -84,7 +84,7 @@ final class ReactionNode: ASDisplayNode { func updateLayout(size: CGSize, isExpanded: Bool, transition: ContainedViewLayoutTransition) { let intrinsicSize = size - let animationSize = self.item.listAnimation.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0) + let animationSize = self.item.stillAnimation.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0) var animationDisplaySize = animationSize.aspectFitted(intrinsicSize) let scalingFactor: CGFloat = 1.0 diff --git a/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift index 061e5d0a89..fac916d2b8 100644 --- a/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift @@ -241,14 +241,20 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([ } if !reactionsAreInline, let reactionsAttribute = mergedMessageReactions(attributes: firstMessage.attributes), !reactionsAttribute.reactions.isEmpty { - if result.last?.1 == ChatMessageWebpageBubbleContentNode.self || - result.last?.1 == ChatMessagePollBubbleContentNode.self || - result.last?.1 == ChatMessageContactBubbleContentNode.self { - result.append((firstMessage, ChatMessageReactionsFooterContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: true, neighborType: .freeform, neighborSpacing: .default))) - needReactions = false - } else if result.last?.1 == ChatMessageCommentFooterContentNode.self { - result.insert((firstMessage, ChatMessageReactionsFooterContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: true, neighborType: .freeform, neighborSpacing: .default)), at: result.count - 1) - needReactions = false + if result.last?.1 == ChatMessageTextBubbleContentNode.self { + } else { + if result.last?.1 == ChatMessageWebpageBubbleContentNode.self || + result.last?.1 == ChatMessagePollBubbleContentNode.self || + result.last?.1 == ChatMessageContactBubbleContentNode.self { + result.append((firstMessage, ChatMessageReactionsFooterContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: true, neighborType: .freeform, neighborSpacing: .default))) + needReactions = false + } else if result.last?.1 == ChatMessageCommentFooterContentNode.self { + if result[result.count - 2].1 == ChatMessageTextBubbleContentNode.self { + } else { + result.insert((firstMessage, ChatMessageReactionsFooterContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: true, neighborType: .freeform, neighborSpacing: .default)), at: result.count - 1) + needReactions = false + } + } } } @@ -2189,6 +2195,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode guard let strongSelf = selfReference.value else { return } + let previousContextFrame = strongSelf.mainContainerNode.frame strongSelf.mainContainerNode.frame = CGRect(origin: CGPoint(), size: layout.contentSize) strongSelf.mainContextSourceNode.frame = CGRect(origin: CGPoint(), size: layout.contentSize) @@ -2699,7 +2706,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode shareButtonNode.removeFromSupernode() } - if case .System = animation, !strongSelf.mainContextSourceNode.isExtractedToContextPreview { + if case .System = animation/*, !strongSelf.mainContextSourceNode.isExtractedToContextPreview*/ { if !strongSelf.backgroundNode.frame.equalTo(backgroundFrame) { animation.animator.updateFrame(layer: strongSelf.backgroundNode.layer, frame: backgroundFrame, completion: nil) animation.animator.updatePosition(layer: strongSelf.clippingNode.layer, position: backgroundFrame.center, completion: nil) diff --git a/submodules/TelegramUI/Sources/ChatMessageDateAndStatusNode.swift b/submodules/TelegramUI/Sources/ChatMessageDateAndStatusNode.swift index 6315227cd7..2c8ac8becc 100644 --- a/submodules/TelegramUI/Sources/ChatMessageDateAndStatusNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageDateAndStatusNode.swift @@ -222,6 +222,8 @@ class ChatMessageDateAndStatusNode: ASDisplayNode { self.dateNode = TextNode() self.dateNode.isUserInteractionEnabled = false self.dateNode.displaysAsynchronously = false + self.dateNode.contentsScale = UIScreenScale + self.dateNode.contentMode = .topLeft super.init() @@ -907,9 +909,11 @@ class ChatMessageDateAndStatusNode: ASDisplayNode { if checkSentNode.isHidden { animateSentNode = animation.isAnimated + checkSentNode.isHidden = false + checkSentNode.frame = actualCheckSentFrame + } else { + animation.animator.updateFrame(layer: checkSentNode.layer, frame: actualCheckSentFrame, completion: nil) } - checkSentNode.isHidden = false - animation.animator.updateFrame(layer: checkSentNode.layer, frame: actualCheckSentFrame, completion: nil) } else { checkSentNode.isHidden = true } diff --git a/submodules/TelegramUI/Sources/ChatMessageInteractiveMediaNode.swift b/submodules/TelegramUI/Sources/ChatMessageInteractiveMediaNode.swift index 84318d1ec8..386b98b333 100644 --- a/submodules/TelegramUI/Sources/ChatMessageInteractiveMediaNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageInteractiveMediaNode.swift @@ -91,7 +91,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio } let dateAndStatusNode: ChatMessageDateAndStatusNode private var badgeNode: ChatMessageInteractiveMediaBadge? - private var tapRecognizer: TapLongTapOrDoubleTapGestureRecognizer? + //private var tapRecognizer: TapLongTapOrDoubleTapGestureRecognizer? private var context: AccountContext? private var message: Message? @@ -268,8 +268,8 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio override func didLoad() { super.didLoad() - let recognizer = TapLongTapOrDoubleTapGestureRecognizer(target: self, action: #selector(self.imageTap(_:))) - recognizer.tapActionAtPoint = { [weak self] point in + let recognizer = UITapGestureRecognizer(target: self, action: #selector(self.imageTap(_:))) + /*recognizer.tapActionAtPoint = { [weak self] point in guard let strongSelf = self else { return .fail } @@ -277,9 +277,9 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio return .fail } return .waitForDoubleTap - } + }*/ self.imageNode.view.addGestureRecognizer(recognizer) - self.tapRecognizer = recognizer + //self.tapRecognizer = recognizer } private func progressPressed(canActivate: Bool) { @@ -330,8 +330,30 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio } } - @objc func imageTap(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) { + @objc func imageTap(_ recognizer: UITapGestureRecognizer) { if case .ended = recognizer.state { + let point = recognizer.location(in: self.imageNode.view) + if let _ = self.attributes?.updatingMedia { + if let statusNode = self.statusNode, statusNode.frame.contains(point) { + self.progressPressed(canActivate: true) + } + } else if let fetchStatus = self.fetchStatus, case .Local = fetchStatus { + var videoContentMatch = true + if let content = self.videoContent, case let .message(stableId, mediaId) = content.nativeId { + videoContentMatch = self.message?.stableId == stableId && self.media?.id == mediaId + } + self.activateLocalContent((self.automaticPlayback ?? false) && videoContentMatch ? .automaticPlayback : .default) + } else { + if let message = self.message, message.flags.isSending { + if let statusNode = self.statusNode, statusNode.frame.contains(point) { + self.progressPressed(canActivate: true) + } + } else { + self.progressPressed(canActivate: true) + } + } + } + /*if case .ended = recognizer.state { if let (gesture, point) = recognizer.lastRecognizedGestureAndLocation, let message = self.message { if case .doubleTap = gesture { if canAddMessageReactions(message: message) { @@ -359,7 +381,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio } } } - } + }*/ } func asyncLayout() -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ dateTimeFormat: PresentationDateTimeFormat, _ message: Message, _ associatedData: ChatMessageItemAssociatedData, _ attributes: ChatMessageEntryAttributes, _ media: Media, _ dateAndStatus: ChatMessageDateAndStatus?, _ automaticDownload: InteractiveMediaNodeAutodownloadMode, _ peerType: MediaAutoDownloadPeerType, _ sizeCalculation: InteractiveMediaNodeSizeCalculation, _ layoutConstants: ChatMessageItemLayoutConstants, _ contentMode: InteractiveMediaNodeContentMode) -> (CGSize, CGFloat, (CGSize, Bool, Bool, ImageCorners) -> (CGFloat, (CGFloat) -> (CGSize, (ListViewItemUpdateAnimation, Bool) -> Void))) {