diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m index 8e0128072..b55d28df0 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m @@ -117,12 +117,15 @@ NS_ASSUME_NONNULL_BEGIN + (CGFloat)contentHeight { - return self.iconSize + self.iconVMargin * 2; + CGFloat labelsHeight = (self.nameFont.lineHeight + self.labelsVSpacing + self.subtitleFont.lineHeight); + CGFloat contentHeight = MAX(self.iconSize, labelsHeight); + contentHeight += self.iconVMargin * 2; + return contentHeight; } + (CGFloat)buttonHeight { - return 44.f; + return MAX(44.f, self.buttonFont.lineHeight + self.buttonVMargin * 2); } + (CGFloat)iconSize @@ -145,6 +148,31 @@ NS_ASSUME_NONNULL_BEGIN return self.isIncoming ? [UIColor jsq_messageBubbleLightGrayColor] : [UIColor ows_materialBlueColor]; } ++ (UIFont *)nameFont +{ + return [UIFont ows_dynamicTypeBodyFont]; +} + ++ (UIFont *)subtitleFont +{ + return [UIFont ows_dynamicTypeCaption1Font]; +} + ++ (CGFloat)labelsVSpacing +{ + return 2; +} + ++ (UIFont *)buttonFont +{ + return [UIFont ows_dynamicTypeBodyFont]; +} + ++ (CGFloat)buttonVMargin +{ + return 5; +} + - (void)createContents { self.backgroundColor = [UIColor colorWithRGBHex:0xefeff4]; @@ -172,11 +200,11 @@ NS_ASSUME_NONNULL_BEGIN topLabel.text = self.contactShare.displayName; topLabel.textColor = [UIColor blackColor]; topLabel.lineBreakMode = NSLineBreakByTruncatingTail; - topLabel.font = [UIFont ows_dynamicTypeBodyFont]; + topLabel.font = OWSContactShareView.nameFont; UIStackView *labelsView = [UIStackView new]; labelsView.axis = UILayoutConstraintAxisVertical; - labelsView.spacing = 2; + labelsView.spacing = OWSContactShareView.labelsVSpacing; [labelsView addArrangedSubview:topLabel]; NSString *_Nullable firstPhoneNumber = @@ -186,7 +214,7 @@ NS_ASSUME_NONNULL_BEGIN bottomLabel.text = [PhoneNumber bestEffortLocalizedPhoneNumberWithE164:firstPhoneNumber]; bottomLabel.textColor = [UIColor ows_darkGrayColor]; bottomLabel.lineBreakMode = NSLineBreakByTruncatingTail; - bottomLabel.font = [UIFont ows_dynamicTypeCaption1Font]; + bottomLabel.font = OWSContactShareView.subtitleFont; [labelsView addArrangedSubview:bottomLabel]; } @@ -230,7 +258,7 @@ NS_ASSUME_NONNULL_BEGIN } else { OWSFail(@"%@ unexpected button state.", self.logTag); } - label.font = [UIFont ows_dynamicTypeBodyFont]; + label.font = OWSContactShareView.buttonFont; label.textColor = UIColor.ows_materialBlueColor; label.textAlignment = NSTextAlignmentCenter; label.backgroundColor = [UIColor whiteColor]; diff --git a/SignalMessaging/attachments/EditContactShareNameViewController.swift b/SignalMessaging/attachments/EditContactShareNameViewController.swift index edf6db9fe..732ca6068 100644 --- a/SignalMessaging/attachments/EditContactShareNameViewController.swift +++ b/SignalMessaging/attachments/EditContactShareNameViewController.swift @@ -42,9 +42,11 @@ class ContactNameFieldView: UIView { createContents() } + private let hMargin = CGFloat(16) + private let vMargin = CGFloat(10) + func createContents() { - let vMargin = CGFloat(10) - self.layoutMargins = UIEdgeInsets(top: vMargin, left: 0, bottom: vMargin, right: 0) + self.layoutMargins = UIEdgeInsets(top: vMargin, left: hMargin, bottom: vMargin, right: hMargin) let stackView = UIStackView() stackView.axis = .horizontal