mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-25 17:43:18 +00:00
Apply patch
This commit is contained in:
parent
1376d2dd2a
commit
da80ab648d
@ -124,7 +124,9 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
CGFloat _currentScale;
|
CGFloat _currentScale;
|
||||||
CGFloat _currentTranslation;
|
CGFloat _currentTranslation;
|
||||||
CGFloat _targetTranslation;
|
CGFloat _targetTranslation;
|
||||||
|
|
||||||
CGFloat _cancelTranslation;
|
CGFloat _cancelTranslation;
|
||||||
|
CGFloat _cancelTargetTranslation;
|
||||||
|
|
||||||
CFAbsoluteTime _animationStartTime;
|
CFAbsoluteTime _animationStartTime;
|
||||||
|
|
||||||
@ -505,6 +507,8 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
_currentLevel = 0.0f;
|
_currentLevel = 0.0f;
|
||||||
_currentTranslation = 0.0f;
|
_currentTranslation = 0.0f;
|
||||||
_targetTranslation = 0.0f;
|
_targetTranslation = 0.0f;
|
||||||
|
_cancelTranslation = 0;
|
||||||
|
_cancelTargetTranslation = 0;
|
||||||
_currentScale = 1.0f;
|
_currentScale = 1.0f;
|
||||||
[UIView animateWithDuration:0.18 animations:^{
|
[UIView animateWithDuration:0.18 animations:^{
|
||||||
_innerIconWrapperView.transform = CGAffineTransformMakeScale(0.2f, 0.2f);
|
_innerIconWrapperView.transform = CGAffineTransformMakeScale(0.2f, 0.2f);
|
||||||
@ -531,10 +535,9 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
[_presentation dismiss];
|
[_presentation dismiss];
|
||||||
_presentation = nil;
|
_presentation = nil;
|
||||||
|
|
||||||
_cancelTranslation = 0;
|
|
||||||
id<TGModernConversationInputMicButtonDelegate> delegate = _delegate;
|
id<TGModernConversationInputMicButtonDelegate> delegate = _delegate;
|
||||||
if ([delegate respondsToSelector:@selector(micButtonInteractionUpdateCancelTranslation:)])
|
if ([delegate respondsToSelector:@selector(micButtonInteractionUpdateCancelTranslation:)])
|
||||||
[delegate micButtonInteractionUpdateCancelTranslation:-_cancelTranslation];
|
[delegate micButtonInteractionUpdateCancelTranslation:-_cancelTargetTranslation];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_previousIcon != nil)
|
if (_previousIcon != nil)
|
||||||
@ -565,10 +568,10 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
[self setIcon:TGTintedImage(TGComponentsImageNamed(@"RecordSendIcon"), _pallete != nil ? _pallete.iconColor : [UIColor whiteColor])];
|
[self setIcon:TGTintedImage(TGComponentsImageNamed(@"RecordSendIcon"), _pallete != nil ? _pallete.iconColor : [UIColor whiteColor])];
|
||||||
|
|
||||||
_currentScale = 1;
|
_currentScale = 1;
|
||||||
_cancelTranslation = 0;
|
_cancelTargetTranslation = 0;
|
||||||
id<TGModernConversationInputMicButtonDelegate> delegate = _delegate;
|
id<TGModernConversationInputMicButtonDelegate> delegate = _delegate;
|
||||||
if ([delegate respondsToSelector:@selector(micButtonInteractionUpdateCancelTranslation:)])
|
if ([delegate respondsToSelector:@selector(micButtonInteractionUpdateCancelTranslation:)])
|
||||||
[delegate micButtonInteractionUpdateCancelTranslation:-_cancelTranslation];
|
[delegate micButtonInteractionUpdateCancelTranslation:-_cancelTargetTranslation];
|
||||||
|
|
||||||
_innerIconView.transform = CGAffineTransformMakeScale(0.3f, 0.3f);
|
_innerIconView.transform = CGAffineTransformMakeScale(0.3f, 0.3f);
|
||||||
_innerIconView.alpha = 0.0f;
|
_innerIconView.alpha = 0.0f;
|
||||||
@ -694,7 +697,7 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
_currentScale = scale;
|
_currentScale = scale;
|
||||||
|
|
||||||
_targetTranslation = distanceY;
|
_targetTranslation = distanceY;
|
||||||
_cancelTranslation = distanceX;
|
_cancelTargetTranslation = distanceX;
|
||||||
CGFloat targetLockness = _locked ? 1.0f : MIN(1.0f, fabs(_targetTranslation) / 105.0f);
|
CGFloat targetLockness = _locked ? 1.0f : MIN(1.0f, fabs(_targetTranslation) / 105.0f);
|
||||||
[_lock updateLockness:targetLockness];
|
[_lock updateLockness:targetLockness];
|
||||||
_lockView.lockness = targetLockness;
|
_lockView.lockness = targetLockness;
|
||||||
@ -712,7 +715,7 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
|
|
||||||
id<TGModernConversationInputMicButtonDelegate> delegate = _delegate;
|
id<TGModernConversationInputMicButtonDelegate> delegate = _delegate;
|
||||||
if ([delegate respondsToSelector:@selector(micButtonInteractionUpdateCancelTranslation:)])
|
if ([delegate respondsToSelector:@selector(micButtonInteractionUpdateCancelTranslation:)])
|
||||||
[delegate micButtonInteractionUpdateCancelTranslation:-_cancelTranslation];
|
[delegate micButtonInteractionUpdateCancelTranslation:-_cancelTargetTranslation];
|
||||||
|
|
||||||
if (distanceX < -150.0f) {
|
if (distanceX < -150.0f) {
|
||||||
id<TGModernConversationInputMicButtonDelegate> delegate = _delegate;
|
id<TGModernConversationInputMicButtonDelegate> delegate = _delegate;
|
||||||
@ -841,6 +844,7 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
[_decoration tick:_currentLevel];
|
[_decoration tick:_currentLevel];
|
||||||
|
|
||||||
_currentTranslation = MIN(0.0, _currentTranslation * 0.7f + _targetTranslation * 0.3f);
|
_currentTranslation = MIN(0.0, _currentTranslation * 0.7f + _targetTranslation * 0.3f);
|
||||||
|
_cancelTranslation = MIN(0.0, _cancelTranslation * 0.7f + _cancelTargetTranslation * 0.3f);
|
||||||
|
|
||||||
if (t > _animationStartTime) {
|
if (t > _animationStartTime) {
|
||||||
CGFloat outerScale = outerCircleMinScale + _currentLevel * (1.0f - outerCircleMinScale);
|
CGFloat outerScale = outerCircleMinScale + _currentLevel * (1.0f - outerCircleMinScale);
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import LegacyComponents
|
|||||||
|
|
||||||
private enum Constants {
|
private enum Constants {
|
||||||
|
|
||||||
static let maxLevel: CGFloat = 5
|
static let maxLevel: CGFloat = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
final class VoiceBlobView: UIView, TGModernConversationInputMicButtonDecoration {
|
final class VoiceBlobView: UIView, TGModernConversationInputMicButtonDecoration {
|
||||||
@ -25,10 +25,10 @@ final class VoiceBlobView: UIView, TGModernConversationInputMicButtonDecoration
|
|||||||
pointsCount: 8,
|
pointsCount: 8,
|
||||||
minRandomness: 1,
|
minRandomness: 1,
|
||||||
maxRandomness: 1,
|
maxRandomness: 1,
|
||||||
minSpeed: 1,
|
minSpeed: 1.5,
|
||||||
maxSpeed: 7,
|
maxSpeed: 7,
|
||||||
minScale: 0.55,
|
minScale: 0.52,
|
||||||
maxScale: 0.9,
|
maxScale: 0.87,
|
||||||
scaleSpeed: 0.2,
|
scaleSpeed: 0.2,
|
||||||
isCircle: false
|
isCircle: false
|
||||||
)
|
)
|
||||||
@ -36,9 +36,9 @@ final class VoiceBlobView: UIView, TGModernConversationInputMicButtonDecoration
|
|||||||
pointsCount: 8,
|
pointsCount: 8,
|
||||||
minRandomness: 1,
|
minRandomness: 1,
|
||||||
maxRandomness: 1,
|
maxRandomness: 1,
|
||||||
minSpeed: 1,
|
minSpeed: 1.5,
|
||||||
maxSpeed: 7,
|
maxSpeed: 7,
|
||||||
minScale: 0.55,
|
minScale: 0.57,
|
||||||
maxScale: 1,
|
maxScale: 1,
|
||||||
scaleSpeed: 0.2,
|
scaleSpeed: 0.2,
|
||||||
isCircle: false
|
isCircle: false
|
||||||
@ -127,6 +127,8 @@ final class BlobView: UIView {
|
|||||||
|
|
||||||
private var speedLevel: CGFloat = 0
|
private var speedLevel: CGFloat = 0
|
||||||
private var scaleLevel: CGFloat = 0
|
private var scaleLevel: CGFloat = 0
|
||||||
|
|
||||||
|
private var lastSpeedLevel: CGFloat = 0
|
||||||
private var lastScaleLevel: CGFloat = 0
|
private var lastScaleLevel: CGFloat = 0
|
||||||
|
|
||||||
private let shapeLayer: CAShapeLayer = {
|
private let shapeLayer: CAShapeLayer = {
|
||||||
@ -199,6 +201,10 @@ final class BlobView: UIView {
|
|||||||
|
|
||||||
func updateSpeedLevel(to newSpeedLevel: CGFloat) {
|
func updateSpeedLevel(to newSpeedLevel: CGFloat) {
|
||||||
speedLevel = max(speedLevel, newSpeedLevel)
|
speedLevel = max(speedLevel, newSpeedLevel)
|
||||||
|
|
||||||
|
if abs(lastSpeedLevel - newSpeedLevel) > 0.5 {
|
||||||
|
animateToNewShape()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func startAnimating() {
|
func startAnimating() {
|
||||||
@ -238,7 +244,7 @@ final class BlobView: UIView {
|
|||||||
if pop_animation(forKey: "blob") != nil {
|
if pop_animation(forKey: "blob") != nil {
|
||||||
fromPoints = currentPoints
|
fromPoints = currentPoints
|
||||||
toPoints = nil
|
toPoints = nil
|
||||||
pop_removeAllAnimations()
|
shapeLayer.pop_removeAnimation(forKey: "blob")
|
||||||
}
|
}
|
||||||
|
|
||||||
if fromPoints == nil {
|
if fromPoints == nil {
|
||||||
@ -274,6 +280,7 @@ final class BlobView: UIView {
|
|||||||
animation.toValue = 1
|
animation.toValue = 1
|
||||||
pop_add(animation, forKey: "blob")
|
pop_add(animation, forKey: "blob")
|
||||||
|
|
||||||
|
lastSpeedLevel = speedLevel
|
||||||
speedLevel = 0
|
speedLevel = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user