|
@@ -15,7 +15,6 @@ public class BaseMessageCell: UITableViewCell {
|
|
private var mainContentViewLeadingConstraint: NSLayoutConstraint?
|
|
private var mainContentViewLeadingConstraint: NSLayoutConstraint?
|
|
private var mainContentViewTrailingConstraint: NSLayoutConstraint?
|
|
private var mainContentViewTrailingConstraint: NSLayoutConstraint?
|
|
private var fullMessageZeroHeightConstraint: NSLayoutConstraint?
|
|
private var fullMessageZeroHeightConstraint: NSLayoutConstraint?
|
|
- private var freshMessageSeparatorHeightConstraint: NSLayoutConstraint?
|
|
|
|
|
|
|
|
public var mainContentViewHorizontalPadding: CGFloat {
|
|
public var mainContentViewHorizontalPadding: CGFloat {
|
|
get {
|
|
get {
|
|
@@ -69,14 +68,6 @@ public class BaseMessageCell: UITableViewCell {
|
|
|
|
|
|
public weak var baseDelegate: BaseMessageCellDelegate?
|
|
public weak var baseDelegate: BaseMessageCellDelegate?
|
|
|
|
|
|
- public lazy var freshMessageSeparator: UIView = {
|
|
|
|
- let view = UIView()
|
|
|
|
- view.backgroundColor = DcColors.colorDisabled
|
|
|
|
- view.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
- view.isAccessibilityElement = false
|
|
|
|
- return view
|
|
|
|
- }()
|
|
|
|
-
|
|
|
|
public lazy var quoteView: QuoteView = {
|
|
public lazy var quoteView: QuoteView = {
|
|
let view = QuoteView()
|
|
let view = QuoteView()
|
|
view.translatesAutoresizingMaskIntoConstraints = false
|
|
view.translatesAutoresizingMaskIntoConstraints = false
|
|
@@ -188,7 +179,6 @@ public class BaseMessageCell: UITableViewCell {
|
|
|
|
|
|
func setupSubviews() {
|
|
func setupSubviews() {
|
|
selectedBackgroundView = UIView()
|
|
selectedBackgroundView = UIView()
|
|
- contentView.addSubview(freshMessageSeparator)
|
|
|
|
contentView.addSubview(messageBackgroundContainer)
|
|
contentView.addSubview(messageBackgroundContainer)
|
|
messageBackgroundContainer.addSubview(mainContentView)
|
|
messageBackgroundContainer.addSubview(mainContentView)
|
|
messageBackgroundContainer.addSubview(topLabel)
|
|
messageBackgroundContainer.addSubview(topLabel)
|
|
@@ -197,9 +187,6 @@ public class BaseMessageCell: UITableViewCell {
|
|
contentView.addSubview(avatarView)
|
|
contentView.addSubview(avatarView)
|
|
|
|
|
|
contentView.addConstraints([
|
|
contentView.addConstraints([
|
|
- freshMessageSeparator.constraintAlignLeadingTo(contentView),
|
|
|
|
- freshMessageSeparator.constraintAlignTrailingTo(contentView),
|
|
|
|
- freshMessageSeparator.constraintAlignTopTo(contentView),
|
|
|
|
avatarView.constraintAlignLeadingTo(contentView, paddingLeading: 2),
|
|
avatarView.constraintAlignLeadingTo(contentView, paddingLeading: 2),
|
|
avatarView.constraintAlignBottomTo(contentView),
|
|
avatarView.constraintAlignBottomTo(contentView),
|
|
avatarView.constraintWidthTo(28, priority: .defaultHigh),
|
|
avatarView.constraintWidthTo(28, priority: .defaultHigh),
|
|
@@ -207,7 +194,7 @@ public class BaseMessageCell: UITableViewCell {
|
|
topLabel.constraintAlignTopTo(messageBackgroundContainer, paddingTop: 6),
|
|
topLabel.constraintAlignTopTo(messageBackgroundContainer, paddingTop: 6),
|
|
topLabel.constraintAlignLeadingTo(messageBackgroundContainer, paddingLeading: 8),
|
|
topLabel.constraintAlignLeadingTo(messageBackgroundContainer, paddingLeading: 8),
|
|
topLabel.constraintAlignTrailingMaxTo(messageBackgroundContainer, paddingTrailing: 8),
|
|
topLabel.constraintAlignTrailingMaxTo(messageBackgroundContainer, paddingTrailing: 8),
|
|
- messageBackgroundContainer.constraintToBottomOf(freshMessageSeparator, paddingTop: 3),
|
|
|
|
|
|
+ messageBackgroundContainer.constraintAlignTopTo(contentView, paddingTop: 3),
|
|
messageBackgroundContainer.constraintAlignBottomTo(contentView, paddingBottom: 3),
|
|
messageBackgroundContainer.constraintAlignBottomTo(contentView, paddingBottom: 3),
|
|
fullMessageButton.constraintAlignLeadingTo(messageBackgroundContainer, paddingLeading: 12),
|
|
fullMessageButton.constraintAlignLeadingTo(messageBackgroundContainer, paddingLeading: 12),
|
|
fullMessageButton.constraintAlignTrailingMaxTo(messageBackgroundContainer, paddingTrailing: 12),
|
|
fullMessageButton.constraintAlignTrailingMaxTo(messageBackgroundContainer, paddingTrailing: 12),
|
|
@@ -217,9 +204,6 @@ public class BaseMessageCell: UITableViewCell {
|
|
bottomLabel.constraintAlignBottomTo(messageBackgroundContainer, paddingBottom: 6)
|
|
bottomLabel.constraintAlignBottomTo(messageBackgroundContainer, paddingBottom: 6)
|
|
])
|
|
])
|
|
|
|
|
|
- freshMessageSeparatorHeightConstraint = freshMessageSeparator.constraintHeightTo(0)
|
|
|
|
- freshMessageSeparatorHeightConstraint?.isActive = true
|
|
|
|
-
|
|
|
|
leadingConstraint = messageBackgroundContainer.constraintAlignLeadingTo(contentView, paddingLeading: 6)
|
|
leadingConstraint = messageBackgroundContainer.constraintAlignLeadingTo(contentView, paddingLeading: 6)
|
|
leadingConstraintGroup = messageBackgroundContainer.constraintToTrailingOf(avatarView, paddingLeading: 2)
|
|
leadingConstraintGroup = messageBackgroundContainer.constraintToTrailingOf(avatarView, paddingLeading: 2)
|
|
trailingConstraint = messageBackgroundContainer.constraintAlignTrailingMaxTo(contentView, paddingTrailing: 36)
|
|
trailingConstraint = messageBackgroundContainer.constraintAlignTrailingMaxTo(contentView, paddingTrailing: 36)
|
|
@@ -286,7 +270,7 @@ public class BaseMessageCell: UITableViewCell {
|
|
}
|
|
}
|
|
|
|
|
|
// update classes inheriting BaseMessageCell first before calling super.update(...)
|
|
// update classes inheriting BaseMessageCell first before calling super.update(...)
|
|
- func update(msg: DcMsg, messageStyle: UIRectCorner, showAvatar: Bool, showName: Bool, showSeparator: Bool) {
|
|
|
|
|
|
+ func update(msg: DcMsg, messageStyle: UIRectCorner, showAvatar: Bool, showName: Bool) {
|
|
if msg.isFromCurrentSender {
|
|
if msg.isFromCurrentSender {
|
|
topLabel.text = msg.isForwarded ? String.localized("forwarded_message") : nil
|
|
topLabel.text = msg.isForwarded ? String.localized("forwarded_message") : nil
|
|
topLabel.textColor = msg.isForwarded ? DcColors.grayDateColor : DcColors.defaultTextColor
|
|
topLabel.textColor = msg.isForwarded ? DcColors.grayDateColor : DcColors.defaultTextColor
|
|
@@ -324,8 +308,6 @@ public class BaseMessageCell: UITableViewCell {
|
|
avatarView.isHidden = true
|
|
avatarView.isHidden = true
|
|
}
|
|
}
|
|
|
|
|
|
- freshMessageSeparatorHeightConstraint?.constant = showSeparator ? 1 : 0
|
|
|
|
-
|
|
|
|
isFullMessageButtonHidden = !msg.hasHtml
|
|
isFullMessageButtonHidden = !msg.hasHtml
|
|
|
|
|
|
messageBackgroundContainer.update(rectCorners: messageStyle,
|
|
messageBackgroundContainer.update(rectCorners: messageStyle,
|