Apply patch

This commit is contained in:
Ali 2020-07-09 23:00:36 +04:00
parent bc2d5716f9
commit 3d44ed612f
7 changed files with 55 additions and 36 deletions

View File

@ -13,6 +13,8 @@
- (void)updateLevel:(CGFloat)level; - (void)updateLevel:(CGFloat)level;
- (void)tick:(CGFloat)level; - (void)tick:(CGFloat)level;
- (void)setColor:(UIColor *)color; - (void)setColor:(UIColor *)color;
- (void)stopAnimating;
- (void)startAnimating;
@end @end

View File

@ -514,13 +514,13 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
_innerCircleView.transform = CGAffineTransformMakeScale(0.2f, 0.2f); _innerCircleView.transform = CGAffineTransformMakeScale(0.2f, 0.2f);
_outerCircleView.transform = CGAffineTransformMakeScale(0.2f, 0.2f); _outerCircleView.transform = CGAffineTransformMakeScale(0.2f, 0.2f);
if (toSmallSize) { if (toSmallSize) {
_decoration.transform = CGAffineTransformConcat(CGAffineTransformMakeScale(0.33f, 0.33f), CGAffineTransformMakeTranslation(-4, 0));
_innerIconWrapperView.transform = CGAffineTransformConcat(CGAffineTransformMakeScale(0.492f, 0.492f), CGAffineTransformMakeTranslation(-TGScreenPixel, 0));
} else {
_decoration.transform = CGAffineTransformMakeScale(0.2f, 0.2f); _decoration.transform = CGAffineTransformMakeScale(0.2f, 0.2f);
_decoration.alpha = 0.0; _decoration.alpha = 0.0;
_innerIconWrapperView.transform = CGAffineTransformMakeScale(0.2f, 0.2f); _innerIconWrapperView.transform = CGAffineTransformMakeScale(0.2f, 0.2f);
_innerIconWrapperView.alpha = 0.0f; _innerIconWrapperView.alpha = 0.0f;
} else {
_decoration.transform = CGAffineTransformMakeScale(0.33f, 0.33f);
_innerIconWrapperView.transform = CGAffineTransformMakeScale(0.4f, 0.4f);
} }
_innerCircleView.alpha = 0.0f; _innerCircleView.alpha = 0.0f;
_outerCircleView.alpha = 0.0f; _outerCircleView.alpha = 0.0f;

View File

@ -78,6 +78,16 @@ final class VoiceBlobView: UIView, TGModernConversationInputMicButtonDecoration
bigBlob.level = normalizedLevel bigBlob.level = normalizedLevel
} }
func startAnimating() {
mediumBlob.layer.animateScale(from: 0.5, to: 1, duration: 0.1, removeOnCompletion: false)
bigBlob.layer.animateScale(from: 0.5, to: 1, duration: 0.1, removeOnCompletion: false)
}
func stopAnimating() {
mediumBlob.layer.animateScale(from: 1.0, to: 0.5, duration: 0.1, removeOnCompletion: false)
bigBlob.layer.animateScale(from: 1.0, to: 0.5, duration: 0.1, removeOnCompletion: false)
}
override func layoutSubviews() { override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()

View File

@ -45,7 +45,7 @@ final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode {
private let statusDisposable = MetaDisposable() private let statusDisposable = MetaDisposable()
private var gestureRecognizer: ContextGesture? private(set) var gestureRecognizer: ContextGesture?
init(theme: PresentationTheme) { init(theme: PresentationTheme) {
self.deleteButton = HighlightableButtonNode() self.deleteButton = HighlightableButtonNode()
@ -251,23 +251,23 @@ final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode {
self.deleteButton.layer.animateScale(from: 0.3, to: 1.0, duration: 0.15) self.deleteButton.layer.animateScale(from: 0.3, to: 1.0, duration: 0.15)
self.deleteButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15) self.deleteButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15)
self.playButton.layer.animateScale(from: 0.01, to: 1.0, duration: 0.5, delay: 0.15) self.playButton.layer.animateScale(from: 0.01, to: 1.0, duration: 0.3, delay: 0.1)
self.playButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3, delay: 0.15) self.playButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2, delay: 0.1)
self.pauseButton.layer.animateScale(from: 0.01, to: 1.0, duration: 0.5, delay: 0.15) self.pauseButton.layer.animateScale(from: 0.01, to: 1.0, duration: 0.3, delay: 0.1)
self.pauseButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3, delay: 0.15) self.pauseButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2, delay: 0.1)
self.durationLabel.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.4) self.durationLabel.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)
self.waveformScubberNode.layer.animateScaleY(from: 0.1, to: 1.0, duration: 0.5, delay: 0.15) self.waveformScubberNode.layer.animateScaleY(from: 0.1, to: 1.0, duration: 0.3, delay: 0.1)
self.waveformScubberNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3, delay: 0.15) self.waveformScubberNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2, delay: 0.1)
self.waveformBackgroundNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15) self.waveformBackgroundNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15)
self.waveformBackgroundNode.layer.animateFrame( self.waveformBackgroundNode.layer.animateFrame(
from: self.sendButton.frame.insetBy(dx: 5.5, dy: 5.5), from: self.sendButton.frame.insetBy(dx: 5.5, dy: 5.5),
to: waveformBackgroundFrame, to: waveformBackgroundFrame,
duration: 0.3, duration: 0.2,
delay: 0.15, delay: 0.12,
timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue,
removeOnCompletion: false removeOnCompletion: false
) { [weak self, weak prevTextInputPanelNode] finished in ) { [weak self, weak prevTextInputPanelNode] finished in
@ -285,6 +285,7 @@ final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode {
} }
@objc func deletePressed() { @objc func deletePressed() {
self.mediaPlayer?.pause()
self.interfaceInteraction?.deleteRecordedMedia() self.interfaceInteraction?.deleteRecordedMedia()
} }
@ -303,15 +304,5 @@ final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode {
func frameForInputActionButton() -> CGRect? { func frameForInputActionButton() -> CGRect? {
return self.sendButton.frame return self.sendButton.frame
} }
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
if self.deleteButton.frame.contains(point) {
return self.deleteButton.view
}
if self.sendButton.frame.contains(point) {
return self.sendButton.view
}
return super.hitTest(point, with: event)
}
} }

View File

@ -424,6 +424,8 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto
override func animateIn() { override func animateIn() {
super.animateIn() super.animateIn()
micDecoration.startAnimating()
innerIconView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false) innerIconView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false)
innerIconView.layer.animateScale(from: 1.0, to: 0.3, duration: 0.15, removeOnCompletion: false) innerIconView.layer.animateScale(from: 1.0, to: 0.3, duration: 0.15, removeOnCompletion: false)
@ -432,7 +434,11 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto
override func animateOut(_ toSmallSize: Bool) { override func animateOut(_ toSmallSize: Bool) {
super.animateOut(toSmallSize) super.animateOut(toSmallSize)
if !toSmallSize { micDecoration.stopAnimating()
if toSmallSize {
micDecoration.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.03, delay: 0.15, removeOnCompletion: false)
} else {
micDecoration.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.18, removeOnCompletion: false) micDecoration.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.18, removeOnCompletion: false)
innerIconView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15, removeOnCompletion: false) innerIconView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15, removeOnCompletion: false)
innerIconView.layer.animateScale(from: 0.3, to: 1.0, duration: 0.15, removeOnCompletion: false) innerIconView.layer.animateScale(from: 0.3, to: 1.0, duration: 0.15, removeOnCompletion: false)

View File

@ -214,6 +214,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
var audioRecordingDotNode: AnimationNode? var audioRecordingDotNode: AnimationNode?
var audioRecordingTimeNode: ChatTextInputAudioRecordingTimeNode? var audioRecordingTimeNode: ChatTextInputAudioRecordingTimeNode?
var audioRecordingCancelIndicator: ChatTextInputAudioRecordingCancelIndicator? var audioRecordingCancelIndicator: ChatTextInputAudioRecordingCancelIndicator?
var animatingBinNode: AnimationNode?
private var accessoryItemButtons: [(ChatTextInputAccessoryItem, AccessoryItemIconButton)] = [] private var accessoryItemButtons: [(ChatTextInputAccessoryItem, AccessoryItemIconButton)] = []
@ -1054,6 +1055,8 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
audioRecordingDotNode = AnimationNode(animation: "BinRed") audioRecordingDotNode = AnimationNode(animation: "BinRed")
self.audioRecordingDotNode = audioRecordingDotNode self.audioRecordingDotNode = audioRecordingDotNode
self.addSubnode(audioRecordingDotNode) self.addSubnode(audioRecordingDotNode)
self.animatingBinNode?.removeFromSupernode()
self.animatingBinNode = nil
} }
animateDotAppearing = transition.isAnimated && !hideInfo animateDotAppearing = transition.isAnimated && !hideInfo
@ -1349,6 +1352,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
if let prevPreviewInputPanelNode = self.prevInputPanelNode as? ChatRecordingPreviewInputPanelNode { if let prevPreviewInputPanelNode = self.prevInputPanelNode as? ChatRecordingPreviewInputPanelNode {
self.prevInputPanelNode = nil self.prevInputPanelNode = nil
prevPreviewInputPanelNode.gestureRecognizer?.isEnabled = false
prevPreviewInputPanelNode.isUserInteractionEnabled = false prevPreviewInputPanelNode.isUserInteractionEnabled = false
if self.isMediaDeleted { if self.isMediaDeleted {
@ -1381,21 +1385,27 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
animateAlpha(for: prevPreviewInputPanelNode.playButton) animateAlpha(for: prevPreviewInputPanelNode.playButton)
animateAlpha(for: prevPreviewInputPanelNode.pauseButton) animateAlpha(for: prevPreviewInputPanelNode.pauseButton)
let dismissBin = { [weak self, weak prevPreviewInputPanelNode] in let binNode = prevPreviewInputPanelNode.binNode
prevPreviewInputPanelNode?.deleteButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15, delay: 0, removeOnCompletion: false) self.animatingBinNode = binNode
prevPreviewInputPanelNode?.deleteButton.layer.animateScale(from: 0.3, to: 1.0, duration: 0.15, delay: 0, removeOnCompletion: false) let dismissBin = { [weak self, weak prevPreviewInputPanelNode, weak binNode] in
if binNode?.supernode != nil {
self?.attachmentButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15, delay: 0, removeOnCompletion: false) prevPreviewInputPanelNode?.deleteButton.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, delay: 0, removeOnCompletion: false) { [weak prevPreviewInputPanelNode] _ in
self?.attachmentButton.layer.animateScale(from: 0.3, to: 1.0, duration: 0.15, delay: 0, removeOnCompletion: false) if prevPreviewInputPanelNode?.supernode === self {
prevPreviewInputPanelNode?.removeFromSupernode()
if prevPreviewInputPanelNode?.supernode === self { }
prevPreviewInputPanelNode?.removeFromSupernode() }
prevPreviewInputPanelNode?.deleteButton.layer.animateScale(from: 1.0, to: 0.3, duration: 0.15, delay: 0, removeOnCompletion: false)
self?.attachmentButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15, delay: 0, removeOnCompletion: false)
self?.attachmentButton.layer.animateScale(from: 0.3, to: 1.0, duration: 0.15, delay: 0, removeOnCompletion: false)
} else if prevPreviewInputPanelNode?.supernode === self {
prevPreviewInputPanelNode?.removeFromSupernode()
} }
} }
if self.isMediaDeleted { if self.isMediaDeleted {
prevPreviewInputPanelNode.binNode.completion = dismissBin binNode.completion = dismissBin
prevPreviewInputPanelNode.binNode.play() binNode.play()
} else { } else {
dismissBin() dismissBin()
} }

View File

@ -26,7 +26,7 @@ private struct Constants {
static let idleRotationDiff: CGFloat = 0.1 * idleRotationSpeed static let idleRotationDiff: CGFloat = 0.1 * idleRotationSpeed
} }
class CombinedWaveView: UIView, TGModernConversationInputMicButtonDecoration { class CombinedWaveView: UIView {
private let bigWaveView: WaveView private let bigWaveView: WaveView
private let smallWaveView: WaveView private let smallWaveView: WaveView