Fix bubble cell height for cells with attachment view and reactions.

This commit is contained in:
SBiOSoftWhare
2019-06-18 18:36:22 +02:00
parent 0dd8dba9a7
commit 9693652d61
6 changed files with 100 additions and 0 deletions
@@ -170,6 +170,8 @@
{
cellData.readReceipts[eventId] = nil;
}
[cellData setNeedsUpdateAdditionalContentHeight];
}
}
}
@@ -192,6 +194,8 @@
// Ignore the read receipts on the events without an actual display.
cellData.readReceipts[eventId] = nil;
}
[cellData setNeedsUpdateAdditionalContentHeight];
}
}
}
@@ -203,6 +207,19 @@
});
}
- (void)updateCellDataReactions:(id<MXKRoomBubbleCellDataStoring>)cellData forEventId:(NSString*)eventId
{
[super updateCellDataReactions:cellData forEventId:eventId];
RoomBubbleCellData *roomBubbleCellData;
if ([cellData isKindOfClass:[RoomBubbleCellData class]])
{
roomBubbleCellData = (RoomBubbleCellData*)cellData;
[roomBubbleCellData setNeedsUpdateAdditionalContentHeight];
}
}
#pragma mark -
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
@@ -265,6 +282,8 @@
[bubbleCell addTimestampLabelForComponent:cellData.mostRecentComponentIndex];
}
NSMutableArray *temporaryViews = [NSMutableArray new];
// Handle read receipts and read marker display.
// Ignore the read receipts on the bubble without actual display.
// Ignore the read receipts on collapsed bubbles
@@ -306,6 +325,8 @@
reactionsView.viewModel = bubbleReactionsViewModel;
[reactionsView updateWithTheme:ThemeService.shared.theme];
[temporaryViews addObject:reactionsView];
bubbleReactionsViewModel.viewModelDelegate = self;
reactionsView.translatesAutoresizingMaskIntoConstraints = NO;
@@ -387,6 +408,8 @@
avatarsContainer.translatesAutoresizingMaskIntoConstraints = NO;
avatarsContainer.accessibilityIdentifier = @"readReceiptsContainer";
[temporaryViews addObject:avatarsContainer];
// Add this read receipts container in the content view
if (!bubbleCell.tmpSubviews)
{
@@ -502,6 +525,20 @@
}
}
// Update attachmentView bottom constraint to display reactions and read receipts if needed
UIView *attachmentView = bubbleCell.attachmentView;
NSLayoutConstraint *attachmentViewBottomConstraint = bubbleCell.attachViewBottomConstraint;
if (attachmentView && temporaryViews.count)
{
attachmentViewBottomConstraint.constant = roomBubbleCellData.additionalContentHeight;
}
else if (attachmentView)
{
[bubbleCell resetAttachmentViewBottomConstraintConstant];
}
// Check whether an event is currently selected: the other messages are then blurred
if (_selectedEventId)
{