|
@@ -3,10 +3,10 @@ import UIKit
|
|
// A subclass of `MessageContentCell` used to display mixed media messages.
|
|
// A subclass of `MessageContentCell` used to display mixed media messages.
|
|
open class TextMediaMessageCell: MessageContentCell {
|
|
open class TextMediaMessageCell: MessageContentCell {
|
|
|
|
|
|
- public static let insetTop: CGFloat = 12
|
|
|
|
- public static let insetBottom: CGFloat = 12
|
|
|
|
- public static let insetHorizontalBig: CGFloat = 23
|
|
|
|
- public static let insetHorizontalSmall: CGFloat = 12
|
|
|
|
|
|
+ static let insetTop: CGFloat = 12
|
|
|
|
+ static let insetBottom: CGFloat = 12
|
|
|
|
+ static let insetHorizontalBig: CGFloat = 23
|
|
|
|
+ static let insetHorizontalSmall: CGFloat = 12
|
|
|
|
|
|
|
|
|
|
// MARK: - Properties
|
|
// MARK: - Properties
|
|
@@ -44,7 +44,7 @@ open class TextMediaMessageCell: MessageContentCell {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- func getMessageLabelHeight() -> CGFloat {
|
|
|
|
|
|
+ private func getMessageLabelHeight() -> CGFloat {
|
|
if let text = messageLabel.attributedText {
|
|
if let text = messageLabel.attributedText {
|
|
let height = (text.height(withConstrainedWidth:
|
|
let height = (text.height(withConstrainedWidth:
|
|
messageContainerView.frame.width -
|
|
messageContainerView.frame.width -
|
|
@@ -125,7 +125,7 @@ open class TextMediaMessageCell: MessageContentCell {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- func configurePlayButtonView(for messageKind: MessageKind) {
|
|
|
|
|
|
+ private func configurePlayButtonView(for messageKind: MessageKind) {
|
|
switch messageKind {
|
|
switch messageKind {
|
|
case .videoText:
|
|
case .videoText:
|
|
playButtonView.isHidden = false
|
|
playButtonView.isHidden = false
|
|
@@ -134,21 +134,22 @@ open class TextMediaMessageCell: MessageContentCell {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- func configureImageView(for mediaItem: MediaItem) {
|
|
|
|
|
|
+ private func configureImageView(for mediaItem: MediaItem) {
|
|
imageView.image = mediaItem.image ?? mediaItem.placeholderImage
|
|
imageView.image = mediaItem.image ?? mediaItem.placeholderImage
|
|
}
|
|
}
|
|
- func configureMessageLabel(for mediaItem: MediaItem,
|
|
|
|
- with displayDelegate: MessagesDisplayDelegate,
|
|
|
|
- message: MessageType,
|
|
|
|
- at indexPath: IndexPath,
|
|
|
|
- in messagesCollectionView: MessagesCollectionView) {
|
|
|
|
|
|
+
|
|
|
|
+ private func configureMessageLabel(for mediaItem: MediaItem,
|
|
|
|
+ with displayDelegate: MessagesDisplayDelegate,
|
|
|
|
+ message: MessageType,
|
|
|
|
+ at indexPath: IndexPath,
|
|
|
|
+ in messagesCollectionView: MessagesCollectionView) {
|
|
let enabledDetectors = displayDelegate.enabledDetectors(for: message, at: indexPath, in: messagesCollectionView)
|
|
let enabledDetectors = displayDelegate.enabledDetectors(for: message, at: indexPath, in: messagesCollectionView)
|
|
messageLabel.configure {
|
|
messageLabel.configure {
|
|
- messageLabel.enabledDetectors = enabledDetectors
|
|
|
|
- for detector in enabledDetectors {
|
|
|
|
- let attributes = displayDelegate.detectorAttributes(for: detector, and: message, at: indexPath)
|
|
|
|
- messageLabel.setAttributes(attributes, detector: detector)
|
|
|
|
- }
|
|
|
|
|
|
+ messageLabel.enabledDetectors = enabledDetectors
|
|
|
|
+ for detector in enabledDetectors {
|
|
|
|
+ let attributes = displayDelegate.detectorAttributes(for: detector, and: message, at: indexPath)
|
|
|
|
+ messageLabel.setAttributes(attributes, detector: detector)
|
|
|
|
+ }
|
|
messageLabel.attributedText = mediaItem.text?[MediaItemConstants.messageText]
|
|
messageLabel.attributedText = mediaItem.text?[MediaItemConstants.messageText]
|
|
}
|
|
}
|
|
}
|
|
}
|