mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-01 21:56:58 +02:00
SizableBaseBubbleCell: Handle handle URL preview.
This commit is contained in:
@@ -32,6 +32,8 @@ class SizableBaseBubbleCell: BaseBubbleCell, SizableBaseBubbleCellType {
|
||||
|
||||
private static let reactionsViewSizer = BubbleReactionsViewSizer()
|
||||
private static let reactionsViewModelBuilder = BubbleReactionsViewModelBuilder()
|
||||
|
||||
private static let urlPreviewViewSizer = URLPreviewViewSizer()
|
||||
|
||||
private class var sizingView: SizableBaseBubbleCell {
|
||||
let sizingView: SizableBaseBubbleCell
|
||||
@@ -138,6 +140,17 @@ class SizableBaseBubbleCell: BaseBubbleCell, SizableBaseBubbleCellType {
|
||||
height += RoomBubbleCellLayout.threadSummaryViewHeight
|
||||
}
|
||||
|
||||
// Add URL preview view height if needed
|
||||
if sizingView is RoomCellURLPreviewDisplayable,
|
||||
let roomBubbleCellData = cellData as? RoomBubbleCellData, let firstBubbleComponent =
|
||||
roomBubbleCellData.getFirstBubbleComponentWithDisplay(), firstBubbleComponent.showURLPreview, let urlPreviewData = firstBubbleComponent.urlPreviewData as? URLPreviewData {
|
||||
|
||||
let urlPreviewMaxWidth = sizingView.bubbleCellContentView?.urlPreviewContentView.frame.width ?? roomBubbleCellData.maxTextViewWidth
|
||||
|
||||
let urlPreviewHeight = self.urlPreviewViewSizer.height(for: urlPreviewData, fittingWidth: urlPreviewMaxWidth)
|
||||
height+=urlPreviewHeight
|
||||
}
|
||||
|
||||
return height
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user