mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Various fixes
This commit is contained in:
parent
3d0f297554
commit
68f93cc748
@ -356,6 +356,8 @@ final class InnerTextSelectionTipContainerNode: ASDisplayNode {
|
|||||||
private var file: TelegramMediaFile?
|
private var file: TelegramMediaFile?
|
||||||
private let targetSelectionIndex: Int?
|
private let targetSelectionIndex: Int?
|
||||||
|
|
||||||
|
private var hapticFeedback: HapticFeedback?
|
||||||
|
|
||||||
private var action: (() -> Void)?
|
private var action: (() -> Void)?
|
||||||
var requestDismiss: (@escaping () -> Void) -> Void = { _ in }
|
var requestDismiss: (@escaping () -> Void) -> Void = { _ in }
|
||||||
|
|
||||||
@ -442,13 +444,7 @@ final class InnerTextSelectionTipContainerNode: ASDisplayNode {
|
|||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if highlighted {
|
strongSelf.updateHighlight(animated: true)
|
||||||
strongSelf.highlightBackgroundNode.alpha = 1.0
|
|
||||||
} else {
|
|
||||||
let previousAlpha = strongSelf.highlightBackgroundNode.alpha
|
|
||||||
strongSelf.highlightBackgroundNode.alpha = 0.0
|
|
||||||
strongSelf.highlightBackgroundNode.layer.animateAlpha(from: previousAlpha, to: 0.0, duration: 0.2)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.buttonNode.addTarget(self, action: #selector(self.pressed), forControlEvents: .touchUpInside)
|
self.buttonNode.addTarget(self, action: #selector(self.pressed), forControlEvents: .touchUpInside)
|
||||||
@ -595,6 +591,55 @@ final class InnerTextSelectionTipContainerNode: ASDisplayNode {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateHighlight(animated: Bool) {
|
||||||
|
if self.buttonNode.isHighlighted || self.isHighlighted {
|
||||||
|
self.highlightBackgroundNode.alpha = 1.0
|
||||||
|
} else {
|
||||||
|
if animated {
|
||||||
|
let previousAlpha = self.highlightBackgroundNode.alpha
|
||||||
|
self.highlightBackgroundNode.alpha = 0.0
|
||||||
|
self.highlightBackgroundNode.layer.animateAlpha(from: previousAlpha, to: 0.0, duration: 0.2)
|
||||||
|
} else {
|
||||||
|
self.highlightBackgroundNode.alpha = 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var isHighlighted = false
|
||||||
|
func setHighlighted(_ highlighted: Bool) {
|
||||||
|
guard self.isHighlighted != highlighted else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.isHighlighted = highlighted
|
||||||
|
|
||||||
|
if highlighted {
|
||||||
|
if self.hapticFeedback == nil {
|
||||||
|
self.hapticFeedback = HapticFeedback()
|
||||||
|
}
|
||||||
|
self.hapticFeedback?.tap()
|
||||||
|
}
|
||||||
|
|
||||||
|
self.updateHighlight(animated: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func highlightGestureMoved(location: CGPoint) {
|
||||||
|
if self.bounds.contains(location) && self.isUserInteractionEnabled {
|
||||||
|
self.setHighlighted(true)
|
||||||
|
} else {
|
||||||
|
self.setHighlighted(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func highlightGestureFinished(performAction: Bool) {
|
||||||
|
if self.isHighlighted {
|
||||||
|
self.setHighlighted(false)
|
||||||
|
if performAction {
|
||||||
|
self.pressed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class ContextActionsContainerNode: ASDisplayNode {
|
final class ContextActionsContainerNode: ASDisplayNode {
|
||||||
|
@ -912,10 +912,17 @@ final class ContextControllerActionsStackNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func highlightGestureMoved(location: CGPoint) {
|
func highlightGestureMoved(location: CGPoint) {
|
||||||
|
if let tipNode = self.tipNode {
|
||||||
|
let tipLocation = self.view.convert(location, to: tipNode.view)
|
||||||
|
tipNode.highlightGestureMoved(location: tipLocation)
|
||||||
|
}
|
||||||
self.node.highlightGestureMoved(location: self.view.convert(location, to: self.node.view))
|
self.node.highlightGestureMoved(location: self.view.convert(location, to: self.node.view))
|
||||||
}
|
}
|
||||||
|
|
||||||
func highlightGestureFinished(performAction: Bool) {
|
func highlightGestureFinished(performAction: Bool) {
|
||||||
|
if let tipNode = self.tipNode {
|
||||||
|
tipNode.highlightGestureFinished(performAction: performAction)
|
||||||
|
}
|
||||||
self.node.highlightGestureFinished(performAction: performAction)
|
self.node.highlightGestureFinished(performAction: performAction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,7 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto
|
|||||||
environment: {},
|
environment: {},
|
||||||
containerSize: animationFrame.size
|
containerSize: animationFrame.size
|
||||||
)
|
)
|
||||||
// self.innerIconView.frame = CGRect(origin: CGPoint(x: floor((size.width - iconSize.width) / 2.0), y: floor((size.height - iconSize.height) / 2.0)), size: iconSize)
|
|
||||||
if let view = animationView.view {
|
if let view = animationView.view {
|
||||||
view.isUserInteractionEnabled = false
|
view.isUserInteractionEnabled = false
|
||||||
if view.superview == nil {
|
if view.superview == nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user