|
|
@ -166,6 +166,8 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate {
|
|
|
|
return result
|
|
|
|
return result
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal lazy var messageStatusLabelPaddingView: UIView = UIView()
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: - Settings
|
|
|
|
// MARK: - Settings
|
|
|
|
|
|
|
|
|
|
|
|
private static let messageStatusImageViewSize: CGFloat = 12
|
|
|
|
private static let messageStatusImageViewSize: CGFloat = 12
|
|
|
@ -252,6 +254,7 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate {
|
|
|
|
|
|
|
|
|
|
|
|
underBubbleStackView.addArrangedSubview(reactionContainerView)
|
|
|
|
underBubbleStackView.addArrangedSubview(reactionContainerView)
|
|
|
|
underBubbleStackView.addArrangedSubview(messageStatusContainerView)
|
|
|
|
underBubbleStackView.addArrangedSubview(messageStatusContainerView)
|
|
|
|
|
|
|
|
underBubbleStackView.addArrangedSubview(messageStatusLabelPaddingView)
|
|
|
|
|
|
|
|
|
|
|
|
messageStatusContainerView.addSubview(messageStatusLabel)
|
|
|
|
messageStatusContainerView.addSubview(messageStatusLabel)
|
|
|
|
messageStatusContainerView.addSubview(messageStatusImageView)
|
|
|
|
messageStatusContainerView.addSubview(messageStatusImageView)
|
|
|
@ -267,6 +270,8 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate {
|
|
|
|
messageStatusLabel.center(.vertical, in: messageStatusContainerView)
|
|
|
|
messageStatusLabel.center(.vertical, in: messageStatusContainerView)
|
|
|
|
messageStatusLabel.pin(.leading, to: .leading, of: messageStatusContainerView)
|
|
|
|
messageStatusLabel.pin(.leading, to: .leading, of: messageStatusContainerView)
|
|
|
|
messageStatusLabel.pin(.trailing, to: .leading, of: messageStatusImageView, withInset: -2)
|
|
|
|
messageStatusLabel.pin(.trailing, to: .leading, of: messageStatusImageView, withInset: -2)
|
|
|
|
|
|
|
|
messageStatusLabelPaddingView.pin(.leading, to: .leading, of: messageStatusContainerView)
|
|
|
|
|
|
|
|
messageStatusLabelPaddingView.pin(.trailing, to: .trailing, of: messageStatusContainerView)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
override func setUpGestureRecognizers() {
|
|
|
|
override func setUpGestureRecognizers() {
|
|
|
@ -429,6 +434,10 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate {
|
|
|
|
!cellViewModel.isLast
|
|
|
|
!cellViewModel.isLast
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
messageStatusLabelPaddingView.isHidden = (
|
|
|
|
|
|
|
|
messageStatusContainerView.isHidden ||
|
|
|
|
|
|
|
|
cellViewModel.isLast
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Set the height of the underBubbleStackView to 0 if it has no content (need to do this
|
|
|
|
// Set the height of the underBubbleStackView to 0 if it has no content (need to do this
|
|
|
|
// otherwise it can randomly stretch)
|
|
|
|
// otherwise it can randomly stretch)
|
|
|
@ -1121,11 +1130,15 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate {
|
|
|
|
return [:]
|
|
|
|
return [:]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Note: The 'String.count' value is based on actual character counts whereas
|
|
|
|
|
|
|
|
// NSAttributedString and NSRange are both based on UTF-16 encoded lengths, so
|
|
|
|
|
|
|
|
// in order to avoid strings which contain emojis breaking strings which end
|
|
|
|
|
|
|
|
// with URLs we need to use the 'String.utf16.count' value when creating the range
|
|
|
|
return detector
|
|
|
|
return detector
|
|
|
|
.matches(
|
|
|
|
.matches(
|
|
|
|
in: attributedText.string,
|
|
|
|
in: attributedText.string,
|
|
|
|
options: [],
|
|
|
|
options: [],
|
|
|
|
range: NSRange(location: 0, length: attributedText.string.count)
|
|
|
|
range: NSRange(location: 0, length: attributedText.string.utf16.count)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.reduce(into: [:]) { result, match in
|
|
|
|
.reduce(into: [:]) { result, match in
|
|
|
|
guard
|
|
|
|
guard
|
|
|
|