mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 00:24:43 +02:00
Add additional height in the cell for thread summary view
This commit is contained in:
@@ -263,6 +263,17 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
return [super hasNoDisplay];
|
||||
}
|
||||
|
||||
- (BOOL)hasThreadRoot
|
||||
{
|
||||
if (!RiotSettings.shared.enableThreads)
|
||||
{
|
||||
// do not consider this cell data if threads not enabled in the timeline
|
||||
return NO;
|
||||
}
|
||||
|
||||
return super.hasThreadRoot;
|
||||
}
|
||||
|
||||
#pragma mark - Bubble collapsing
|
||||
|
||||
- (BOOL)collapseWith:(id<MXKRoomBubbleCellDataStoring>)cellData
|
||||
@@ -531,6 +542,8 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
additionalVerticalHeight+= [self urlPreviewHeightForEventId:eventId];
|
||||
// Add vertical whitespace in case of reactions.
|
||||
additionalVerticalHeight+= [self reactionHeightForEventId:eventId];
|
||||
// Add vertical whitespace in case of a thread root
|
||||
additionalVerticalHeight+= [self threadSummaryViewHeightForEventId:eventId];
|
||||
// Add vertical whitespace in case of read receipts.
|
||||
additionalVerticalHeight+= [self readReceiptHeightForEventId:eventId];
|
||||
|
||||
@@ -550,6 +563,7 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
|
||||
height+= [self urlPreviewHeightForEventId:eventId];
|
||||
height+= [self reactionHeightForEventId:eventId];
|
||||
height+= [self threadSummaryViewHeightForEventId:eventId];
|
||||
height+= [self readReceiptHeightForEventId:eventId];
|
||||
}
|
||||
|
||||
@@ -588,6 +602,33 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
self.shouldUpdateAdditionalContentHeight = YES;
|
||||
}
|
||||
|
||||
- (CGFloat)threadSummaryViewHeightForEventId:(NSString*)eventId
|
||||
{
|
||||
if (!RiotSettings.shared.enableThreads)
|
||||
{
|
||||
// do not show thread summary view if threads not enabled in the timeline
|
||||
return 0;
|
||||
}
|
||||
if (roomDataSource.threadId)
|
||||
{
|
||||
// do not show thread summary view on threads
|
||||
return 0;
|
||||
}
|
||||
NSInteger index = [self bubbleComponentIndexForEventId:eventId];
|
||||
if (index == NSNotFound)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
MXKRoomBubbleComponent *component = self.bubbleComponents[index];
|
||||
if (!component.thread)
|
||||
{
|
||||
// component is not a thread root
|
||||
return 0;
|
||||
}
|
||||
// TODO: Fix hardcoded height
|
||||
return RoomBubbleCellLayout.threadSummaryViewTopMargin + 30;
|
||||
}
|
||||
|
||||
- (CGFloat)urlPreviewHeightForEventId:(NSString*)eventId
|
||||
{
|
||||
MXKRoomBubbleComponent *component = [self bubbleComponentWithLinkForEventId:eventId];
|
||||
|
||||
Reference in New Issue
Block a user