From bc9ff656595fea7dee69ec2f8a13190797afa83d Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Tue, 26 Apr 2022 16:42:03 +1000 Subject: [PATCH] fix for conversation screen title position with call button --- Session/Conversations/ConversationVC.swift | 3 ++- .../Views & Modals/ConversationTitleView.swift | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index 414cde53e..057f5e0b0 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -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 { diff --git a/Session/Conversations/Views & Modals/ConversationTitleView.swift b/Session/Conversations/Views & Modals/ConversationTitleView.swift index 83153c48d..d8ae3068b 100644 --- a/Session/Conversations/Views & Modals/ConversationTitleView.swift +++ b/Session/Conversations/Views & Modals/ConversationTitleView.swift @@ -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