mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-29 09:01:05 +00:00
Reaction fixes
This commit is contained in:
parent
30ef98d073
commit
e09f470f3e
@ -209,7 +209,7 @@ public final class ReactionButtonComponent: Component {
|
|||||||
transition: .immediate,
|
transition: .immediate,
|
||||||
component: AnyComponent(Text(
|
component: AnyComponent(Text(
|
||||||
text: text,
|
text: text,
|
||||||
font: Font.regular(11.0),
|
font: Font.medium(11.0),
|
||||||
color: UIColor(argb: component.isSelected ? component.colors.selectedForeground : component.colors.deselectedForeground)
|
color: UIColor(argb: component.isSelected ? component.colors.selectedForeground : component.colors.deselectedForeground)
|
||||||
)),
|
)),
|
||||||
environment: {},
|
environment: {},
|
||||||
|
@ -562,7 +562,7 @@ public final class ReactionContextNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
additionalAnimationNode.visibility = true
|
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: {
|
self.animateFromItemNodeToReaction(itemNode: itemNode, targetView: targetView, hideNode: hideNode, completion: {
|
||||||
mainAnimationCompleted = true
|
mainAnimationCompleted = true
|
||||||
intermediateCompletion()
|
intermediateCompletion()
|
||||||
|
@ -84,7 +84,7 @@ final class ReactionNode: ASDisplayNode {
|
|||||||
func updateLayout(size: CGSize, isExpanded: Bool, transition: ContainedViewLayoutTransition) {
|
func updateLayout(size: CGSize, isExpanded: Bool, transition: ContainedViewLayoutTransition) {
|
||||||
let intrinsicSize = size
|
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)
|
var animationDisplaySize = animationSize.aspectFitted(intrinsicSize)
|
||||||
|
|
||||||
let scalingFactor: CGFloat = 1.0
|
let scalingFactor: CGFloat = 1.0
|
||||||
|
@ -241,16 +241,22 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !reactionsAreInline, let reactionsAttribute = mergedMessageReactions(attributes: firstMessage.attributes), !reactionsAttribute.reactions.isEmpty {
|
if !reactionsAreInline, let reactionsAttribute = mergedMessageReactions(attributes: firstMessage.attributes), !reactionsAttribute.reactions.isEmpty {
|
||||||
|
if result.last?.1 == ChatMessageTextBubbleContentNode.self {
|
||||||
|
} else {
|
||||||
if result.last?.1 == ChatMessageWebpageBubbleContentNode.self ||
|
if result.last?.1 == ChatMessageWebpageBubbleContentNode.self ||
|
||||||
result.last?.1 == ChatMessagePollBubbleContentNode.self ||
|
result.last?.1 == ChatMessagePollBubbleContentNode.self ||
|
||||||
result.last?.1 == ChatMessageContactBubbleContentNode.self {
|
result.last?.1 == ChatMessageContactBubbleContentNode.self {
|
||||||
result.append((firstMessage, ChatMessageReactionsFooterContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: true, neighborType: .freeform, neighborSpacing: .default)))
|
result.append((firstMessage, ChatMessageReactionsFooterContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: true, neighborType: .freeform, neighborSpacing: .default)))
|
||||||
needReactions = false
|
needReactions = false
|
||||||
} else if result.last?.1 == ChatMessageCommentFooterContentNode.self {
|
} 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)
|
result.insert((firstMessage, ChatMessageReactionsFooterContentNode.self, ChatMessageEntryAttributes(), BubbleItemAttributes(isAttachment: true, neighborType: .freeform, neighborSpacing: .default)), at: result.count - 1)
|
||||||
needReactions = false
|
needReactions = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var needSeparateContainers = false
|
var needSeparateContainers = false
|
||||||
if case .group = item.content, hasFiles {
|
if case .group = item.content, hasFiles {
|
||||||
@ -2189,6 +2195,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
|||||||
guard let strongSelf = selfReference.value else {
|
guard let strongSelf = selfReference.value else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let previousContextFrame = strongSelf.mainContainerNode.frame
|
let previousContextFrame = strongSelf.mainContainerNode.frame
|
||||||
strongSelf.mainContainerNode.frame = CGRect(origin: CGPoint(), size: layout.contentSize)
|
strongSelf.mainContainerNode.frame = CGRect(origin: CGPoint(), size: layout.contentSize)
|
||||||
strongSelf.mainContextSourceNode.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()
|
shareButtonNode.removeFromSupernode()
|
||||||
}
|
}
|
||||||
|
|
||||||
if case .System = animation, !strongSelf.mainContextSourceNode.isExtractedToContextPreview {
|
if case .System = animation/*, !strongSelf.mainContextSourceNode.isExtractedToContextPreview*/ {
|
||||||
if !strongSelf.backgroundNode.frame.equalTo(backgroundFrame) {
|
if !strongSelf.backgroundNode.frame.equalTo(backgroundFrame) {
|
||||||
animation.animator.updateFrame(layer: strongSelf.backgroundNode.layer, frame: backgroundFrame, completion: nil)
|
animation.animator.updateFrame(layer: strongSelf.backgroundNode.layer, frame: backgroundFrame, completion: nil)
|
||||||
animation.animator.updatePosition(layer: strongSelf.clippingNode.layer, position: backgroundFrame.center, completion: nil)
|
animation.animator.updatePosition(layer: strongSelf.clippingNode.layer, position: backgroundFrame.center, completion: nil)
|
||||||
|
@ -222,6 +222,8 @@ class ChatMessageDateAndStatusNode: ASDisplayNode {
|
|||||||
self.dateNode = TextNode()
|
self.dateNode = TextNode()
|
||||||
self.dateNode.isUserInteractionEnabled = false
|
self.dateNode.isUserInteractionEnabled = false
|
||||||
self.dateNode.displaysAsynchronously = false
|
self.dateNode.displaysAsynchronously = false
|
||||||
|
self.dateNode.contentsScale = UIScreenScale
|
||||||
|
self.dateNode.contentMode = .topLeft
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
@ -907,9 +909,11 @@ class ChatMessageDateAndStatusNode: ASDisplayNode {
|
|||||||
|
|
||||||
if checkSentNode.isHidden {
|
if checkSentNode.isHidden {
|
||||||
animateSentNode = animation.isAnimated
|
animateSentNode = animation.isAnimated
|
||||||
}
|
|
||||||
checkSentNode.isHidden = false
|
checkSentNode.isHidden = false
|
||||||
|
checkSentNode.frame = actualCheckSentFrame
|
||||||
|
} else {
|
||||||
animation.animator.updateFrame(layer: checkSentNode.layer, frame: actualCheckSentFrame, completion: nil)
|
animation.animator.updateFrame(layer: checkSentNode.layer, frame: actualCheckSentFrame, completion: nil)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
checkSentNode.isHidden = true
|
checkSentNode.isHidden = true
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
|||||||
}
|
}
|
||||||
let dateAndStatusNode: ChatMessageDateAndStatusNode
|
let dateAndStatusNode: ChatMessageDateAndStatusNode
|
||||||
private var badgeNode: ChatMessageInteractiveMediaBadge?
|
private var badgeNode: ChatMessageInteractiveMediaBadge?
|
||||||
private var tapRecognizer: TapLongTapOrDoubleTapGestureRecognizer?
|
//private var tapRecognizer: TapLongTapOrDoubleTapGestureRecognizer?
|
||||||
|
|
||||||
private var context: AccountContext?
|
private var context: AccountContext?
|
||||||
private var message: Message?
|
private var message: Message?
|
||||||
@ -268,8 +268,8 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
|||||||
override func didLoad() {
|
override func didLoad() {
|
||||||
super.didLoad()
|
super.didLoad()
|
||||||
|
|
||||||
let recognizer = TapLongTapOrDoubleTapGestureRecognizer(target: self, action: #selector(self.imageTap(_:)))
|
let recognizer = UITapGestureRecognizer(target: self, action: #selector(self.imageTap(_:)))
|
||||||
recognizer.tapActionAtPoint = { [weak self] point in
|
/*recognizer.tapActionAtPoint = { [weak self] point in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return .fail
|
return .fail
|
||||||
}
|
}
|
||||||
@ -277,9 +277,9 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
|||||||
return .fail
|
return .fail
|
||||||
}
|
}
|
||||||
return .waitForDoubleTap
|
return .waitForDoubleTap
|
||||||
}
|
}*/
|
||||||
self.imageNode.view.addGestureRecognizer(recognizer)
|
self.imageNode.view.addGestureRecognizer(recognizer)
|
||||||
self.tapRecognizer = recognizer
|
//self.tapRecognizer = recognizer
|
||||||
}
|
}
|
||||||
|
|
||||||
private func progressPressed(canActivate: Bool) {
|
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 {
|
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 let (gesture, point) = recognizer.lastRecognizedGestureAndLocation, let message = self.message {
|
||||||
if case .doubleTap = gesture {
|
if case .doubleTap = gesture {
|
||||||
if canAddMessageReactions(message: message) {
|
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))) {
|
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))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user