mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-30 01:11:46 +00:00
no message
This commit is contained in:
parent
28bad79ead
commit
ddfb4abd54
@ -294,3 +294,4 @@ FOUNDATION_EXPORT const unsigned char LegacyComponentsVersionString[];
|
|||||||
#import <LegacyComponents/TGClipboardGalleryMixin.h>
|
#import <LegacyComponents/TGClipboardGalleryMixin.h>
|
||||||
#import <LegacyComponents/TGClipboardGalleryPhotoItem.h>
|
#import <LegacyComponents/TGClipboardGalleryPhotoItem.h>
|
||||||
#import <LegacyComponents/TGVideoMessageCaptureController.h>
|
#import <LegacyComponents/TGVideoMessageCaptureController.h>
|
||||||
|
#import <LegacyComponents/TGModernConversationInputMicButton.h>
|
||||||
|
@ -105,7 +105,9 @@ static void PGButtonHandlerEnableMonitoring(bool enable)
|
|||||||
- (void)setEnabled:(bool)enabled
|
- (void)setEnabled:(bool)enabled
|
||||||
{
|
{
|
||||||
_enabled = enabled;
|
_enabled = enabled;
|
||||||
|
TGDispatchOnMainThread(^{
|
||||||
PGButtonHandlerEnableMonitoring(enabled);
|
PGButtonHandlerEnableMonitoring(enabled);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)enableIn:(NSTimeInterval)timeInterval
|
- (void)enableIn:(NSTimeInterval)timeInterval
|
||||||
|
@ -22,6 +22,7 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
|||||||
UIButton *_screenAreaButton;
|
UIButton *_screenAreaButton;
|
||||||
|
|
||||||
UIView *_backgroundView;
|
UIView *_backgroundView;
|
||||||
|
UIView *_backgroundContentView;
|
||||||
TGModernButton *_playButton;
|
TGModernButton *_playButton;
|
||||||
TGModernButton *_pauseButton;
|
TGModernButton *_pauseButton;
|
||||||
|
|
||||||
@ -71,21 +72,23 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
|||||||
[_screenAreaButton addTarget:self action:@selector(screenAreaPressed) forControlEvents:UIControlEventTouchUpInside];
|
[_screenAreaButton addTarget:self action:@selector(screenAreaPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||||
[self addSubview:_screenAreaButton];
|
[self addSubview:_screenAreaButton];
|
||||||
|
|
||||||
if (TGEmbedPlayerControlsTypeFull)
|
if (type == TGEmbedPlayerControlsTypeFull)
|
||||||
{
|
{
|
||||||
if (iosMajorVersion() >= 8)
|
if (iosMajorVersion() >= 8)
|
||||||
{
|
{
|
||||||
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
|
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
|
||||||
_backgroundView = effectView;
|
_backgroundView = effectView;
|
||||||
|
_backgroundContentView = effectView.contentView;
|
||||||
|
|
||||||
UIView *whiteView = [[UIView alloc] initWithFrame:effectView.bounds];
|
UIView *whiteView = [[UIView alloc] initWithFrame:effectView.bounds];
|
||||||
whiteView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
whiteView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||||
whiteView.backgroundColor = UIColorRGBA(0xffffff, 0.3f);
|
whiteView.backgroundColor = UIColorRGBA(0xffffff, 0.3f);
|
||||||
[_backgroundView addSubview:whiteView];
|
[effectView.contentView addSubview:whiteView];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_backgroundView = [[UIView alloc] initWithFrame:CGRectZero];
|
_backgroundView = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
|
_backgroundContentView = _backgroundView;
|
||||||
}
|
}
|
||||||
[self addSubview:_backgroundView];
|
[self addSubview:_backgroundView];
|
||||||
|
|
||||||
@ -93,13 +96,13 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
|||||||
_pauseButton.exclusiveTouch = true;
|
_pauseButton.exclusiveTouch = true;
|
||||||
[_pauseButton setImage:TGComponentsImageNamed(@"EmbedVideoPauseIcon") forState:UIControlStateNormal];
|
[_pauseButton setImage:TGComponentsImageNamed(@"EmbedVideoPauseIcon") forState:UIControlStateNormal];
|
||||||
[_pauseButton addTarget:self action:@selector(pauseButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
[_pauseButton addTarget:self action:@selector(pauseButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||||
[_backgroundView addSubview:_pauseButton];
|
[_backgroundContentView addSubview:_pauseButton];
|
||||||
|
|
||||||
_playButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, 38, TGEmbedPlayerControlsPanelHeight)];
|
_playButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, 38, TGEmbedPlayerControlsPanelHeight)];
|
||||||
_playButton.exclusiveTouch = true;
|
_playButton.exclusiveTouch = true;
|
||||||
[_playButton setImage:TGComponentsImageNamed(@"EmbedVideoPlayIcon") forState:UIControlStateNormal];
|
[_playButton setImage:TGComponentsImageNamed(@"EmbedVideoPlayIcon") forState:UIControlStateNormal];
|
||||||
[_playButton addTarget:self action:@selector(playButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
[_playButton addTarget:self action:@selector(playButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||||
[_backgroundView addSubview:_playButton];
|
[_backgroundContentView addSubview:_playButton];
|
||||||
|
|
||||||
_positionLabel = [[UILabel alloc] initWithFrame:CGRectMake(24.0f, 0, 56.0f, TGEmbedPlayerControlsPanelHeight)];
|
_positionLabel = [[UILabel alloc] initWithFrame:CGRectMake(24.0f, 0, 56.0f, TGEmbedPlayerControlsPanelHeight)];
|
||||||
_positionLabel.backgroundColor = [UIColor clearColor];
|
_positionLabel.backgroundColor = [UIColor clearColor];
|
||||||
@ -108,7 +111,7 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
|||||||
_positionLabel.textAlignment = NSTextAlignmentCenter;
|
_positionLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
_positionLabel.textColor = UIColorRGB(0x302e2e);
|
_positionLabel.textColor = UIColorRGB(0x302e2e);
|
||||||
_positionLabel.userInteractionEnabled = false;
|
_positionLabel.userInteractionEnabled = false;
|
||||||
[_backgroundView addSubview:_positionLabel];
|
[_backgroundContentView addSubview:_positionLabel];
|
||||||
|
|
||||||
_remainingLabel = [[UILabel alloc] initWithFrame:CGRectMake(frame.size.width - 56.0f, 0, 56, TGEmbedPlayerControlsPanelHeight)];
|
_remainingLabel = [[UILabel alloc] initWithFrame:CGRectMake(frame.size.width - 56.0f, 0, 56, TGEmbedPlayerControlsPanelHeight)];
|
||||||
_remainingLabel.backgroundColor = [UIColor clearColor];
|
_remainingLabel.backgroundColor = [UIColor clearColor];
|
||||||
@ -117,13 +120,13 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
|||||||
_remainingLabel.textAlignment = NSTextAlignmentCenter;
|
_remainingLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
_remainingLabel.textColor = UIColorRGB(0x302e2e);
|
_remainingLabel.textColor = UIColorRGB(0x302e2e);
|
||||||
_remainingLabel.userInteractionEnabled = false;
|
_remainingLabel.userInteractionEnabled = false;
|
||||||
[_backgroundView addSubview:_remainingLabel];
|
[_backgroundContentView addSubview:_remainingLabel];
|
||||||
|
|
||||||
_pictureInPictureButton = [[TGModernButton alloc] initWithFrame:CGRectMake(frame.size.width - 45.0f, 0, 45.0f, TGEmbedPlayerControlsPanelHeight)];
|
_pictureInPictureButton = [[TGModernButton alloc] initWithFrame:CGRectMake(frame.size.width - 45.0f, 0, 45.0f, TGEmbedPlayerControlsPanelHeight)];
|
||||||
_pictureInPictureButton.exclusiveTouch = true;
|
_pictureInPictureButton.exclusiveTouch = true;
|
||||||
[_pictureInPictureButton setImage:TGComponentsImageNamed(@"EmbedVideoPIPIcon") forState:UIControlStateNormal];
|
[_pictureInPictureButton setImage:TGComponentsImageNamed(@"EmbedVideoPIPIcon") forState:UIControlStateNormal];
|
||||||
[_pictureInPictureButton addTarget:self action:@selector(pictureInPictureButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
[_pictureInPictureButton addTarget:self action:@selector(pictureInPictureButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||||
[_backgroundView addSubview:_pictureInPictureButton];
|
[_backgroundContentView addSubview:_pictureInPictureButton];
|
||||||
|
|
||||||
__weak TGEmbedPlayerControls *weakSelf = self;
|
__weak TGEmbedPlayerControls *weakSelf = self;
|
||||||
_scrubber = [[TGEmbedPlayerScrubber alloc] initWithFrame:CGRectZero];
|
_scrubber = [[TGEmbedPlayerScrubber alloc] initWithFrame:CGRectZero];
|
||||||
@ -166,7 +169,7 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
[_scrubber setTintColor:UIColorRGB(0x2f2e2e)];
|
[_scrubber setTintColor:UIColorRGB(0x2f2e2e)];
|
||||||
[_backgroundView addSubview:_scrubber];
|
[_backgroundContentView addSubview:_scrubber];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == TGEmbedPlayerControlsTypeSimple)
|
if (type == TGEmbedPlayerControlsTypeSimple)
|
||||||
|
@ -2,6 +2,15 @@
|
|||||||
|
|
||||||
@class TGModernConversationInputMicButton;
|
@class TGModernConversationInputMicButton;
|
||||||
|
|
||||||
|
@protocol TGModernConversationInputMicButtonPresentation <NSObject>
|
||||||
|
|
||||||
|
- (UIView *)view;
|
||||||
|
- (void)setUserInteractionEnabled:(bool)enabled;
|
||||||
|
- (void)present;
|
||||||
|
- (void)dismiss;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@protocol TGModernConversationInputMicButtonDelegate <NSObject>
|
@protocol TGModernConversationInputMicButtonDelegate <NSObject>
|
||||||
|
|
||||||
@optional
|
@optional
|
||||||
@ -16,18 +25,20 @@
|
|||||||
|
|
||||||
- (bool)micButtonShouldLock;
|
- (bool)micButtonShouldLock;
|
||||||
|
|
||||||
|
- (id<TGModernConversationInputMicButtonPresentation>)micButtonPresenter;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface TGModernConversationInputMicButton : UIButton
|
@interface TGModernConversationInputMicButton : UIButton
|
||||||
|
|
||||||
@property (nonatomic, weak) id<TGModernConversationInputMicButtonDelegate> delegate;
|
@property (nonatomic, weak) id<TGModernConversationInputMicButtonDelegate> delegate;
|
||||||
|
|
||||||
|
@property (nonatomic) CGPoint centerOffset;
|
||||||
@property (nonatomic, strong) UIImage *icon;
|
@property (nonatomic, strong) UIImage *icon;
|
||||||
@property (nonatomic, strong) UIImageView *iconView;
|
@property (nonatomic, strong) UIImageView *iconView;
|
||||||
@property (nonatomic, assign) bool blocking;
|
@property (nonatomic, assign) bool blocking;
|
||||||
@property (nonatomic, readonly) bool locked;
|
@property (nonatomic, readonly) bool locked;
|
||||||
@property (nonatomic) bool fadeDisabled;
|
@property (nonatomic) bool fadeDisabled;
|
||||||
@property (nonatomic) bool overlayDisabled;
|
|
||||||
|
|
||||||
- (void)animateIn;
|
- (void)animateIn;
|
||||||
- (void)animateOut;
|
- (void)animateOut;
|
||||||
|
@ -59,6 +59,43 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface TGModernConversationInputMicButtonWindowPresentation : NSObject <TGModernConversationInputMicButtonPresentation> {
|
||||||
|
@public
|
||||||
|
TGModernConversationInputMicWindow *_overlayWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation TGModernConversationInputMicButtonWindowPresentation
|
||||||
|
|
||||||
|
- (instancetype)init {
|
||||||
|
self = [super init];
|
||||||
|
if (self != nil) {
|
||||||
|
_overlayWindow = [[TGModernConversationInputMicWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||||
|
_overlayWindow.windowLevel = 1000000000.0f;
|
||||||
|
_overlayWindow.rootViewController = [[TGModernConversationInputMicButtonOverlayController alloc] init];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIView *)view {
|
||||||
|
return _overlayWindow.rootViewController.view;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setUserInteractionEnabled:(bool)enabled {
|
||||||
|
_overlayWindow.userInteractionEnabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)present {
|
||||||
|
_overlayWindow.hidden = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dismiss {
|
||||||
|
_overlayWindow.hidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface TGModernConversationInputMicButton () <UIGestureRecognizerDelegate>
|
@interface TGModernConversationInputMicButton () <UIGestureRecognizerDelegate>
|
||||||
{
|
{
|
||||||
CGPoint _touchLocation;
|
CGPoint _touchLocation;
|
||||||
@ -70,8 +107,6 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
CFAbsoluteTime _lastTouchTime;
|
CFAbsoluteTime _lastTouchTime;
|
||||||
bool _acceptTouchDownAsTouchUp;
|
bool _acceptTouchDownAsTouchUp;
|
||||||
|
|
||||||
UIWindow *_overlayWindow;
|
|
||||||
|
|
||||||
UIImageView *_innerCircleView;
|
UIImageView *_innerCircleView;
|
||||||
UIImageView *_outerCircleView;
|
UIImageView *_outerCircleView;
|
||||||
|
|
||||||
@ -97,6 +132,8 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
bool _animatedIn;
|
bool _animatedIn;
|
||||||
|
|
||||||
UIImage *_icon;
|
UIImage *_icon;
|
||||||
|
|
||||||
|
id<TGModernConversationInputMicButtonPresentation> _presentation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -193,17 +230,14 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
|
|
||||||
- (void)updateOverlay
|
- (void)updateOverlay
|
||||||
{
|
{
|
||||||
UIView *parentView = nil;
|
if (_presentation == nil) {
|
||||||
if (_overlayWindow == nil) {
|
|
||||||
if (!_overlayDisabled) {
|
|
||||||
parentView = self.superview;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
parentView = _overlayWindow.rootViewController.view;
|
|
||||||
}
|
}
|
||||||
|
UIView *parentView = [_presentation view];
|
||||||
|
|
||||||
CGPoint centerPoint = [self.superview convertPoint:self.center toView:parentView];
|
CGPoint centerPoint = [self.superview convertPoint:self.center toView:parentView];
|
||||||
|
centerPoint.x += _centerOffset.x;
|
||||||
|
centerPoint.y += _centerOffset.y;
|
||||||
_innerCircleView.center = centerPoint;
|
_innerCircleView.center = centerPoint;
|
||||||
_outerCircleView.center = centerPoint;
|
_outerCircleView.center = centerPoint;
|
||||||
_innerIconWrapperView.center = centerPoint;
|
_innerIconWrapperView.center = centerPoint;
|
||||||
@ -220,13 +254,14 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
_animatedIn = true;
|
_animatedIn = true;
|
||||||
_animationStartTime = CACurrentMediaTime();
|
_animationStartTime = CACurrentMediaTime();
|
||||||
|
|
||||||
if (_lockPanelWrapperView == nil) {
|
if (_presentation == nil) {
|
||||||
_overlayWindow = [[TGModernConversationInputMicWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
if ([_delegate respondsToSelector:@selector(micButtonPresenter)]) {
|
||||||
_overlayWindow.windowLevel = 1000000000.0f;
|
_presentation = [_delegate micButtonPresenter];
|
||||||
_overlayWindow.rootViewController = [[TGModernConversationInputMicButtonOverlayController alloc] init];
|
} else {
|
||||||
|
_presentation = [[TGModernConversationInputMicButtonWindowPresentation alloc] init];
|
||||||
__weak TGModernConversationInputMicButton *weakSelf = self;
|
__weak TGModernConversationInputMicButton *weakSelf = self;
|
||||||
((TGModernConversationInputMicWindow *)_overlayWindow).requestedLockedAction = ^
|
|
||||||
|
(((TGModernConversationInputMicButtonWindowPresentation *)_presentation)->_overlayWindow).requestedLockedAction = ^
|
||||||
{
|
{
|
||||||
__strong TGModernConversationInputMicButton *strongSelf = weakSelf;
|
__strong TGModernConversationInputMicButton *strongSelf = weakSelf;
|
||||||
if (strongSelf == nil)
|
if (strongSelf == nil)
|
||||||
@ -236,6 +271,7 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
if ([delegate respondsToSelector:@selector(micButtonInteractionRequestedLockedAction)])
|
if ([delegate respondsToSelector:@selector(micButtonInteractionRequestedLockedAction)])
|
||||||
[delegate micButtonInteractionRequestedLockedAction];
|
[delegate micButtonInteractionRequestedLockedAction];
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
static UIImage *panelBackgroundView;
|
static UIImage *panelBackgroundView;
|
||||||
@ -271,7 +307,7 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
|
|
||||||
_lockPanelWrapperView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 38.0f, 77.0f)];
|
_lockPanelWrapperView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 38.0f, 77.0f)];
|
||||||
_lockPanelWrapperView.userInteractionEnabled = false;
|
_lockPanelWrapperView.userInteractionEnabled = false;
|
||||||
[_overlayWindow.rootViewController.view addSubview:_lockPanelWrapperView];
|
[[_presentation view] addSubview:_lockPanelWrapperView];
|
||||||
|
|
||||||
_lockPanelView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 38.0f, 77.0f)];
|
_lockPanelView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 38.0f, 77.0f)];
|
||||||
_lockPanelView.image = panelBackgroundView;
|
_lockPanelView.image = panelBackgroundView;
|
||||||
@ -287,11 +323,11 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
|
|
||||||
_innerCircleView = [[UIImageView alloc] initWithImage:[self innerCircleImage]];
|
_innerCircleView = [[UIImageView alloc] initWithImage:[self innerCircleImage]];
|
||||||
_innerCircleView.alpha = 0.0f;
|
_innerCircleView.alpha = 0.0f;
|
||||||
[_overlayWindow.rootViewController.view addSubview:_innerCircleView];
|
[[_presentation view] addSubview:_innerCircleView];
|
||||||
|
|
||||||
_outerCircleView = [[UIImageView alloc] initWithImage:[self outerCircleImage]];
|
_outerCircleView = [[UIImageView alloc] initWithImage:[self outerCircleImage]];
|
||||||
_outerCircleView.alpha = 0.0f;
|
_outerCircleView.alpha = 0.0f;
|
||||||
[_overlayWindow.rootViewController.view addSubview:_outerCircleView];
|
[[_presentation view] addSubview:_outerCircleView];
|
||||||
|
|
||||||
_innerIconView = [[UIImageView alloc] initWithImage:_icon];
|
_innerIconView = [[UIImageView alloc] initWithImage:_icon];
|
||||||
|
|
||||||
@ -300,7 +336,7 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
_innerIconWrapperView.userInteractionEnabled = false;
|
_innerIconWrapperView.userInteractionEnabled = false;
|
||||||
[_innerIconWrapperView addSubview:_innerIconView];
|
[_innerIconWrapperView addSubview:_innerIconView];
|
||||||
|
|
||||||
[_overlayWindow.rootViewController.view addSubview:_innerIconWrapperView];
|
[[_presentation view] addSubview:_innerIconWrapperView];
|
||||||
|
|
||||||
_stopButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 38.0f, 38.0f)];
|
_stopButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 38.0f, 38.0f)];
|
||||||
_stopButton.adjustsImageWhenHighlighted = false;
|
_stopButton.adjustsImageWhenHighlighted = false;
|
||||||
@ -345,11 +381,11 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
_stopButton.userInteractionEnabled = false;
|
_stopButton.userInteractionEnabled = false;
|
||||||
_stopButton.alpha = 0.0f;
|
_stopButton.alpha = 0.0f;
|
||||||
[_stopButton addTarget:self action:@selector(stopPressed) forControlEvents:UIControlEventTouchUpInside];
|
[_stopButton addTarget:self action:@selector(stopPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||||
[_overlayWindow.rootViewController.view addSubview:_stopButton];
|
[[_presentation view] addSubview:_stopButton];
|
||||||
}
|
}
|
||||||
|
|
||||||
_overlayWindow.userInteractionEnabled = _blocking;
|
[_presentation setUserInteractionEnabled:_blocking];
|
||||||
_overlayWindow.hidden = false;
|
[_presentation present];
|
||||||
|
|
||||||
_stopButton.userInteractionEnabled = false;
|
_stopButton.userInteractionEnabled = false;
|
||||||
|
|
||||||
@ -423,7 +459,8 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
|||||||
_stopButton.alpha = 0.0f;
|
_stopButton.alpha = 0.0f;
|
||||||
} completion:^(BOOL finished) {
|
} completion:^(BOOL finished) {
|
||||||
if (finished || [[[LegacyComponentsGlobals provider] applicationInstance] applicationState] == UIApplicationStateBackground) {
|
if (finished || [[[LegacyComponentsGlobals provider] applicationInstance] applicationState] == UIApplicationStateBackground) {
|
||||||
_overlayWindow.hidden = true;
|
[_presentation dismiss];
|
||||||
|
_presentation = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_previousIcon != nil)
|
if (_previousIcon != nil)
|
||||||
|
@ -467,10 +467,13 @@ UIImageOrientation TGVideoOrientationForAsset(AVAsset *asset, bool *mirrored)
|
|||||||
|
|
||||||
if (mirrored != NULL)
|
if (mirrored != NULL)
|
||||||
{
|
{
|
||||||
UIView *tempView = [[UIView alloc] init];
|
CGFloat scaleX = sqrt(t.a * t.a + t.c * t.c);
|
||||||
|
CGFloat scaleY = sqrt(t.b * t.b + t.d * t.d);
|
||||||
|
/*UIView *tempView = [[UIView alloc] init];
|
||||||
tempView.transform = t;
|
tempView.transform = t;
|
||||||
CGSize scale = CGSizeMake([[tempView.layer valueForKeyPath: @"transform.scale.x"] floatValue],
|
CGSize scale = CGSizeMake([[tempView.layer valueForKeyPath: @"transform.scale.x"] floatValue],
|
||||||
[[tempView.layer valueForKeyPath: @"transform.scale.y"] floatValue]);
|
[[tempView.layer valueForKeyPath: @"transform.scale.y"] floatValue]);*/
|
||||||
|
CGSize scale = CGSizeMake(scaleX, scaleY);
|
||||||
|
|
||||||
*mirrored = (scale.width < 0);
|
*mirrored = (scale.width < 0);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
@property (nonatomic, copy) void(^onDismiss)(bool isAuto);
|
@property (nonatomic, copy) void(^onDismiss)(bool isAuto);
|
||||||
@property (nonatomic, copy) void(^onStop)(void);
|
@property (nonatomic, copy) void(^onStop)(void);
|
||||||
@property (nonatomic, copy) void(^onCancel)(void);
|
@property (nonatomic, copy) void(^onCancel)(void);
|
||||||
|
@property (nonatomic, copy) void(^didDismiss)(void);
|
||||||
|
|
||||||
- (instancetype)initWithContext:(id<LegacyComponentsContext>)context assets:(TGVideoMessageCaptureControllerAssets *)assets transitionInView:(UIView *(^)())transitionInView parentController:(TGViewController *)parentController controlsFrame:(CGRect)controlsFrame isAlreadyLocked:(bool (^)(void))isAlreadyLocked liveUploadInterface:(id<TGLiveUploadInterface>)liveUploadInterface;
|
- (instancetype)initWithContext:(id<LegacyComponentsContext>)context assets:(TGVideoMessageCaptureControllerAssets *)assets transitionInView:(UIView *(^)())transitionInView parentController:(TGViewController *)parentController controlsFrame:(CGRect)controlsFrame isAlreadyLocked:(bool (^)(void))isAlreadyLocked liveUploadInterface:(id<TGLiveUploadInterface>)liveUploadInterface;
|
||||||
- (void)buttonInteractionUpdate:(CGPoint)value;
|
- (void)buttonInteractionUpdate:(CGPoint)value;
|
||||||
@ -27,7 +28,7 @@
|
|||||||
|
|
||||||
- (void)complete;
|
- (void)complete;
|
||||||
- (void)dismiss;
|
- (void)dismiss;
|
||||||
- (void)stop;
|
- (bool)stop;
|
||||||
|
|
||||||
+ (void)clearStartImage;
|
+ (void)clearStartImage;
|
||||||
|
|
||||||
|
@ -503,6 +503,10 @@ typedef enum
|
|||||||
|
|
||||||
if (_autorotationWasEnabled)
|
if (_autorotationWasEnabled)
|
||||||
[TGViewController enableAutorotation];
|
[TGViewController enableAutorotation];
|
||||||
|
|
||||||
|
if (_didDismiss) {
|
||||||
|
_didDismiss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dismiss
|
- (void)dismiss
|
||||||
@ -557,14 +561,16 @@ typedef enum
|
|||||||
|
|
||||||
- (void)setLocked
|
- (void)setLocked
|
||||||
{
|
{
|
||||||
|
if ([self.view.window isKindOfClass:[TGVideoMessageCaptureControllerWindow class]]) {
|
||||||
((TGVideoMessageCaptureControllerWindow *)self.view.window).locked = true;
|
((TGVideoMessageCaptureControllerWindow *)self.view.window).locked = true;
|
||||||
|
}
|
||||||
[_controlsView setLocked];
|
[_controlsView setLocked];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)stop
|
- (bool)stop
|
||||||
{
|
{
|
||||||
if (!_capturePipeline.isRecording)
|
if (!_capturePipeline.isRecording)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if ([self.view.window isKindOfClass:[TGVideoMessageCaptureControllerWindow class]]) {
|
if ([self.view.window isKindOfClass:[TGVideoMessageCaptureControllerWindow class]]) {
|
||||||
((TGVideoMessageCaptureControllerWindow *)self.view.window).locked = false;
|
((TGVideoMessageCaptureControllerWindow *)self.view.window).locked = false;
|
||||||
@ -575,14 +581,15 @@ typedef enum
|
|||||||
|
|
||||||
[_activityDisposable dispose];
|
[_activityDisposable dispose];
|
||||||
[self stopRecording];
|
[self stopRecording];
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)sendPressed
|
- (void)sendPressed
|
||||||
{
|
{
|
||||||
|
[self finishWithURL:_url dimensions:CGSizeMake(240.0f, 240.0f) duration:_duration liveUploadData:_liveUploadData thumbnailImage:_thumbnailImage];
|
||||||
|
|
||||||
_automaticDismiss = true;
|
_automaticDismiss = true;
|
||||||
[self dismiss:false];
|
[self dismiss:false];
|
||||||
|
|
||||||
[self finishWithURL:_url dimensions:CGSizeMake(240.0f, 240.0f) duration:_duration liveUploadData:_liveUploadData thumbnailImage:_thumbnailImage];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)unmutePressed
|
- (void)unmutePressed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user