diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m index bcb003e5e..79cbe3ab9 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m @@ -260,7 +260,7 @@ NS_ASSUME_NONNULL_BEGIN + (UIFont *)labelFont { - return [UIFont ows_regularFontWithSize:ScaleFromIPhone5To7Plus(11.f, 13.f)]; + return [UIFont ows_dynamicTypeCaption2Font]; } + (CGFloat)labelVSpacing diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m index 2e3323cec..ca6c04e97 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m @@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - -- (CGFloat)iconHMargin +- (CGFloat)hMargin { return 12.f; } @@ -143,11 +143,6 @@ NS_ASSUME_NONNULL_BEGIN return 10.f; } -- (UIColor *)bubbleBackgroundColor -{ - return self.isIncoming ? [UIColor ows_messageBubbleLightGrayColor] : [UIColor ows_materialBlueColor]; -} - + (UIFont *)nameFont { return [UIFont ows_dynamicTypeBodyFont]; @@ -175,18 +170,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)createContents { - self.backgroundColor = [UIColor colorWithRGBHex:0xefeff4]; self.layoutMargins = UIEdgeInsetsZero; - // TODO: Verify that this layout works in RTL. - const CGFloat kBubbleTailWidth = 6.f; - - UIView *contentView = [UIView containerView]; - [self addSubview:contentView]; - [contentView autoPinLeadingToSuperviewMarginWithInset:self.isIncoming ? kBubbleTailWidth : 0.f]; - [contentView autoPinTrailingToSuperviewMarginWithInset:self.isIncoming ? 0.f : kBubbleTailWidth]; - [contentView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:self.vMargin]; - AvatarImageView *avatarView = [AvatarImageView new]; avatarView.image = [self.contactShare getAvatarImageWithDiameter:self.iconSize contactsManager:self.contactsManager]; @@ -226,23 +211,23 @@ NS_ASSUME_NONNULL_BEGIN [disclosureImageView setCompressionResistanceHigh]; [disclosureImageView setContentHuggingHigh]; - UIStackView *stackView = [UIStackView new]; - stackView.axis = UILayoutConstraintAxisHorizontal; - stackView.spacing = self.iconHSpacing; - stackView.alignment = UIStackViewAlignmentCenter; - [contentView addSubview:stackView]; - [stackView autoPinLeadingToSuperviewMarginWithInset:self.iconHMargin]; - [stackView autoPinTrailingToSuperviewMarginWithInset:self.iconHMargin]; - [stackView autoVCenterInSuperview]; - // Ensure that the cell's contents never overflow the cell bounds. - // We pin to the superview _edge_ and not _margin_ for the purposes - // of overflow, so that changes to the margins do not trip these safe guards. - [stackView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:0 relation:NSLayoutRelationGreaterThanOrEqual]; - [stackView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:0 relation:NSLayoutRelationGreaterThanOrEqual]; - - [stackView addArrangedSubview:avatarView]; - [stackView addArrangedSubview:labelsView]; - [stackView addArrangedSubview:disclosureImageView]; + UIStackView *hStackView = [UIStackView new]; + hStackView.axis = UILayoutConstraintAxisHorizontal; + hStackView.spacing = self.iconHSpacing; + hStackView.alignment = UIStackViewAlignmentCenter; + hStackView.layoutMarginsRelativeArrangement = YES; + hStackView.layoutMargins = UIEdgeInsetsMake(self.vMargin, self.hMargin, self.vMargin, self.hMargin); + [hStackView addArrangedSubview:avatarView]; + [hStackView addArrangedSubview:labelsView]; + [hStackView addArrangedSubview:disclosureImageView]; + + UIStackView *vStackView = [UIStackView new]; + vStackView.axis = UILayoutConstraintAxisVertical; + vStackView.spacing = 0; + vStackView.alignment = UIStackViewAlignmentFill; + [self addSubview:vStackView]; + [vStackView autoPinToSuperviewEdges]; + [vStackView addArrangedSubview:hStackView]; if ([OWSContactShareView hasAnyButton:self.contactShare contactsManager:self.contactsManager]) { UILabel *label = [UILabel new]; @@ -261,13 +246,8 @@ NS_ASSUME_NONNULL_BEGIN label.textColor = UIColor.ows_materialBlueColor; label.textAlignment = NSTextAlignmentCenter; label.backgroundColor = [UIColor whiteColor]; - [self addSubview:label]; - [label autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:contentView withOffset:self.vMargin]; - [label autoPinWidthToSuperview]; - [label autoPinEdgeToSuperviewEdge:ALEdgeBottom]; + [vStackView addArrangedSubview:label]; [label autoSetDimension:ALDimensionHeight toSize:OWSContactShareView.buttonHeight]; - } else { - [contentView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:self.vMargin]; } } diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m index 0e44ce564..fbde10c75 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m @@ -135,7 +135,7 @@ NS_ASSUME_NONNULL_BEGIN topLabel.text = topText; topLabel.textColor = textColor; topLabel.lineBreakMode = NSLineBreakByTruncatingMiddle; - topLabel.font = [OWSGenericAttachmentView bottomLabelFont]; + topLabel.font = [OWSGenericAttachmentView topLabelFont]; [labelsView addArrangedSubview:topLabel]; NSError *error; @@ -153,12 +153,12 @@ NS_ASSUME_NONNULL_BEGIN + (UIFont *)topLabelFont { - return [UIFont ows_regularFontWithSize:ScaleFromIPhone5To7Plus(13.f, 15.f)]; + return [UIFont ows_dynamicTypeCaption1Font]; } + (UIFont *)bottomLabelFont { - return [UIFont ows_regularFontWithSize:ScaleFromIPhone5To7Plus(11.f, 13.f)]; + return [UIFont ows_dynamicTypeCaption2Font]; } + (CGFloat)labelVSpacing