mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
BubbleRoomCellLayoutUpdater: Handle setup outgoing file attachment layout.
This commit is contained in:
parent
69de97e885
commit
ce6f9c0bae
1 changed files with 32 additions and 0 deletions
|
@ -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
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue