diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index affa11717..387485033 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -2,8 +2,13 @@ import CoreServices import Photos extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuActionDelegate, ScrollToBottomButtonDelegate, - SendMediaNavDelegate, UIDocumentPickerDelegate, AttachmentApprovalViewControllerDelegate, GifPickerViewControllerDelegate { + SendMediaNavDelegate, UIDocumentPickerDelegate, AttachmentApprovalViewControllerDelegate, GifPickerViewControllerDelegate, + ConversationTitleViewDelegate { + func handleTitleViewTapped() { + openSettings() + } + @objc func openSettings() { let settingsVC = OWSConversationSettingsViewController() settingsVC.configure(with: thread, uiDatabaseConnection: OWSPrimaryStorage.shared().uiDatabaseConnection) diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index d9342b5fe..43db26239 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -73,7 +73,11 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat }() // MARK: UI Components - lazy var titleView = ConversationTitleView(thread: thread) + lazy var titleView: ConversationTitleView = { + let result = ConversationTitleView(thread: thread) + result.delegate = self + return result + }() lazy var messagesTableView: MessagesTableView = { let result = MessagesTableView() diff --git a/Session/Conversations/Views & Modals/ConversationTitleView.swift b/Session/Conversations/Views & Modals/ConversationTitleView.swift index 20515b8a5..19392cef5 100644 --- a/Session/Conversations/Views & Modals/ConversationTitleView.swift +++ b/Session/Conversations/Views & Modals/ConversationTitleView.swift @@ -1,6 +1,7 @@ final class ConversationTitleView : UIView { private let thread: TSThread + var delegate: ConversationTitleViewDelegate? override var intrinsicContentSize: CGSize { return UIView.layoutFittingExpandedSize @@ -46,6 +47,8 @@ final class ConversationTitleView : UIView { stackView.layoutMargins = UIEdgeInsets(top: 0, left: 8, bottom: 0, right: 0) addSubview(stackView) stackView.pin(to: self) + let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleTap)) + addGestureRecognizer(tapGestureRecognizer) let notificationCenter = NotificationCenter.default notificationCenter.addObserver(self, selector: #selector(update), name: Notification.Name.groupThreadUpdated, object: nil) notificationCenter.addObserver(self, selector: #selector(update), name: Notification.Name.muteSettingUpdated, object: nil) @@ -108,4 +111,15 @@ final class ConversationTitleView : UIView { } return nil } + + // MARK: Interaction + @objc private func handleTap() { + delegate?.handleTitleViewTapped() + } +} + +// MARK: Delegate +protocol ConversationTitleViewDelegate { + + func handleTitleViewTapped() }