mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-24 21:11:22 +00:00
Merge branch 'tmp'
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
@interface TGCameraCapturedVideo : NSObject <TGMediaEditableItem, TGMediaSelectableItem>
|
||||
|
||||
@property (nonatomic, readonly) AVURLAsset *avAsset;
|
||||
@property (nonatomic, readonly) NSTimeInterval duration;
|
||||
@property (nonatomic, readonly) NSTimeInterval videoDuration;
|
||||
|
||||
- (instancetype)initWithURL:(NSURL *)url;
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@
|
||||
return _cachedSize;
|
||||
}
|
||||
|
||||
- (NSTimeInterval)videoDuration
|
||||
{
|
||||
return [self originalDuration];
|
||||
}
|
||||
|
||||
- (NSTimeInterval)originalDuration
|
||||
{
|
||||
if (_cachedDuration > DBL_EPSILON)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#import <LegacyComponents/TGVideoEditAdjustments.h>
|
||||
|
||||
#import "TGCameraCapturedVideo.h"
|
||||
#import "TGMediaAsset+TGMediaEditableItem.h"
|
||||
|
||||
NSString *const TGMediaPickerPhotoStripCellKind = @"PhotoStripCell";
|
||||
@@ -121,6 +122,8 @@ NSString *const TGMediaPickerPhotoStripCellKind = @"PhotoStripCell";
|
||||
{
|
||||
_item = item;
|
||||
|
||||
[_adjustmentsDisposable setDisposable:nil];
|
||||
|
||||
if (removable)
|
||||
{
|
||||
if (_deleteButton == nil)
|
||||
@@ -166,6 +169,33 @@ NSString *const TGMediaPickerPhotoStripCellKind = @"PhotoStripCell";
|
||||
|
||||
[_imageView setSignal:signal];
|
||||
|
||||
if ([item isKindOfClass:[TGCameraCapturedVideo class]])
|
||||
{
|
||||
TGCameraCapturedVideo *video = (TGCameraCapturedVideo *)item;
|
||||
_gradientView.hidden = false;
|
||||
_label.text = [NSString stringWithFormat:@"%d:%02d", (int)ceil(video.videoDuration) / 60, (int)ceil(video.videoDuration) % 60];
|
||||
_iconView.image = TGComponentsImageNamed(@"ModernMediaItemVideoIcon");
|
||||
|
||||
if (self.editingContext != nil)
|
||||
{
|
||||
SSignal *adjustmentsSignal = [self.editingContext adjustmentsSignalForItem:video];
|
||||
|
||||
__weak TGMediaPickerPhotoStripCell *weakSelf = self;
|
||||
[_adjustmentsDisposable setDisposable:[adjustmentsSignal startWithNext:^(TGVideoEditAdjustments *next)
|
||||
{
|
||||
__strong TGMediaPickerPhotoStripCell *strongSelf = weakSelf;
|
||||
if (strongSelf == nil)
|
||||
return;
|
||||
|
||||
if ([next isKindOfClass:[TGVideoEditAdjustments class]])
|
||||
[strongSelf _layoutImageForOriginalSize:next.originalSize cropRect:next.cropRect cropOrientation:next.cropOrientation];
|
||||
else
|
||||
[strongSelf _layoutImageWithoutAdjustments];
|
||||
}]];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
TGMediaAsset *asset = (TGMediaAsset *)item;
|
||||
if (![asset isKindOfClass:[TGMediaAsset class]])
|
||||
return;
|
||||
@@ -347,16 +377,6 @@ NSString *const TGMediaPickerPhotoStripCellKind = @"PhotoStripCell";
|
||||
|
||||
UIImage *icon = TGComponentsImageNamed(@"CameraDeleteIcon.png");
|
||||
[icon drawAtPoint:CGPointMake((size.width - icon.size.width) / 2.0f, (size.height - icon.size.height) / 2.0f)];
|
||||
// CGContextSetShadowWithColor(context, CGSizeZero, 0.0f, [UIColor clearColor].CGColor);
|
||||
// CGContextSetLineCap(context, kCGLineCapRound);
|
||||
// CGContextSetLineWidth(context, 1.75f);
|
||||
// CGContextMoveToPoint(context, insideInset + 8.0f, insideInset + 8.0f);
|
||||
// CGContextAddLineToPoint(context, size.width - insideInset - 8.0f, size.height - insideInset - 8.0f);
|
||||
// CGContextStrokePath(context);
|
||||
//
|
||||
// CGContextMoveToPoint(context, size.width - insideInset - 8.0f, insideInset + 8.0f);
|
||||
// CGContextAddLineToPoint(context, insideInset + 8.0f, size.height - insideInset - 8.0f);
|
||||
// CGContextStrokePath(context);
|
||||
|
||||
image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
_titleLabel.textColor = pallete.textColor;
|
||||
|
||||
_subtitleLabel.backgroundColor = [UIColor clearColor];
|
||||
_subtitleLabel.textColor = pallete.textColor;
|
||||
_subtitleLabel.textColor = pallete.secondaryTextColor;
|
||||
}
|
||||
|
||||
- (CGFloat)preferredHeightForWidth:(CGFloat)width screenHeight:(CGFloat)__unused screenHeight
|
||||
|
||||
@@ -809,6 +809,27 @@ typedef enum {
|
||||
return _textCheckingResults;
|
||||
}
|
||||
|
||||
NSString *legacyCaption = nil;
|
||||
NSArray *legacyTextCheckingResults = nil;
|
||||
for (id attachment in self.mediaAttachments) {
|
||||
if ([attachment isKindOfClass:[TGImageMediaAttachment class]]) {
|
||||
legacyCaption = ((TGImageMediaAttachment *)attachment).caption;
|
||||
if (legacyCaption.length > 0)
|
||||
legacyTextCheckingResults = ((TGImageMediaAttachment *)attachment).textCheckingResults;
|
||||
} else if ([attachment isKindOfClass:[TGVideoMediaAttachment class]]) {
|
||||
legacyCaption = ((TGVideoMediaAttachment *)attachment).caption;
|
||||
if (legacyCaption.length > 0)
|
||||
legacyTextCheckingResults = ((TGVideoMediaAttachment *)attachment).textCheckingResults;
|
||||
} else if ([attachment isKindOfClass:[TGDocumentMediaAttachment class]]) {
|
||||
legacyCaption = ((TGDocumentMediaAttachment *)attachment).caption;
|
||||
if (legacyCaption.length > 0)
|
||||
legacyTextCheckingResults = ((TGDocumentMediaAttachment *)attachment).textCheckingResults;
|
||||
}
|
||||
}
|
||||
|
||||
if (legacyTextCheckingResults.count > 0)
|
||||
return legacyTextCheckingResults;
|
||||
|
||||
if (_mediaAttachments.count != 0) {
|
||||
bool hasPhoneEntities = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user