diff --git a/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.m b/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.m index 2af3a588d..b64339ddf 100644 --- a/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.m +++ b/Riot/Categories/MXKRoomBubbleTableViewCell+Riot.m @@ -147,7 +147,7 @@ NSString *const kMXKRoomBubbleCellTapOnReceiptsContainer = @"kMXKRoomBubbleCellT // Retrieve the read receipts container related to the selected component (if any) // Blur the others - for (UIView* view in self.bubbleOverlayContainer.subviews) + for (UIView* view in self.tmpSubviews) { // Note read receipt container tag is equal to the index of the related component. if (view.tag != componentIndex) @@ -306,11 +306,14 @@ NSString *const kMXKRoomBubbleCellTapOnReceiptsContainer = @"kMXKRoomBubbleCellT self.bubbleOverlayContainer.alpha = 0.8; self.bubbleOverlayContainer.userInteractionEnabled = YES; - // Blur read receipts if any + // Blur subviews if any for (UIView* view in self.bubbleOverlayContainer.subviews) { view.alpha = 0.2; } + + // Move this view in front + [self.contentView bringSubviewToFront:self.bubbleOverlayContainer]; } else { @@ -321,7 +324,7 @@ NSString *const kMXKRoomBubbleCellTapOnReceiptsContainer = @"kMXKRoomBubbleCellT self.bubbleOverlayContainer.alpha = 1; self.bubbleOverlayContainer.userInteractionEnabled = NO; - // Restore read receipts display + // Restore subviews display for (UIView* view in self.bubbleOverlayContainer.subviews) { view.alpha = 1; diff --git a/Riot/Model/Room/RoomDataSource.m b/Riot/Model/Room/RoomDataSource.m index 680c7803a..8a3f8ff6d 100644 --- a/Riot/Model/Room/RoomDataSource.m +++ b/Riot/Model/Room/RoomDataSource.m @@ -144,13 +144,8 @@ // Ignore the read receipts on the bubble without actual display. if ((self.showBubbleReceipts && cellData.hasReadReceipts) || self.showReadMarker) { - // Read receipts container are inserted here on the right side into the overlay container. + // Read receipts container are inserted here on the right side into the content view. // Some vertical whitespaces are added in message text view (see RoomBubbleCellData class) to insert correctly multiple receipts. - bubbleCell.bubbleOverlayContainer.backgroundColor = [UIColor clearColor]; - bubbleCell.bubbleOverlayContainer.alpha = 1; - bubbleCell.bubbleOverlayContainer.userInteractionEnabled = YES; - bubbleCell.bubbleOverlayContainer.hidden = NO; - NSInteger index = bubbleComponents.count; CGFloat bottomPositionY = bubbleCell.frame.size.height; while (index--) @@ -208,7 +203,17 @@ avatarsContainer.translatesAutoresizingMaskIntoConstraints = NO; avatarsContainer.accessibilityIdentifier = @"readReceiptsContainer"; - [bubbleCell.bubbleOverlayContainer addSubview:avatarsContainer]; + + // Add this read receipts container in the content view + if (!bubbleCell.tmpSubviews) + { + bubbleCell.tmpSubviews = [NSMutableArray arrayWithArray:@[avatarsContainer]]; + } + else + { + [bubbleCell.tmpSubviews addObject:avatarsContainer]; + } + [bubbleCell.contentView addSubview:avatarsContainer]; // Force receipts container size NSLayoutConstraint *widthConstraint = [NSLayoutConstraint constraintWithItem:avatarsContainer @@ -230,14 +235,14 @@ NSLayoutConstraint *trailingConstraint = [NSLayoutConstraint constraintWithItem:avatarsContainer attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual - toItem:bubbleCell.bubbleOverlayContainer + toItem:avatarsContainer.superview attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:-6]; NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:avatarsContainer attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual - toItem:bubbleCell.bubbleOverlayContainer + toItem:avatarsContainer.superview attribute:NSLayoutAttributeTop multiplier:1.0 constant:bottomPositionY - 13]; @@ -250,6 +255,13 @@ // Check whether the read marker must be displayed here. if (self.showReadMarker) { + // The read marker is added into the overlay container. + // CAUTION: Keep disabled the user interaction on this container to not disturb tap gesture handling. + bubbleCell.bubbleOverlayContainer.backgroundColor = [UIColor clearColor]; + bubbleCell.bubbleOverlayContainer.alpha = 1; + bubbleCell.bubbleOverlayContainer.userInteractionEnabled = NO; + bubbleCell.bubbleOverlayContainer.hidden = NO; + if ([component.event.eventId isEqualToString:self.room.accountData.readMarkerEventId]) { bubbleCell.readMarkerView = [[UIView alloc] initWithFrame:CGRectMake(0, bottomPositionY - 2, bubbleCell.bubbleOverlayContainer.frame.size.width, 2)];