mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-27 19:56:57 +02:00
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:
@@ -39,19 +39,4 @@
|
||||
[self updateUserNameColor];
|
||||
}
|
||||
|
||||
+ (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
|
||||
|
||||
-15
@@ -45,19 +45,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ (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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -40,19 +40,4 @@
|
||||
[self updateUserNameColor];
|
||||
}
|
||||
|
||||
+ (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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -37,9 +37,9 @@ class URLPreviewView: UIView, NibLoadable, Themable {
|
||||
static let reducedWidth: CGFloat = 230
|
||||
|
||||
/// The availableWidth value that the XIB file is designed against.
|
||||
static let defaultAvailableWidth: CGFloat = 375
|
||||
static let defaultAvailableWidth: CGFloat = 340
|
||||
/// The threshold value for available width that triggers the view to use a reducedWidth
|
||||
static let reducedWidthThreshold: CGFloat = 320
|
||||
static let reducedWidthThreshold: CGFloat = 285
|
||||
}
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
Reference in New Issue
Block a user