fix for conversation screen title position with call button

pull/614/head
Ryan Zhao 3 years ago
parent 4da0ccdd44
commit bc9ff65659

@ -493,9 +493,10 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
}
}
else {
// Note: Adding an empty button because without it the title alignment is busted (Note: The size was
// Note: Adding 2 empty buttons because without it the title alignment is busted (Note: The size was
// taken from the layout inspector for the back button in Xcode
rightBarButtonItems.append(UIBarButtonItem(customView: UIView(frame: CGRect(x: 0, y: 0, width: Values.verySmallProfilePictureSize, height: 44))))
rightBarButtonItems.append(UIBarButtonItem(customView: UIView(frame: CGRect(x: 0, y: 0, width: 44, height: 44))))
}
}
else {

@ -50,6 +50,10 @@ final class ConversationTitleView : UIView {
private func initialize() {
addSubview(stackView)
stackView.pin(to: self)
let shouldShowCallButton = SessionCall.isEnabled && !thread.isNoteToSelf() && !thread.isGroupThread()
let leftMargin: CGFloat = shouldShowCallButton ? 54 : 8 // Contact threads also have the call button to compensate for
stackView.layoutMargins = UIEdgeInsets(top: 0, left: leftMargin, bottom: 0, right: 0)
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleTap))
addGestureRecognizer(tapGestureRecognizer)
let notificationCenter = NotificationCenter.default
@ -70,11 +74,6 @@ final class ConversationTitleView : UIView {
subtitleLabel.attributedText = subtitle
let titleFontSize = (subtitle != nil) ? Values.mediumFontSize : Values.veryLargeFontSize
titleLabel.font = .boldSystemFont(ofSize: titleFontSize)
// Update title left margin
let shouldShowCallButton = SessionCall.isEnabled && !thread.isNoteToSelf() && !thread.isGroupThread() && !thread.isMessageRequest()
let leftMargin: CGFloat = shouldShowCallButton ? 54 : 8 // Contact threads also have the call button to compensate for
stackView.layoutMargins = UIEdgeInsets(top: 0, left: leftMargin, bottom: 0, right: 0)
}
// MARK: General

Loading…
Cancel
Save