diff --git a/Riot/Modules/Room/TimelineCells/BaseRoomCell/RoomCellContentView.swift b/Riot/Modules/Room/TimelineCells/BaseRoomCell/RoomCellContentView.swift index 12db2bd5e..4420bec45 100644 --- a/Riot/Modules/Room/TimelineCells/BaseRoomCell/RoomCellContentView.swift +++ b/Riot/Modules/Room/TimelineCells/BaseRoomCell/RoomCellContentView.swift @@ -246,7 +246,7 @@ extension RoomCellContentView: RoomCellThreadSummaryDisplayable { NSLayoutConstraint.activate([ leadingConstraint, threadSummaryView.topAnchor.constraint(equalTo: containerView.topAnchor), - threadSummaryView.heightAnchor.constraint(equalToConstant: RoomBubbleCellLayout.threadSummaryViewHeight), + threadSummaryView.heightAnchor.constraint(equalToConstant: PlainRoomCellLayoutConstants.threadSummaryViewHeight), threadSummaryView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor), trailingConstraint ]) diff --git a/Riot/Modules/Room/TimelineCells/KeyVerification/KeyVerificationBaseBubbleCell.swift b/Riot/Modules/Room/TimelineCells/KeyVerification/KeyVerificationBaseBubbleCell.swift index 8f50ffd85..af1014bea 100644 --- a/Riot/Modules/Room/TimelineCells/KeyVerification/KeyVerificationBaseBubbleCell.swift +++ b/Riot/Modules/Room/TimelineCells/KeyVerification/KeyVerificationBaseBubbleCell.swift @@ -241,7 +241,7 @@ class KeyVerificationBaseBubbleCell: MXKRoomBubbleTableViewCell { var height = sizingView.systemLayoutSizeFitting(fittingSize).height if let roomBubbleCellData = cellData as? RoomBubbleCellData, let readReceipts = roomBubbleCellData.readReceipts, readReceipts.count > 0 { - height+=RoomBubbleCellLayout.readReceiptsViewHeight + height+=PlainRoomCellLayoutConstants.readReceiptsViewHeight } return height diff --git a/Riot/Modules/Room/TimelineCells/SizableCell/SizableBubbleCell.swift b/Riot/Modules/Room/TimelineCells/SizableCell/SizableBubbleCell.swift index 02c790171..cb8831b25 100644 --- a/Riot/Modules/Room/TimelineCells/SizableCell/SizableBubbleCell.swift +++ b/Riot/Modules/Room/TimelineCells/SizableCell/SizableBubbleCell.swift @@ -120,7 +120,7 @@ class SizableBaseBubbleCell: BaseRoomCell, SizableBaseBubbleCellType { // Add read receipt height if needed if let roomBubbleCellData = cellData as? RoomBubbleCellData, let readReceipts = roomBubbleCellData.readReceipts, readReceipts.count > 0, sizingView is RoomCellReadReceiptsDisplayable { - height+=RoomBubbleCellLayout.readReceiptsViewHeight + height+=PlainRoomCellLayoutConstants.readReceiptsViewHeight } // Add reactions view height if needed @@ -141,7 +141,7 @@ class SizableBaseBubbleCell: BaseRoomCell, SizableBaseBubbleCellType { let bottomMargin = sizingView.roomCellContentView?.threadSummaryContentViewBottomConstraint.constant ?? 0 - height += RoomBubbleCellLayout.threadSummaryViewHeight + height += PlainRoomCellLayoutConstants.threadSummaryViewHeight height += bottomMargin } diff --git a/Riot/Modules/Room/TimelineCells/Styles/Bubble/BubbleRoomCellLayoutUpdater.swift b/Riot/Modules/Room/TimelineCells/Styles/Bubble/BubbleRoomCellLayoutUpdater.swift index f619471f7..32bced0bf 100644 --- a/Riot/Modules/Room/TimelineCells/Styles/Bubble/BubbleRoomCellLayoutUpdater.swift +++ b/Riot/Modules/Room/TimelineCells/Styles/Bubble/BubbleRoomCellLayoutUpdater.swift @@ -183,7 +183,7 @@ class BubbleRoomCellLayoutUpdater: RoomCellLayoutUpdating { let messageViewMarginTop: CGFloat = 0 let messageViewMarginBottom: CGFloat = 0 let messageViewMarginLeft = - BubbleRoomCellLayoutConstants.outgoingBubbleBackgroundMargins.left + RoomBubbleCellLayout.innerContentViewMargins.left + BubbleRoomCellLayoutConstants.outgoingBubbleBackgroundMargins.left + PlainRoomCellLayoutConstants.innerContentViewMargins.left let messageViewMarginRight = BubbleRoomCellLayoutConstants.outgoingBubbleBackgroundMargins.right + BubbleRoomCellLayoutConstants.bubbleTextViewInsets.right let messageViewInsets = UIEdgeInsets(top: messageViewMarginTop, left: messageViewMarginLeft, bottom: messageViewMarginBottom, right: messageViewMarginRight) diff --git a/Riot/Modules/Room/TimelineCells/Styles/Bubble/BubbleRoomTimelineCellDecorator.swift b/Riot/Modules/Room/TimelineCells/Styles/Bubble/BubbleRoomTimelineCellDecorator.swift index 3c3cb45e0..f3d80259f 100644 --- a/Riot/Modules/Room/TimelineCells/Styles/Bubble/BubbleRoomTimelineCellDecorator.swift +++ b/Riot/Modules/Room/TimelineCells/Styles/Bubble/BubbleRoomTimelineCellDecorator.swift @@ -106,7 +106,7 @@ class BubbleRoomTimelineCellDecorator: PlainRoomTimelineCellDecorator { cellContentView.addSubview(reactionsView) - let topMargin: CGFloat = RoomBubbleCellLayout.reactionsViewTopMargin + let topMargin: CGFloat = PlainRoomCellLayoutConstants.reactionsViewTopMargin let leftMargin: CGFloat let rightMargin: CGFloat @@ -116,7 +116,7 @@ class BubbleRoomTimelineCellDecorator: PlainRoomTimelineCellDecorator { var incomingLeftMargin = BubbleRoomCellLayoutConstants.incomingBubbleBackgroundMargins.left if cellData.containsBubbleComponentWithEncryptionBadge { - incomingLeftMargin += RoomBubbleCellLayout.encryptedContentLeftMargin + incomingLeftMargin += PlainRoomCellLayoutConstants.encryptedContentLeftMargin } leftMargin = incomingLeftMargin @@ -131,7 +131,7 @@ class BubbleRoomTimelineCellDecorator: PlainRoomTimelineCellDecorator { var outgoingLeftMargin = BubbleRoomCellLayoutConstants.outgoingBubbleBackgroundMargins.left if cellData.containsBubbleComponentWithEncryptionBadge { - outgoingLeftMargin += RoomBubbleCellLayout.encryptedContentLeftMargin + outgoingLeftMargin += PlainRoomCellLayoutConstants.encryptedContentLeftMargin } leftMargin = outgoingLeftMargin @@ -180,9 +180,9 @@ class BubbleRoomTimelineCellDecorator: PlainRoomTimelineCellDecorator { // Incoming message if cellData.isIncoming { - var leftMargin = RoomBubbleCellLayout.reactionsViewLeftMargin + var leftMargin = PlainRoomCellLayoutConstants.reactionsViewLeftMargin if cellData.containsBubbleComponentWithEncryptionBadge { - leftMargin += RoomBubbleCellLayout.encryptedContentLeftMargin + leftMargin += PlainRoomCellLayoutConstants.encryptedContentLeftMargin } leadingOrTrailingConstraint = urlPreviewView.leadingAnchor.constraint(equalTo: cellContentView.leadingAnchor, constant: leftMargin) @@ -194,7 +194,7 @@ class BubbleRoomTimelineCellDecorator: PlainRoomTimelineCellDecorator { leadingOrTrailingConstraint = urlPreviewView.trailingAnchor.constraint(equalTo: cellContentView.trailingAnchor, constant: -rightMargin) } - let topMargin = contentViewPositionY + RoomBubbleCellLayout.urlPreviewViewTopMargin + RoomBubbleCellLayout.reactionsViewTopMargin + let topMargin = contentViewPositionY + PlainRoomCellLayoutConstants.urlPreviewViewTopMargin + PlainRoomCellLayoutConstants.reactionsViewTopMargin // Set the preview view's origin NSLayoutConstraint.activate([ @@ -232,7 +232,7 @@ class BubbleRoomTimelineCellDecorator: PlainRoomTimelineCellDecorator { leftMargin = BubbleRoomCellLayoutConstants.incomingBubbleBackgroundMargins.left if cellData.containsBubbleComponentWithEncryptionBadge { - leftMargin += RoomBubbleCellLayout.encryptedContentLeftMargin + leftMargin += PlainRoomCellLayoutConstants.encryptedContentLeftMargin } rightMargin = BubbleRoomCellLayoutConstants.incomingBubbleBackgroundMargins.right @@ -253,7 +253,7 @@ class BubbleRoomTimelineCellDecorator: PlainRoomTimelineCellDecorator { constant: -rightMargin) } - let topMargin = RoomBubbleCellLayout.threadSummaryViewTopMargin + let topMargin = PlainRoomCellLayoutConstants.threadSummaryViewTopMargin let height = ThreadSummaryView.contentViewHeight(forThread: threadSummaryView.thread, fitting: cellData.maxTextViewWidth) diff --git a/Riot/Modules/Room/TimelineCells/Styles/Plain/RoomBubbleCellLayout.swift b/Riot/Modules/Room/TimelineCells/Styles/Plain/PlainRoomCellLayoutConstants.swift similarity index 94% rename from Riot/Modules/Room/TimelineCells/Styles/Plain/RoomBubbleCellLayout.swift rename to Riot/Modules/Room/TimelineCells/Styles/Plain/PlainRoomCellLayoutConstants.swift index 46ba7e618..7ae41d8ac 100644 --- a/Riot/Modules/Room/TimelineCells/Styles/Plain/RoomBubbleCellLayout.swift +++ b/Riot/Modules/Room/TimelineCells/Styles/Plain/PlainRoomCellLayoutConstants.swift @@ -16,9 +16,9 @@ import Foundation -/// MXKRoomBubbleTableViewCell layout constants +/// Plain room cells layout constants @objcMembers -final class RoomBubbleCellLayout: NSObject { +final class PlainRoomCellLayoutConstants: NSObject { /// Inner content view margins static let innerContentViewMargins: UIEdgeInsets = UIEdgeInsets(top: 0, left: 57, bottom: 0.0, right: 0) diff --git a/Riot/Modules/Room/TimelineCells/Styles/Plain/PlainRoomTimelineCellDecorator.swift b/Riot/Modules/Room/TimelineCells/Styles/Plain/PlainRoomTimelineCellDecorator.swift index 118b7cc2b..509e44870 100644 --- a/Riot/Modules/Room/TimelineCells/Styles/Plain/PlainRoomTimelineCellDecorator.swift +++ b/Riot/Modules/Room/TimelineCells/Styles/Plain/PlainRoomTimelineCellDecorator.swift @@ -54,12 +54,12 @@ class PlainRoomTimelineCellDecorator: RoomTimelineCellDecorator { urlPreviewView.availableWidth = cellData.maxTextViewWidth cellContentView.addSubview(urlPreviewView) - var leftMargin = RoomBubbleCellLayout.reactionsViewLeftMargin + var leftMargin = PlainRoomCellLayoutConstants.reactionsViewLeftMargin if cellData.containsBubbleComponentWithEncryptionBadge { - leftMargin += RoomBubbleCellLayout.encryptedContentLeftMargin + leftMargin += PlainRoomCellLayoutConstants.encryptedContentLeftMargin } - let topMargin = contentViewPositionY + RoomBubbleCellLayout.urlPreviewViewTopMargin + RoomBubbleCellLayout.reactionsViewTopMargin + let topMargin = contentViewPositionY + PlainRoomCellLayoutConstants.urlPreviewViewTopMargin + PlainRoomCellLayoutConstants.reactionsViewTopMargin // Set the preview view's origin NSLayoutConstraint.activate([ @@ -85,14 +85,14 @@ class PlainRoomTimelineCellDecorator: RoomTimelineCellDecorator { cellContentView.addSubview(reactionsView) - var leftMargin = RoomBubbleCellLayout.reactionsViewLeftMargin + var leftMargin = PlainRoomCellLayoutConstants.reactionsViewLeftMargin if cellData.containsBubbleComponentWithEncryptionBadge { - leftMargin += RoomBubbleCellLayout.encryptedContentLeftMargin + leftMargin += PlainRoomCellLayoutConstants.encryptedContentLeftMargin } - let rightMargin = RoomBubbleCellLayout.reactionsViewRightMargin - let topMargin = RoomBubbleCellLayout.reactionsViewTopMargin + let rightMargin = PlainRoomCellLayoutConstants.reactionsViewRightMargin + let topMargin = PlainRoomCellLayoutConstants.reactionsViewTopMargin // The top constraint may need to include the URL preview view let topConstraint: NSLayoutConstraint @@ -127,13 +127,13 @@ class PlainRoomTimelineCellDecorator: RoomTimelineCellDecorator { cellContentView.addSubview(readReceiptsView) // Force receipts container size - let widthConstraint = readReceiptsView.widthAnchor.constraint(equalToConstant: RoomBubbleCellLayout.readReceiptsViewWidth) - let heightConstraint = readReceiptsView.heightAnchor.constraint(equalToConstant: RoomBubbleCellLayout.readReceiptsViewHeight) + let widthConstraint = readReceiptsView.widthAnchor.constraint(equalToConstant: PlainRoomCellLayoutConstants.readReceiptsViewWidth) + let heightConstraint = readReceiptsView.heightAnchor.constraint(equalToConstant: PlainRoomCellLayoutConstants.readReceiptsViewHeight) // Force receipts container position - let trailingConstraint = readReceiptsView.trailingAnchor.constraint(equalTo: cellContentView.trailingAnchor, constant: -RoomBubbleCellLayout.readReceiptsViewRightMargin) + let trailingConstraint = readReceiptsView.trailingAnchor.constraint(equalTo: cellContentView.trailingAnchor, constant: -PlainRoomCellLayoutConstants.readReceiptsViewRightMargin) - let topMargin = RoomBubbleCellLayout.readReceiptsViewTopMargin + let topMargin = PlainRoomCellLayoutConstants.readReceiptsViewTopMargin let topConstraint: NSLayoutConstraint if let upperDecorationView = upperDecorationView { @@ -168,14 +168,14 @@ class PlainRoomTimelineCellDecorator: RoomTimelineCellDecorator { cellContentView.addSubview(threadSummaryView) - var leftMargin = RoomBubbleCellLayout.reactionsViewLeftMargin + var leftMargin = PlainRoomCellLayoutConstants.reactionsViewLeftMargin if cellData.containsBubbleComponentWithEncryptionBadge { - leftMargin += RoomBubbleCellLayout.encryptedContentLeftMargin + leftMargin += PlainRoomCellLayoutConstants.encryptedContentLeftMargin } - let rightMargin = RoomBubbleCellLayout.reactionsViewRightMargin - let topMargin = RoomBubbleCellLayout.threadSummaryViewTopMargin + let rightMargin = PlainRoomCellLayoutConstants.reactionsViewRightMargin + let topMargin = PlainRoomCellLayoutConstants.threadSummaryViewTopMargin let height = ThreadSummaryView.contentViewHeight(forThread: threadSummaryView.thread, fitting: cellData.maxTextViewWidth) diff --git a/Riot/Modules/Room/TimelineDecorations/Threads/Summary/ThreadSummaryView.swift b/Riot/Modules/Room/TimelineDecorations/Threads/Summary/ThreadSummaryView.swift index c1da2d9dd..40714866a 100644 --- a/Riot/Modules/Room/TimelineDecorations/Threads/Summary/ThreadSummaryView.swift +++ b/Riot/Modules/Room/TimelineDecorations/Threads/Summary/ThreadSummaryView.swift @@ -52,7 +52,7 @@ class ThreadSummaryView: UIView { self.thread = thread super.init(frame: CGRect(origin: .zero, size: CGSize(width: Constants.viewDefaultWidth, - height: RoomBubbleCellLayout.threadSummaryViewHeight))) + height: PlainRoomCellLayoutConstants.threadSummaryViewHeight))) loadNibContent() update(theme: ThemeService.shared().theme) configure() @@ -60,7 +60,7 @@ class ThreadSummaryView: UIView { } static func contentViewHeight(forThread thread: MXThread?, fitting maxWidth: CGFloat) -> CGFloat { - return RoomBubbleCellLayout.threadSummaryViewHeight + return PlainRoomCellLayoutConstants.threadSummaryViewHeight } required init?(coder: NSCoder) {