Make conversation title tappable
This commit is contained in:
parent
331bff2919
commit
57eb5f8ef4
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue