Include URL previews in addVerticalWhitespaceToString:forEvent: and remove heightForCellData:withMaximumWidth: from the various TextMsgBubbleCell subclasses.

Use the bubble cell data's available width when sizing URL previews and update the defaultAvailableWidth and reducedWidthThreshold accordingly.
This commit is contained in:
Doug
2021-09-23 17:30:24 +01:00
parent e800a2ec42
commit ac3b2c1677
8 changed files with 33 additions and 81 deletions
@@ -29,19 +29,4 @@
self.messageTextView.tintColor = ThemeService.shared.theme.tintColor;
}
+ (CGFloat)heightForCellData:(MXKCellData *)cellData withMaximumWidth:(CGFloat)maxWidth
{
RoomBubbleCellData *bubbleData = (RoomBubbleCellData*)cellData;
// Include the URL preview in the height if necessary.
if (RiotSettings.shared.roomScreenShowsURLPreviews && bubbleData && bubbleData.showURLPreview)
{
CGFloat height = [super heightForCellData:cellData withMaximumWidth:maxWidth];
return height + RoomBubbleCellLayout.urlPreviewViewTopMargin + [URLPreviewView contentViewHeightFor:bubbleData.urlPreviewData
fitting:maxWidth];
}
return [super heightForCellData:cellData withMaximumWidth:maxWidth];
}
@end