mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Likes
This commit is contained in:
@@ -44,6 +44,8 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
|
||||
private var currentSwipeToReplyTranslation: CGFloat = 0.0
|
||||
|
||||
private var currentSwipeAction: ChatControllerInteractionSwipeAction?
|
||||
|
||||
required init() {
|
||||
self.contextSourceNode = ContextExtractedContentContainingNode()
|
||||
self.containerNode = ContextControllerSourceNode()
|
||||
@@ -96,6 +98,13 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
self.addSubnode(self.containerNode)
|
||||
self.contextSourceNode.contentNode.addSubnode(self.imageNode)
|
||||
self.contextSourceNode.contentNode.addSubnode(self.dateAndStatusNode)
|
||||
|
||||
self.dateAndStatusNode.openReactions = { [weak self] in
|
||||
guard let strongSelf = self, let item = strongSelf.item else {
|
||||
return
|
||||
}
|
||||
item.controllerInteraction.openMessageReactions(item.message.id)
|
||||
}
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
@@ -150,7 +159,13 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
if strongSelf.selectionNode != nil {
|
||||
return false
|
||||
}
|
||||
return item.controllerInteraction.canSetupReply(item.message)
|
||||
let action = item.controllerInteraction.canSetupReply(item.message)
|
||||
strongSelf.currentSwipeAction = action
|
||||
if case .none = action {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -789,7 +804,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
if translation.x < -45.0, self.swipeToReplyNode == nil, let item = self.item {
|
||||
self.swipeToReplyFeedback?.impact()
|
||||
|
||||
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonFillColor, wallpaper: item.presentationData.theme.wallpaper), strokeColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonStrokeColor, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper))
|
||||
let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonFillColor, wallpaper: item.presentationData.theme.wallpaper), strokeColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonStrokeColor, wallpaper: item.presentationData.theme.wallpaper), foregroundColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.message.shareButtonForegroundColor, wallpaper: item.presentationData.theme.wallpaper), action: ChatMessageSwipeToReplyNode.Action(self.currentSwipeAction))
|
||||
self.swipeToReplyNode = swipeToReplyNode
|
||||
self.addSubnode(swipeToReplyNode)
|
||||
animateReplyNodeIn = true
|
||||
@@ -815,7 +830,18 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
let translation = recognizer.translation(in: self.view)
|
||||
if case .ended = recognizer.state, translation.x < -45.0 {
|
||||
if let item = self.item {
|
||||
item.controllerInteraction.setupReply(item.message.id)
|
||||
if let currentSwipeAction = currentSwipeAction {
|
||||
switch currentSwipeAction {
|
||||
case .none:
|
||||
break
|
||||
case .reply:
|
||||
item.controllerInteraction.setupReply(item.message.id)
|
||||
case .like:
|
||||
item.controllerInteraction.updateMessageLike(item.message.id, true)
|
||||
case .unlike:
|
||||
item.controllerInteraction.updateMessageLike(item.message.id, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var bounds = self.bounds
|
||||
|
||||
Reference in New Issue
Block a user