From 32790a9d997927d249ea0704f7c0c19ae058c551 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Wed, 17 Nov 2021 17:02:13 +1100 Subject: [PATCH] fix title view position --- Session/Conversations/ConversationVC.swift | 3 ++- .../Conversations/Views & Modals/ConversationTitleView.swift | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index 5c7a92cc0..c17e7150b 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -309,7 +309,8 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat settingsButton.accessibilityLabel = "Settings button" settingsButton.isAccessibilityElement = true rightBarButtonItems.append(settingsButton) - if !thread.isNoteToSelf() && (SSKPreferences.areCallsEnabled || !UserDefaults.standard[.hasSeenCallIPExposureWarning]) { + let shouldShowCallButton = !thread.isNoteToSelf() && (SSKPreferences.areCallsEnabled || !UserDefaults.standard[.hasSeenCallIPExposureWarning]) + if shouldShowCallButton { let callButton = UIBarButtonItem(image: UIImage(named: "Phone")!, style: .plain, target: self, action: #selector(startCall)) rightBarButtonItems.append(callButton) } diff --git a/Session/Conversations/Views & Modals/ConversationTitleView.swift b/Session/Conversations/Views & Modals/ConversationTitleView.swift index 0d744f16c..724737704 100644 --- a/Session/Conversations/Views & Modals/ConversationTitleView.swift +++ b/Session/Conversations/Views & Modals/ConversationTitleView.swift @@ -44,7 +44,8 @@ final class ConversationTitleView : UIView { stackView.axis = .vertical stackView.alignment = .center stackView.isLayoutMarginsRelativeArrangement = true - let leftMargin: CGFloat = (thread is TSContactThread) ? 54 : 8 // Contact threads also have the call button to compensate for + let shouldShowCallButton = !thread.isNoteToSelf() && (SSKPreferences.areCallsEnabled || !UserDefaults.standard[.hasSeenCallIPExposureWarning]) + 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) addSubview(stackView) stackView.pin(to: self)