mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various Fixes
This commit is contained in:
@@ -128,7 +128,6 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus
|
||||
|
||||
NSTimer *_switchToVideoTimer;
|
||||
NSTimer *_startRecordingTimer;
|
||||
bool _recordingByShutterHold;
|
||||
bool _stopRecordingOnRelease;
|
||||
bool _shownMicrophoneAlert;
|
||||
|
||||
@@ -419,6 +418,14 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus
|
||||
[strongSelf shutterReleased];
|
||||
};
|
||||
|
||||
_interfaceView.shutterPanGesture = ^(UIPanGestureRecognizer *gesture) {
|
||||
__strong TGCameraController *strongSelf = weakSelf;
|
||||
if (strongSelf == nil)
|
||||
return;
|
||||
|
||||
[strongSelf handleRamp:gesture];
|
||||
};
|
||||
|
||||
_interfaceView.cancelPressed = ^
|
||||
{
|
||||
__strong TGCameraController *strongSelf = weakSelf;
|
||||
@@ -1153,8 +1160,12 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus
|
||||
{
|
||||
_stopRecordingOnRelease = false;
|
||||
|
||||
_camera.disabled = true;
|
||||
[_camera stopVideoRecording];
|
||||
TGDispatchAfter(0.3, dispatch_get_main_queue(), ^{
|
||||
[_camera setZoomLevel:1.0];
|
||||
[_interfaceView setZoomLevel:1.0 displayNeeded:false];
|
||||
_camera.disabled = true;
|
||||
});
|
||||
|
||||
[_buttonHandler ignoreEventsFor:1.0f andDisable:[self willPresentResultController]];
|
||||
}
|
||||
@@ -2615,6 +2626,37 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleRamp:(UIPanGestureRecognizer *)gestureRecognizer
|
||||
{
|
||||
if (!_stopRecordingOnRelease) {
|
||||
[gestureRecognizer setTranslation:CGPointZero inView:self.view];
|
||||
return;
|
||||
}
|
||||
switch (gestureRecognizer.state)
|
||||
{
|
||||
case UIGestureRecognizerStateChanged:
|
||||
{
|
||||
CGPoint translation = [gestureRecognizer translationInView:self.view];
|
||||
|
||||
CGFloat value = 1.0;
|
||||
if (translation.y < 0.0) {
|
||||
value = MIN(8.0, value + ABS(translation.y) / 60.0);
|
||||
}
|
||||
|
||||
[_camera setZoomLevel:value];
|
||||
[_interfaceView setZoomLevel:value displayNeeded:true];
|
||||
}
|
||||
break;
|
||||
case UIGestureRecognizerStateEnded:
|
||||
{
|
||||
[self shutterReleased];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
|
||||
{
|
||||
if (gestureRecognizer == _panGestureRecognizer)
|
||||
|
||||
Reference in New Issue
Block a user