diff --git a/Riot/Modules/Room/Views/BubbleCells/RoomBubbleCellLayout.swift b/Riot/Modules/Room/Views/BubbleCells/RoomBubbleCellLayout.swift index 641bc0677..46ba7e618 100644 --- a/Riot/Modules/Room/Views/BubbleCells/RoomBubbleCellLayout.swift +++ b/Riot/Modules/Room/Views/BubbleCells/RoomBubbleCellLayout.swift @@ -20,6 +20,9 @@ import Foundation @objcMembers final class RoomBubbleCellLayout: NSObject { + /// Inner content view margins + static let innerContentViewMargins: UIEdgeInsets = UIEdgeInsets(top: 0, left: 57, bottom: 0.0, right: 0) + // Reactions static let reactionsViewTopMargin: CGFloat = 1.0 diff --git a/Riot/Modules/Room/Views/BubbleCells/Styles/Bubble/BubbleRoomCellLayoutUpdater.swift b/Riot/Modules/Room/Views/BubbleCells/Styles/Bubble/BubbleRoomCellLayoutUpdater.swift index 4cd22c10b..f619471f7 100644 --- a/Riot/Modules/Room/Views/BubbleCells/Styles/Bubble/BubbleRoomCellLayoutUpdater.swift +++ b/Riot/Modules/Room/Views/BubbleCells/Styles/Bubble/BubbleRoomCellLayoutUpdater.swift @@ -152,11 +152,10 @@ class BubbleRoomCellLayoutUpdater: RoomCellLayoutUpdating { private func getIncomingMessageTextViewInsets(from bubbleCell: MXKRoomBubbleTableViewCell) -> UIEdgeInsets { - let bubbleBgRightMargin: CGFloat = 45 let messageViewMarginTop: CGFloat = 0 - let messageViewMarginBottom: CGFloat = -0 + let messageViewMarginBottom: CGFloat = 0 let messageViewMarginLeft: CGFloat = 0 - let messageViewMarginRight: CGFloat = 80 + bubbleBgRightMargin + let messageViewMarginRight: CGFloat = BubbleRoomCellLayoutConstants.incomingBubbleBackgroundMargins.right + BubbleRoomCellLayoutConstants.bubbleTextViewInsets.right let messageViewInsets = UIEdgeInsets(top: messageViewMarginTop, left: messageViewMarginLeft, bottom: messageViewMarginBottom, right: messageViewMarginRight) @@ -180,13 +179,12 @@ class BubbleRoomCellLayoutUpdater: RoomCellLayoutUpdating { } private func getOutgoingMessageTextViewMargins(from bubbleCell: MXKRoomBubbleTableViewCell) -> UIEdgeInsets { - - let innerContentLeftMargin: CGFloat = 57 let messageViewMarginTop: CGFloat = 0 let messageViewMarginBottom: CGFloat = 0 - let messageViewMarginLeft: CGFloat = 80.0 + innerContentLeftMargin - let messageViewMarginRight: CGFloat = 78.0 + let messageViewMarginLeft = + BubbleRoomCellLayoutConstants.outgoingBubbleBackgroundMargins.left + RoomBubbleCellLayout.innerContentViewMargins.left + let messageViewMarginRight = BubbleRoomCellLayoutConstants.outgoingBubbleBackgroundMargins.right + BubbleRoomCellLayoutConstants.bubbleTextViewInsets.right let messageViewInsets = UIEdgeInsets(top: messageViewMarginTop, left: messageViewMarginLeft, bottom: messageViewMarginBottom, right: messageViewMarginRight) @@ -230,10 +228,8 @@ class BubbleRoomCellLayoutUpdater: RoomCellLayoutUpdating { } let contentView = cell.contentView - - // TODO: Use constants - // Same as URL preview - let rightMargin: CGFloat = 34.0 + + let rightMargin = BubbleRoomCellLayoutConstants.outgoingBubbleBackgroundMargins.right if let attachViewLeadingConstraint = cell.attachViewLeadingConstraint { attachViewLeadingConstraint.isActive = false @@ -263,8 +259,7 @@ class BubbleRoomCellLayoutUpdater: RoomCellLayoutUpdating { let contentView = cell.contentView - // TODO: Use constants - let leftMargin: CGFloat = 67 + let leftMargin: CGFloat = BubbleRoomCellLayoutConstants.incomingBubbleBackgroundMargins.left let leftConstraint = attachmentView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: -leftMargin)