Reactions: Show at most 8 reactions

#2510
This commit is contained in:
manuroe
2019-07-03 18:05:20 +02:00
parent b91a8ea71a
commit 2b95ff7305
11 changed files with 325 additions and 44 deletions
+28 -1
View File
@@ -244,7 +244,10 @@
if (reactions && !isCollapsableCellCollapsed)
{
BubbleReactionsViewModel *bubbleReactionsViewModel = [[BubbleReactionsViewModel alloc] initWithAggregatedReactions:reactions eventId:componentEventId];
BOOL showAllReactions = [cellData showAllReactionsForEvent:componentEventId];
BubbleReactionsViewModel *bubbleReactionsViewModel = [[BubbleReactionsViewModel alloc] initWithAggregatedReactions:reactions
eventId:componentEventId
showAll:showAllReactions];
reactionsView = [BubbleReactionsView new];
reactionsView.viewModel = bubbleReactionsViewModel;
@@ -572,4 +575,28 @@
}];
}
- (void)bubbleReactionsViewModel:(BubbleReactionsViewModel *)viewModel didShowAllTappedForEventId:(NSString * _Nonnull)eventId
{
[self setShowAllReactions:YES forEvent:eventId];
}
- (void)bubbleReactionsViewModel:(BubbleReactionsViewModel *)viewModel didShowLessTappedForEventId:(NSString * _Nonnull)eventId
{
[self setShowAllReactions:NO forEvent:eventId];
}
- (void)setShowAllReactions:(BOOL)showAllReactions forEvent:(NSString*)eventId
{
id<MXKRoomBubbleCellDataStoring> cellData = [self cellDataOfEventWithEventId:eventId];
if ([cellData isKindOfClass:[RoomBubbleCellData class]])
{
RoomBubbleCellData *roomBubbleCellData = (RoomBubbleCellData*)cellData;
[roomBubbleCellData setShowAllReactions:showAllReactions forEvent:eventId];
[self updateCellDataReactions:roomBubbleCellData forEventId:eventId];
[self.delegate dataSource:self didCellChange:nil];
}
}
@end