BubbleRoomCellLayoutUpdater: Handle setup outgoing file attachment layout.

This commit is contained in:
SBiOSoftWhare
2022-01-21 18:21:05 +01:00
parent 355c7a32ee
commit e81f339698
@@ -99,6 +99,14 @@ class BubbleRoomCellLayoutUpdater: RoomCellLayoutUpdating {
cell.setNeedsUpdateConstraints()
}
func setupLayout(forOutgoingFileAttachmentCell cell: MXKRoomBubbleTableViewCell) {
// Hide avatar view
cell.pictureView?.isHidden = true
self.setupOutgoingFileAttachViewMargins(for: cell)
}
// MARK: Themable
func update(theme: Theme) {
@@ -310,4 +318,28 @@ class BubbleRoomCellLayoutUpdater: RoomCellLayoutUpdating {
cell.msgTextViewBottomConstraint.constant += bottomMargin
}
private func setupOutgoingFileAttachViewMargins(for cell: MXKRoomBubbleTableViewCell) {
guard let attachmentView = cell.attachmentView else {
return
}
let contentView = cell.contentView
// TODO: Use constants
// Same as URL preview
let rightMargin: CGFloat = 34.0
if let attachViewLeadingConstraint = cell.attachViewLeadingConstraint {
attachViewLeadingConstraint.isActive = false
cell.attachViewLeadingConstraint = nil
}
let rightConstraint = attachmentView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -rightMargin)
NSLayoutConstraint.activate([
rightConstraint
])
}
}