From ba0ef1678e2c3a657bfaa06e7044f4b0b4368cbe Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Sun, 17 Sep 2017 19:15:30 -0500 Subject: [PATCH] Set MessageCellDelegate and fix broken gestures --- Sources/MessageCollectionViewCell.swift | 6 +++++- Sources/TextMessageCell.swift | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/MessageCollectionViewCell.swift b/Sources/MessageCollectionViewCell.swift index 78f38b4e..a23c1d74 100644 --- a/Sources/MessageCollectionViewCell.swift +++ b/Sources/MessageCollectionViewCell.swift @@ -112,7 +112,10 @@ open class MessageCollectionViewCell: UICollectionViewCell public func configure(with message: MessageType, at indexPath: IndexPath, and messagesCollectionView: MessagesCollectionView) { - // TODO: - fix delegate + // Check if delegate has already been set to reduce number of assignments + if delegate == nil, let cellDelegate = messagesCollectionView.messageCellDelegate { + delegate = cellDelegate + } if let displayDelegate = messagesCollectionView.messagesDisplayDelegate { @@ -146,6 +149,7 @@ open class MessageCollectionViewCell: UICollectionViewCell let messageTapGesture = UITapGestureRecognizer(target: self, action: #selector(didTapMessage)) messageContainerView.addGestureRecognizer(messageTapGesture) + messageContainerView.isUserInteractionEnabled = true self.messageTapGesture = messageTapGesture let topLabelTapGesture = UITapGestureRecognizer(target: self, action: #selector(didTapTopLabel)) diff --git a/Sources/TextMessageCell.swift b/Sources/TextMessageCell.swift index a42dbc59..18e0aa63 100644 --- a/Sources/TextMessageCell.swift +++ b/Sources/TextMessageCell.swift @@ -30,7 +30,6 @@ open class TextMessageCell: MessageCollectionViewCell { override open weak var delegate: MessageCellDelegate? { didSet { - print("Fix this never gets set") messageContentView.delegate = delegate } }