Merge branch 'charlesmchen/moreTweaks'

pull/1/head
Matthew Chen 7 years ago
commit 92515bdd1d

@ -161,12 +161,12 @@ NS_ASSUME_NONNULL_BEGIN
+ (UIFont *)topLabelFont
{
return [UIFont ows_dynamicTypeCaption1Font];
return [UIFont ows_dynamicTypeBodyFont];
}
+ (UIFont *)bottomLabelFont
{
return [UIFont ows_dynamicTypeCaption2Font];
return [UIFont ows_dynamicTypeCaption1Font];
}
+ (CGFloat)labelVSpacing

@ -372,15 +372,15 @@ NS_ASSUME_NONNULL_BEGIN
// TODO: Consider only using a single shadow for perf.
shadowView1.fillColor = self.bubbleColor;
shadowView1.layer.shadowColor = [UIColor blackColor].CGColor;
shadowView1.layer.shadowOpacity = 0.2f;
shadowView1.layer.shadowOpacity = 0.08f;
shadowView1.layer.shadowOffset = CGSizeMake(0.f, 4.f);
shadowView1.layer.shadowRadius = 20.f;
shadowView1.layer.shadowRadius = 12.f;
shadowView2.fillColor = self.bubbleColor;
shadowView2.layer.shadowColor = [UIColor blackColor].CGColor;
shadowView2.layer.shadowOpacity = 0.08f;
shadowView2.layer.shadowOpacity = 0.12f;
shadowView2.layer.shadowOffset = CGSizeZero;
shadowView2.layer.shadowRadius = 4.f;
shadowView2.layer.shadowRadius = 1.f;
} else {
OWSAssert(self.cellType == OWSMessageCellType_ContactShare);
@ -431,7 +431,7 @@ NS_ASSUME_NONNULL_BEGIN
} else if (shouldFooterOverlayMedia) {
OWSAssert(bodyMediaView);
CGFloat maxGradientHeight = 48.f;
CGFloat maxGradientHeight = 40.f;
CAGradientLayer *gradientLayer = [CAGradientLayer new];
gradientLayer.colors = @[
(id)[UIColor colorWithWhite:0.f alpha:0.f].CGColor,
@ -1038,10 +1038,7 @@ NS_ASSUME_NONNULL_BEGIN
UIView *wrapper = [UIView new];
[wrapper addSubview:downloadView];
[downloadView autoPinWidthToSuperview];
[downloadView autoVCenterInSuperview];
[downloadView autoPinEdgeToSuperviewMargin:ALEdgeTop relation:NSLayoutRelationGreaterThanOrEqual];
[downloadView autoPinEdgeToSuperviewMargin:ALEdgeBottom relation:NSLayoutRelationGreaterThanOrEqual];
[downloadView autoPinEdgesToSuperviewEdges];
self.loadCellContentBlock = ^{
// Do nothing.
@ -1200,7 +1197,7 @@ NS_ASSUME_NONNULL_BEGIN
break;
}
case OWSMessageCellType_DownloadingAttachment:
result = CGSizeMake(200, [AttachmentPointerView measureHeight]);
result = CGSizeMake(MIN(200, maxMessageWidth), [AttachmentPointerView measureHeight]);
break;
case OWSMessageCellType_ContactShare:
OWSAssert(self.viewItem.contactShare);
@ -1209,6 +1206,9 @@ NS_ASSUME_NONNULL_BEGIN
break;
}
OWSAssert(result.width <= maxMessageWidth);
result.width = MIN(result.width, maxMessageWidth);
return [NSValue valueWithCGSize:CGSizeCeil(result)];
}

@ -210,16 +210,12 @@ NS_ASSUME_NONNULL_BEGIN
}
if ([self updateAvatarView]) {
CGFloat avatarBottomMargin = round(self.conversationStyle.lastTextLineAxis - self.avatarSize * 0.5f);
[self.viewConstraints addObjectsFromArray:@[
// V-align the "group sender" avatar with the
// last line of the text (if any, or where it
// would be).
[self.messageBubbleView autoPinLeadingToTrailingEdgeOfView:self.avatarView offset:8],
[self.messageBubbleView autoPinEdge:ALEdgeBottom
toEdge:ALEdgeBottom
ofView:self.avatarView
withOffset:avatarBottomMargin],
[self.messageBubbleView autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:self.avatarView],
]];
}
}

@ -252,7 +252,7 @@ typedef void (^SystemMessageActionBlock)(void);
break;
}
} else if ([interaction isKindOfClass:[TSCall class]]) {
return nil;
result = [UIImage imageNamed:@"system_message_call"];
} else {
OWSFail(@"Unknown interaction type: %@", [interaction class]);
return nil;

@ -254,7 +254,7 @@ NS_ASSUME_NONNULL_BEGIN
[NSLayoutConstraint autoSetPriority:UILayoutPriorityDefaultHigh
forConstraints:^{
// This is a bit arbitrary, but it should scale with the size of dynamic text
CGFloat minMargin = CeilEven(unreadBadgeHeight * .5);
CGFloat minMargin = CeilEven(unreadBadgeHeight * .5f);
// Spec check. Should be 12pts (6pt on each side) when using default font size.
OWSAssert(UIFont.ows_dynamicTypeBodyFont.pointSize != 17 || minMargin == 12);
@ -273,7 +273,7 @@ NS_ASSUME_NONNULL_BEGIN
}];
} else {
UIImage *_Nullable statusIndicatorImage = nil;
UIColor *messageStatusViewTintColor = textColor;
UIColor *messageStatusViewTintColor = [UIColor ows_light35Color];
BOOL shouldAnimateStatusIcon = NO;
if ([self.thread.lastMessageForInbox isKindOfClass:[TSOutgoingMessage class]]) {
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)self.thread.lastMessageForInbox;

@ -81,21 +81,26 @@ class AttachmentPointerView: UIStackView {
}
private static var vSpacing: CGFloat = 5
private static var nameFont = UIFont.ows_dynamicTypeBody
private static var statusFont = UIFont.ows_dynamicTypeCaption1
private class func nameFont() -> UIFont { return UIFont.ows_dynamicTypeBody }
private class func statusFont() -> UIFont { return UIFont.ows_dynamicTypeCaption1 }
private static var progressWidth: CGFloat = 80
private static var progressHeight: CGFloat = 6
func createSubviews() {
progressView.autoSetDimension(.width, toSize: AttachmentPointerView.progressWidth)
progressView.autoSetDimension(.height, toSize: AttachmentPointerView.progressHeight)
// truncate middle to be sure we include file extension
nameLabel.lineBreakMode = .byTruncatingMiddle
nameLabel.textAlignment = .center
nameLabel.textColor = self.textColor
nameLabel.font = AttachmentPointerView.nameFont
nameLabel.font = AttachmentPointerView.nameFont()
statusLabel.textAlignment = .center
statusLabel.adjustsFontSizeToFitWidth = true
statusLabel.numberOfLines = 2
statusLabel.textColor = self.textColor
statusLabel.font = AttachmentPointerView.statusFont
statusLabel.font = AttachmentPointerView.statusFont()
self.axis = .vertical
self.spacing = AttachmentPointerView.vSpacing
@ -115,7 +120,7 @@ class AttachmentPointerView: UIStackView {
case .downloading:
return NSLocalizedString("ATTACHMENT_DOWNLOADING_STATUS_IN_PROGRESS", comment: "Status label when an attachment is currently downloading")
case .failed:
return self.attachmentPointer.mostRecentFailureLocalizedText ?? NSLocalizedString("ATTACHMENT_DOWNLOADING_STATUS_FAILED", comment: "Status label when an attachment download has failed.")
return NSLocalizedString("ATTACHMENT_DOWNLOADING_STATUS_FAILED", comment: "Status label when an attachment download has failed.")
}
}()
@ -134,9 +139,9 @@ class AttachmentPointerView: UIStackView {
@objc
public class func measureHeight() -> CGFloat {
return ceil(nameFont.lineHeight +
statusFont.lineHeight +
OWSProgressView.defaultSize().height +
return ceil(nameFont().lineHeight +
statusFont().lineHeight +
progressHeight +
vSpacing * 2)
}
}

@ -81,10 +81,10 @@ public class ConversationStyle: NSObject {
public func updateProperties() {
if thread.isGroupThread() {
gutterLeading = 52
gutterTrailing = 20
gutterTrailing = 16
} else {
gutterLeading = 16
gutterTrailing = 20
gutterTrailing = 16
}
fullWidthGutterLeading = 16
fullWidthGutterTrailing = 16
@ -94,7 +94,7 @@ public class ConversationStyle: NSObject {
fullWidthContentWidth = viewWidth - (fullWidthGutterLeading + fullWidthGutterTrailing)
maxMessageWidth = floor(contentWidth - 48)
maxMessageWidth = floor(contentWidth - 32)
let messageTextFont = UIFont.ows_dynamicTypeBody

Loading…
Cancel
Save