mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 11:23:48 +00:00
[WIP] Quotes
This commit is contained in:
parent
965be89632
commit
3bd3bbc7eb
@ -75,6 +75,9 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
private var media: Media?
|
||||
private var theme: ChatPresentationThemeData?
|
||||
|
||||
private var isHighlighted: Bool = false
|
||||
private var highlightTimer: Foundation.Timer?
|
||||
|
||||
public var openMedia: ((InteractiveMediaNodeActivateContent) -> Void)?
|
||||
public var activateAction: (() -> Void)?
|
||||
public var requestUpdateLayout: (() -> Void)?
|
||||
@ -108,6 +111,10 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
self.addSubnode(self.statusNode)
|
||||
}
|
||||
|
||||
deinit {
|
||||
self.highlightTimer?.invalidate()
|
||||
}
|
||||
|
||||
@objc private func pressed() {
|
||||
self.activateAction?()
|
||||
}
|
||||
@ -2041,8 +2048,34 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
let transition: ContainedViewLayoutTransition = .animated(duration: isHighlighted ? 0.1 : 0.2, curve: .easeInOut)
|
||||
let scale: CGFloat = isHighlighted ? ((self.bounds.width - 5.0) / self.bounds.width) : 1.0
|
||||
if self.isHighlighted != isHighlighted {
|
||||
self.isHighlighted = isHighlighted
|
||||
|
||||
if isHighlighted {
|
||||
/*self.highlightTimer = Foundation.Timer.scheduledTimer(withTimeInterval: 0.05, repeats: false, block: { [weak self] timer in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if self.highlightTimer === timer {
|
||||
self.highlightTimer = nil
|
||||
}
|
||||
self.applyIsHighlighted()
|
||||
})*/
|
||||
self.applyIsHighlighted()
|
||||
} else {
|
||||
self.applyIsHighlighted()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func applyIsHighlighted() {
|
||||
if let highlightTimer = self.highlightTimer {
|
||||
self.highlightTimer = nil
|
||||
highlightTimer.invalidate()
|
||||
}
|
||||
|
||||
let transition: ContainedViewLayoutTransition = .animated(duration: self.isHighlighted ? 0.2 : 0.2, curve: .easeInOut)
|
||||
let scale: CGFloat = self.isHighlighted ? ((self.bounds.width - 5.0) / self.bounds.width) : 1.0
|
||||
transition.updateSublayerTransformScale(node: self, scale: scale)
|
||||
}
|
||||
|
||||
|
@ -619,7 +619,7 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
let nsString = string.string as NSString
|
||||
let subRange = nsString.range(of: initialQuote.text)
|
||||
if subRange.location != NSNotFound {
|
||||
strongSelf.beginTextSelection(range: subRange, displayMenu: false)
|
||||
strongSelf.beginTextSelection(range: subRange, displayMenu: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user