mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-22 12:08:55 +00:00
Merge commit '3facbe4ddc9bf0e3183789fbb201866168acbde5'
This commit is contained in:
@@ -5252,6 +5252,74 @@
|
||||
};
|
||||
name = "Release Hockeyapp";
|
||||
};
|
||||
D02660951F34DCBF000E2DC5 /* Release Hockeyapp */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = "Release Hockeyapp";
|
||||
};
|
||||
D02660961F34DCBF000E2DC5 /* Release Hockeyapp */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = LegacyComponents/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MACH_O_TYPE = staticlib;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.Telegram.LegacyComponents;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = "Release Hockeyapp";
|
||||
};
|
||||
D07BCBFF1F2B79AE00ED97AA /* Debug Hockeyapp */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -5415,7 +5483,8 @@
|
||||
D01778931F1FA58C0044446D /* Debug */,
|
||||
D017772E1F1F8F100044446D /* Release */,
|
||||
D07BCC011F2B79B900ED97AA /* Release AppStore */,
|
||||
D01778951F1FA5960044446D /* Release Hockeyapp */,
|
||||
D01778951F1FA5960044446D /* Hockeyapp */,
|
||||
D02660951F34DCBF000E2DC5 /* Release Hockeyapp */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
@@ -5428,7 +5497,8 @@
|
||||
D01778941F1FA58C0044446D /* Debug */,
|
||||
D01777311F1F8F100044446D /* Release */,
|
||||
D07BCC021F2B79B900ED97AA /* Release AppStore */,
|
||||
D01778961F1FA5960044446D /* Release Hockeyapp */,
|
||||
D01778961F1FA5960044446D /* Hockeyapp */,
|
||||
D02660961F34DCBF000E2DC5 /* Release Hockeyapp */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
|
||||
@@ -284,10 +284,14 @@ FOUNDATION_EXPORT const unsigned char LegacyComponentsVersionString[];
|
||||
#import <LegacyComponents/TGMediaAssetsController.h>
|
||||
|
||||
#import <LegacyComponents/TGLocationPickerController.h>
|
||||
#import <LegacyComponents/TGLocationViewController.h>
|
||||
#import <LegacyComponents/TGListsTableView.h>
|
||||
#import <LegacyComponents/TGSearchBar.h>
|
||||
#import <LegacyComponents/TGSearchDisplayMixin.h>
|
||||
|
||||
#import <LegacyComponents/TGPhotoEditorSliderView.h>
|
||||
|
||||
#import <LegacyComponents/TGClipboardGalleryMixin.h>
|
||||
#import <LegacyComponents/TGClipboardGalleryPhotoItem.h>
|
||||
#import <LegacyComponents/TGVideoMessageCaptureController.h>
|
||||
#import <LegacyComponents/TGModernConversationInputMicButton.h>
|
||||
|
||||
@@ -105,7 +105,9 @@ static void PGButtonHandlerEnableMonitoring(bool enable)
|
||||
- (void)setEnabled:(bool)enabled
|
||||
{
|
||||
_enabled = enabled;
|
||||
PGButtonHandlerEnableMonitoring(enabled);
|
||||
TGDispatchOnMainThread(^{
|
||||
PGButtonHandlerEnableMonitoring(enabled);
|
||||
});
|
||||
}
|
||||
|
||||
- (void)enableIn:(NSTimeInterval)timeInterval
|
||||
|
||||
@@ -150,7 +150,9 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
[self.legacyPreviewLayer setSession:nil];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.legacyPreviewLayer setSession:nil];
|
||||
});
|
||||
}
|
||||
_wrapperView = nil;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
||||
UIButton *_screenAreaButton;
|
||||
|
||||
UIView *_backgroundView;
|
||||
UIView *_backgroundContentView;
|
||||
TGModernButton *_playButton;
|
||||
TGModernButton *_pauseButton;
|
||||
|
||||
@@ -71,21 +72,23 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
||||
[_screenAreaButton addTarget:self action:@selector(screenAreaPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:_screenAreaButton];
|
||||
|
||||
if (TGEmbedPlayerControlsTypeFull)
|
||||
if (type == TGEmbedPlayerControlsTypeFull)
|
||||
{
|
||||
if (iosMajorVersion() >= 8)
|
||||
{
|
||||
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
|
||||
_backgroundView = effectView;
|
||||
_backgroundContentView = effectView.contentView;
|
||||
|
||||
UIView *whiteView = [[UIView alloc] initWithFrame:effectView.bounds];
|
||||
whiteView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
whiteView.backgroundColor = UIColorRGBA(0xffffff, 0.3f);
|
||||
[_backgroundView addSubview:whiteView];
|
||||
[effectView.contentView addSubview:whiteView];
|
||||
}
|
||||
else
|
||||
{
|
||||
_backgroundView = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
_backgroundContentView = _backgroundView;
|
||||
}
|
||||
[self addSubview:_backgroundView];
|
||||
|
||||
@@ -93,13 +96,13 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
||||
_pauseButton.exclusiveTouch = true;
|
||||
[_pauseButton setImage:TGComponentsImageNamed(@"EmbedVideoPauseIcon") forState:UIControlStateNormal];
|
||||
[_pauseButton addTarget:self action:@selector(pauseButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_backgroundView addSubview:_pauseButton];
|
||||
[_backgroundContentView addSubview:_pauseButton];
|
||||
|
||||
_playButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, 38, TGEmbedPlayerControlsPanelHeight)];
|
||||
_playButton.exclusiveTouch = true;
|
||||
[_playButton setImage:TGComponentsImageNamed(@"EmbedVideoPlayIcon") forState:UIControlStateNormal];
|
||||
[_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.backgroundColor = [UIColor clearColor];
|
||||
@@ -108,7 +111,7 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
||||
_positionLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_positionLabel.textColor = UIColorRGB(0x302e2e);
|
||||
_positionLabel.userInteractionEnabled = false;
|
||||
[_backgroundView addSubview:_positionLabel];
|
||||
[_backgroundContentView addSubview:_positionLabel];
|
||||
|
||||
_remainingLabel = [[UILabel alloc] initWithFrame:CGRectMake(frame.size.width - 56.0f, 0, 56, TGEmbedPlayerControlsPanelHeight)];
|
||||
_remainingLabel.backgroundColor = [UIColor clearColor];
|
||||
@@ -117,13 +120,13 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
||||
_remainingLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_remainingLabel.textColor = UIColorRGB(0x302e2e);
|
||||
_remainingLabel.userInteractionEnabled = false;
|
||||
[_backgroundView addSubview:_remainingLabel];
|
||||
[_backgroundContentView addSubview:_remainingLabel];
|
||||
|
||||
_pictureInPictureButton = [[TGModernButton alloc] initWithFrame:CGRectMake(frame.size.width - 45.0f, 0, 45.0f, TGEmbedPlayerControlsPanelHeight)];
|
||||
_pictureInPictureButton.exclusiveTouch = true;
|
||||
[_pictureInPictureButton setImage:TGComponentsImageNamed(@"EmbedVideoPIPIcon") forState:UIControlStateNormal];
|
||||
[_pictureInPictureButton addTarget:self action:@selector(pictureInPictureButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_backgroundView addSubview:_pictureInPictureButton];
|
||||
[_backgroundContentView addSubview:_pictureInPictureButton];
|
||||
|
||||
__weak TGEmbedPlayerControls *weakSelf = self;
|
||||
_scrubber = [[TGEmbedPlayerScrubber alloc] initWithFrame:CGRectZero];
|
||||
@@ -166,7 +169,7 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f;
|
||||
}
|
||||
};
|
||||
[_scrubber setTintColor:UIColorRGB(0x2f2e2e)];
|
||||
[_backgroundView addSubview:_scrubber];
|
||||
[_backgroundContentView addSubview:_scrubber];
|
||||
}
|
||||
|
||||
if (type == TGEmbedPlayerControlsTypeSimple)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#import <LegacyComponents/LegacyComponents.h>
|
||||
#import <LegacyComponents/TGViewController.h>
|
||||
#import <LegacyComponents/LegacyComponentsContext.h>
|
||||
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
@@ -13,6 +14,6 @@ typedef enum {
|
||||
|
||||
@property (nonatomic, copy) void (^locationPicked)(CLLocationCoordinate2D coordinate, TGVenueAttachment *venue);
|
||||
|
||||
- (instancetype)initWithIntent:(TGLocationPickerControllerIntent)intent;
|
||||
- (instancetype)initWithContext:(id<LegacyComponentsContext>)context intent:(TGLocationPickerControllerIntent)intent;
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#import "LegacyComponentsInternal.h"
|
||||
#import "TGColor.h"
|
||||
#import "TGImageUtils.h"
|
||||
#import "TGFont.h"
|
||||
|
||||
#import <MapKit/MapKit.h>
|
||||
|
||||
@@ -126,14 +128,9 @@ const TGLocationPlacesService TGLocationPickerPlacesProvider = TGLocationPlacesS
|
||||
|
||||
@implementation TGLocationPickerController
|
||||
|
||||
- (instancetype)init
|
||||
- (instancetype)initWithContext:(id<LegacyComponentsContext>)context intent:(TGLocationPickerControllerIntent)intent
|
||||
{
|
||||
return [self initWithIntent:TGLocationPickerControllerDefaultIntent];
|
||||
}
|
||||
|
||||
- (instancetype)initWithIntent:(TGLocationPickerControllerIntent)intent
|
||||
{
|
||||
self = [super init];
|
||||
self = [super initWithContext:context];
|
||||
if (self != nil)
|
||||
{
|
||||
_intent = intent;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
@interface TGLocationViewController : TGViewController
|
||||
|
||||
@property (nonatomic, assign) bool modalMode;
|
||||
@property (nonatomic, assign) bool previewMode;
|
||||
|
||||
@property (nonatomic, copy) bool (^presentShareMenu)(TGMenuSheetController *, CLLocationCoordinate2D);
|
||||
|
||||
@@ -55,23 +55,15 @@
|
||||
|
||||
@implementation TGLocationViewController
|
||||
|
||||
- (instancetype)init
|
||||
- (instancetype)initWithContext:(id<LegacyComponentsContext>)context coordinate:(CLLocationCoordinate2D)coordinate venue:(TGVenueAttachment *)venue peer:(id)peer
|
||||
{
|
||||
self = [super init];
|
||||
self = [self initWithContext:context];
|
||||
if (self != nil)
|
||||
{
|
||||
self.titleText = TGLocalized(@"Map.LocationTitle");
|
||||
|
||||
_locationManager = [[CLLocationManager alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithContext:(id<LegacyComponentsContext>)context coordinate:(CLLocationCoordinate2D)coordinate venue:(TGVenueAttachment *)venue peer:(id)peer
|
||||
{
|
||||
self = [self init];
|
||||
if (self != nil)
|
||||
{
|
||||
|
||||
_context = context;
|
||||
_location = [[CLLocation alloc] initWithLatitude:coordinate.latitude longitude:coordinate.longitude];
|
||||
_venue = venue;
|
||||
@@ -137,7 +129,7 @@
|
||||
[_toolbarView addSubview:_mapModeControl];
|
||||
|
||||
NSString *backButtonTitle = TGLocalized(@"Common.Back");
|
||||
if (TGIsPad())
|
||||
if (TGIsPad() || _modalMode)
|
||||
{
|
||||
backButtonTitle = TGLocalized(@"Common.Done");
|
||||
[self setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:backButtonTitle style:UIBarButtonItemStyleDone target:self action:@selector(dismissButtonPressed)]];
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#import "TGMediaPickerGalleryVideoScrubberThumbnailView.h"
|
||||
#import "TGMediaPickerGalleryVideoTrimView.h"
|
||||
|
||||
const CGFloat TGVideoScrubberMinimumTrimDuration = 1.0f;
|
||||
const CGFloat TGVideoScrubberZoomActivationInterval = 0.25f;
|
||||
const CGFloat TGVideoScrubberTrimRectEpsilon = 3.0f;
|
||||
static const CGFloat TGVideoScrubberMinimumTrimDuration = 1.0f;
|
||||
static const CGFloat TGVideoScrubberZoomActivationInterval = 0.25f;
|
||||
static const CGFloat TGVideoScrubberTrimRectEpsilon = 3.0f;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
||||
@@ -2,6 +2,15 @@
|
||||
|
||||
@class TGModernConversationInputMicButton;
|
||||
|
||||
@protocol TGModernConversationInputMicButtonPresentation <NSObject>
|
||||
|
||||
- (UIView *)view;
|
||||
- (void)setUserInteractionEnabled:(bool)enabled;
|
||||
- (void)present;
|
||||
- (void)dismiss;
|
||||
|
||||
@end
|
||||
|
||||
@protocol TGModernConversationInputMicButtonDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
@@ -16,18 +25,20 @@
|
||||
|
||||
- (bool)micButtonShouldLock;
|
||||
|
||||
- (id<TGModernConversationInputMicButtonPresentation>)micButtonPresenter;
|
||||
|
||||
@end
|
||||
|
||||
@interface TGModernConversationInputMicButton : UIButton
|
||||
|
||||
@property (nonatomic, weak) id<TGModernConversationInputMicButtonDelegate> delegate;
|
||||
|
||||
@property (nonatomic) CGPoint centerOffset;
|
||||
@property (nonatomic, strong) UIImage *icon;
|
||||
@property (nonatomic, strong) UIImageView *iconView;
|
||||
@property (nonatomic, assign) bool blocking;
|
||||
@property (nonatomic, readonly) bool locked;
|
||||
@property (nonatomic) bool fadeDisabled;
|
||||
@property (nonatomic) bool overlayDisabled;
|
||||
|
||||
- (void)animateIn;
|
||||
- (void)animateOut;
|
||||
|
||||
@@ -59,6 +59,43 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
|
||||
@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>
|
||||
{
|
||||
CGPoint _touchLocation;
|
||||
@@ -70,8 +107,6 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
CFAbsoluteTime _lastTouchTime;
|
||||
bool _acceptTouchDownAsTouchUp;
|
||||
|
||||
UIWindow *_overlayWindow;
|
||||
|
||||
UIImageView *_innerCircleView;
|
||||
UIImageView *_outerCircleView;
|
||||
|
||||
@@ -97,6 +132,8 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
bool _animatedIn;
|
||||
|
||||
UIImage *_icon;
|
||||
|
||||
id<TGModernConversationInputMicButtonPresentation> _presentation;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -193,17 +230,14 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
|
||||
- (void)updateOverlay
|
||||
{
|
||||
UIView *parentView = nil;
|
||||
if (_overlayWindow == nil) {
|
||||
if (!_overlayDisabled) {
|
||||
parentView = self.superview;
|
||||
}
|
||||
if (_presentation == nil) {
|
||||
return;
|
||||
} else {
|
||||
parentView = _overlayWindow.rootViewController.view;
|
||||
}
|
||||
UIView *parentView = [_presentation view];
|
||||
|
||||
CGPoint centerPoint = [self.superview convertPoint:self.center toView:parentView];
|
||||
centerPoint.x += _centerOffset.x;
|
||||
centerPoint.y += _centerOffset.y;
|
||||
_innerCircleView.center = centerPoint;
|
||||
_outerCircleView.center = centerPoint;
|
||||
_innerIconWrapperView.center = centerPoint;
|
||||
@@ -220,22 +254,24 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
_animatedIn = true;
|
||||
_animationStartTime = CACurrentMediaTime();
|
||||
|
||||
if (_lockPanelWrapperView == nil) {
|
||||
_overlayWindow = [[TGModernConversationInputMicWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
_overlayWindow.windowLevel = 1000000000.0f;
|
||||
_overlayWindow.rootViewController = [[TGModernConversationInputMicButtonOverlayController alloc] init];
|
||||
|
||||
__weak TGModernConversationInputMicButton *weakSelf = self;
|
||||
((TGModernConversationInputMicWindow *)_overlayWindow).requestedLockedAction = ^
|
||||
{
|
||||
__strong TGModernConversationInputMicButton *strongSelf = weakSelf;
|
||||
if (strongSelf == nil)
|
||||
return;
|
||||
if (_presentation == nil) {
|
||||
if ([_delegate respondsToSelector:@selector(micButtonPresenter)]) {
|
||||
_presentation = [_delegate micButtonPresenter];
|
||||
} else {
|
||||
_presentation = [[TGModernConversationInputMicButtonWindowPresentation alloc] init];
|
||||
__weak TGModernConversationInputMicButton *weakSelf = self;
|
||||
|
||||
id<TGModernConversationInputMicButtonDelegate> delegate = strongSelf.delegate;
|
||||
if ([delegate respondsToSelector:@selector(micButtonInteractionRequestedLockedAction)])
|
||||
[delegate micButtonInteractionRequestedLockedAction];
|
||||
};
|
||||
(((TGModernConversationInputMicButtonWindowPresentation *)_presentation)->_overlayWindow).requestedLockedAction = ^
|
||||
{
|
||||
__strong TGModernConversationInputMicButton *strongSelf = weakSelf;
|
||||
if (strongSelf == nil)
|
||||
return;
|
||||
|
||||
id<TGModernConversationInputMicButtonDelegate> delegate = strongSelf.delegate;
|
||||
if ([delegate respondsToSelector:@selector(micButtonInteractionRequestedLockedAction)])
|
||||
[delegate micButtonInteractionRequestedLockedAction];
|
||||
};
|
||||
}
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
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.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.image = panelBackgroundView;
|
||||
@@ -287,11 +323,11 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
|
||||
_innerCircleView = [[UIImageView alloc] initWithImage:[self innerCircleImage]];
|
||||
_innerCircleView.alpha = 0.0f;
|
||||
[_overlayWindow.rootViewController.view addSubview:_innerCircleView];
|
||||
[[_presentation view] addSubview:_innerCircleView];
|
||||
|
||||
_outerCircleView = [[UIImageView alloc] initWithImage:[self outerCircleImage]];
|
||||
_outerCircleView.alpha = 0.0f;
|
||||
[_overlayWindow.rootViewController.view addSubview:_outerCircleView];
|
||||
[[_presentation view] addSubview:_outerCircleView];
|
||||
|
||||
_innerIconView = [[UIImageView alloc] initWithImage:_icon];
|
||||
|
||||
@@ -300,7 +336,7 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
_innerIconWrapperView.userInteractionEnabled = false;
|
||||
[_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.adjustsImageWhenHighlighted = false;
|
||||
@@ -345,11 +381,11 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
_stopButton.userInteractionEnabled = false;
|
||||
_stopButton.alpha = 0.0f;
|
||||
[_stopButton addTarget:self action:@selector(stopPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_overlayWindow.rootViewController.view addSubview:_stopButton];
|
||||
[[_presentation view] addSubview:_stopButton];
|
||||
}
|
||||
|
||||
_overlayWindow.userInteractionEnabled = _blocking;
|
||||
_overlayWindow.hidden = false;
|
||||
[_presentation setUserInteractionEnabled:_blocking];
|
||||
[_presentation present];
|
||||
|
||||
_stopButton.userInteractionEnabled = false;
|
||||
|
||||
@@ -423,7 +459,8 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius
|
||||
_stopButton.alpha = 0.0f;
|
||||
} completion:^(BOOL finished) {
|
||||
if (finished || [[[LegacyComponentsGlobals provider] applicationInstance] applicationState] == UIApplicationStateBackground) {
|
||||
_overlayWindow.hidden = true;
|
||||
[_presentation dismiss];
|
||||
_presentation = nil;
|
||||
}
|
||||
|
||||
if (_previousIcon != nil)
|
||||
|
||||
@@ -157,11 +157,13 @@
|
||||
if (self != nil) {
|
||||
_keepKeyboard = keepKeyboard;
|
||||
_manager = manager;
|
||||
_managedIsHidden = true;
|
||||
}
|
||||
|
||||
self = [super initWithFrame:[[_manager context] fullscreenBounds]];
|
||||
if (self != nil)
|
||||
{
|
||||
self.frame = [[_manager context] fullscreenBounds];
|
||||
self.windowLevel = UIWindowLevelStatusBar - 0.001f;
|
||||
|
||||
_parentController = parentController;
|
||||
@@ -185,7 +187,7 @@
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
|
||||
_manager = nil;
|
||||
}
|
||||
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
||||
|
||||
@@ -467,10 +467,13 @@ UIImageOrientation TGVideoOrientationForAsset(AVAsset *asset, bool *mirrored)
|
||||
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
@property (nonatomic, copy) void(^onDismiss)(bool isAuto);
|
||||
@property (nonatomic, copy) void(^onStop)(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;
|
||||
- (void)buttonInteractionUpdate:(CGPoint)value;
|
||||
@@ -27,7 +28,7 @@
|
||||
|
||||
- (void)complete;
|
||||
- (void)dismiss;
|
||||
- (void)stop;
|
||||
- (bool)stop;
|
||||
|
||||
+ (void)clearStartImage;
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ typedef enum
|
||||
|
||||
- (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
|
||||
{
|
||||
self = [super init];
|
||||
self = [super initWithContext:context];
|
||||
if (self != nil)
|
||||
{
|
||||
_context = context;
|
||||
@@ -503,6 +503,10 @@ typedef enum
|
||||
|
||||
if (_autorotationWasEnabled)
|
||||
[TGViewController enableAutorotation];
|
||||
|
||||
if (_didDismiss) {
|
||||
_didDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dismiss
|
||||
@@ -557,30 +561,35 @@ typedef enum
|
||||
|
||||
- (void)setLocked
|
||||
{
|
||||
((TGVideoMessageCaptureControllerWindow *)self.view.window).locked = true;
|
||||
if ([self.view.window isKindOfClass:[TGVideoMessageCaptureControllerWindow class]]) {
|
||||
((TGVideoMessageCaptureControllerWindow *)self.view.window).locked = true;
|
||||
}
|
||||
[_controlsView setLocked];
|
||||
}
|
||||
|
||||
- (void)stop
|
||||
- (bool)stop
|
||||
{
|
||||
if (!_capturePipeline.isRecording)
|
||||
return;
|
||||
return false;
|
||||
|
||||
((TGVideoMessageCaptureControllerWindow *)self.view.window).locked = false;
|
||||
if ([self.view.window isKindOfClass:[TGVideoMessageCaptureControllerWindow class]]) {
|
||||
((TGVideoMessageCaptureControllerWindow *)self.view.window).locked = false;
|
||||
}
|
||||
_stopped = true;
|
||||
_gpuAvailable = false;
|
||||
_switchButton.userInteractionEnabled = false;
|
||||
|
||||
[_activityDisposable dispose];
|
||||
[self stopRecording];
|
||||
return true;
|
||||
}
|
||||
|
||||
- (void)sendPressed
|
||||
{
|
||||
[self finishWithURL:_url dimensions:CGSizeMake(240.0f, 240.0f) duration:_duration liveUploadData:_liveUploadData thumbnailImage:_thumbnailImage];
|
||||
|
||||
_automaticDismiss = true;
|
||||
[self dismiss:false];
|
||||
|
||||
[self finishWithURL:_url dimensions:CGSizeMake(240.0f, 240.0f) duration:_duration liveUploadData:_liveUploadData thumbnailImage:_thumbnailImage];
|
||||
}
|
||||
|
||||
- (void)unmutePressed
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#import "TGVideoMessageScrubberThumbnailView.h"
|
||||
#import "TGVideoMessageTrimView.h"
|
||||
|
||||
const CGFloat TGVideoScrubberMinimumTrimDuration = 1.0f;
|
||||
const CGFloat TGVideoScrubberZoomActivationInterval = 0.25f;
|
||||
const CGFloat TGVideoScrubberTrimRectEpsilon = 3.0f;
|
||||
static const CGFloat TGVideoScrubberMinimumTrimDuration = 1.0f;
|
||||
static const CGFloat TGVideoScrubberZoomActivationInterval = 0.25f;
|
||||
static const CGFloat TGVideoScrubberTrimRectEpsilon = 3.0f;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user