mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'charlesmchen/fixAudioAndGenericMessageLayout'
This commit is contained in:
commit
688f77b7dc
|
@ -223,7 +223,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
UIView *labelsView = [UIView containerView];
|
||||
[contentView addSubview:labelsView];
|
||||
[labelsView autoPinLeadingToTrailingOfView:self.audioPlayPauseButton margin:kLabelHSpacing];
|
||||
[labelsView autoPinEdgeToSuperviewEdge:ALEdgeRight];
|
||||
[labelsView autoPinTrailingToSuperviewWithMargin:self.audioIconHMargin];
|
||||
[labelsView autoVCenterInSuperview];
|
||||
|
||||
const CGFloat kLabelVSpacing = 2;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#import "OWSGenericAttachmentView.h"
|
||||
#import "NSString+OWS.h"
|
||||
#import "OWSBezierPathView.h"
|
||||
#import "UIColor+JSQMessages.h"
|
||||
#import "UIColor+OWS.h"
|
||||
#import "UIFont+OWS.h"
|
||||
|
@ -116,25 +117,35 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[contentView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:self.vMargin];
|
||||
[contentView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:self.vMargin];
|
||||
|
||||
OWSBezierPathView *iconCircleView = [OWSBezierPathView new];
|
||||
UIColor *iconColor
|
||||
= (self.isIncoming ? [UIColor colorWithRGBHex:0x9e9e9e] : [self foregroundColorWithOpacity:0.15f]);
|
||||
iconCircleView.configureShapeLayerBlock = ^(CAShapeLayer *_Nonnull layer, CGRect bounds) {
|
||||
layer.path = [UIBezierPath bezierPathWithOvalInRect:bounds].CGPath;
|
||||
layer.fillColor = iconColor.CGColor;
|
||||
};
|
||||
[contentView addSubview:iconCircleView];
|
||||
[iconCircleView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:self.iconHMargin];
|
||||
[iconCircleView autoVCenterInSuperview];
|
||||
[iconCircleView autoSetDimension:ALDimensionWidth toSize:self.iconSize];
|
||||
[iconCircleView autoSetDimension:ALDimensionHeight toSize:self.iconSize];
|
||||
|
||||
UIImage *image = [UIImage imageNamed:@"generic-attachment-small"];
|
||||
OWSAssert(image);
|
||||
UIImageView *imageView = [UIImageView new];
|
||||
imageView.image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
imageView.tintColor = self.bubbleBackgroundColor;
|
||||
imageView.backgroundColor
|
||||
= (self.isIncoming ? [UIColor colorWithRGBHex:0x9e9e9e] : [self foregroundColorWithOpacity:0.15f]);
|
||||
imageView.layer.cornerRadius = MIN(imageView.bounds.size.width, imageView.bounds.size.height) * 0.5f;
|
||||
[contentView addSubview:imageView];
|
||||
[imageView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:self.iconHMargin];
|
||||
[imageView autoVCenterInSuperview];
|
||||
[imageView autoSetDimension:ALDimensionWidth toSize:self.iconSize];
|
||||
[imageView autoSetDimension:ALDimensionHeight toSize:self.iconSize];
|
||||
[imageView autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:iconCircleView];
|
||||
[imageView autoPinEdge:ALEdgeRight toEdge:ALEdgeRight ofView:iconCircleView];
|
||||
[imageView autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:iconCircleView];
|
||||
[imageView autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:iconCircleView];
|
||||
|
||||
const CGFloat kLabelHSpacing = self.iconHSpacing;
|
||||
UIView *labelsView = [UIView containerView];
|
||||
[contentView addSubview:labelsView];
|
||||
[labelsView autoPinLeadingToTrailingOfView:imageView margin:kLabelHSpacing];
|
||||
[labelsView autoPinEdgeToSuperviewEdge:ALEdgeRight];
|
||||
[labelsView autoPinTrailingToSuperviewWithMargin:self.iconHMargin];
|
||||
[labelsView autoVCenterInSuperview];
|
||||
|
||||
NSString *filename = self.attachmentStream.sourceFilename;
|
||||
|
@ -152,15 +163,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
UILabel *fileTypeLabel = [UILabel new];
|
||||
fileTypeLabel.text = fileExtension.uppercaseString;
|
||||
fileTypeLabel.textColor = imageView.backgroundColor;
|
||||
fileTypeLabel.textColor = iconColor;
|
||||
fileTypeLabel.lineBreakMode = NSLineBreakByTruncatingTail;
|
||||
fileTypeLabel.font = [UIFont ows_mediumFontWithSize:20.f];
|
||||
fileTypeLabel.adjustsFontSizeToFitWidth = YES;
|
||||
fileTypeLabel.textAlignment = NSTextAlignmentCenter;
|
||||
// Center on icon.
|
||||
[imageView addSubview:fileTypeLabel];
|
||||
[imageView autoCenterInSuperview];
|
||||
[imageView autoSetDimension:ALDimensionWidth toSize:15.f];
|
||||
[fileTypeLabel autoCenterInSuperview];
|
||||
[fileTypeLabel autoSetDimension:ALDimensionWidth toSize:15.f];
|
||||
|
||||
const CGFloat kLabelVSpacing = 2;
|
||||
NSString *topText = [self.attachmentStream.sourceFilename ows_stripped];
|
||||
|
|
Loading…
Reference in a new issue