From 84154514d04e4377087b45b57879681acd45249d Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 2 Jul 2018 15:47:09 +0200 Subject: [PATCH] RoomVC: Fix regressions on vertical alignment of e2e padlock, read marker, etc. Regression due to read receipt perf improvement. --- Riot/Model/Room/RoomBubbleCellData.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Riot/Model/Room/RoomBubbleCellData.m b/Riot/Model/Room/RoomBubbleCellData.m index d0f7ff4a2..9671f88bf 100644 --- a/Riot/Model/Room/RoomBubbleCellData.m +++ b/Riot/Model/Room/RoomBubbleCellData.m @@ -260,6 +260,8 @@ static NSAttributedString *readReceiptVerticalWhitespace = nil; // Check whether there is at least one component. if (bubbleComponents.count) { + BOOL hasReadReceipts = NO; + // Set position of the first component CGFloat positionY = (self.attachment == nil || self.attachment.type == MXKAttachmentTypeFile || self.attachment.type == MXKAttachmentTypeAudio) ? MXKROOMBUBBLECELLDATA_TEXTVIEW_DEFAULT_VERTICAL_INSET : 0; MXKRoomBubbleComponent *component; @@ -273,6 +275,7 @@ static NSAttributedString *readReceiptVerticalWhitespace = nil; if (component.attributedTextMessage) { + hasReadReceipts = (self.readReceipts[component.event.eventId].count > 0); break; } } @@ -297,7 +300,7 @@ static NSAttributedString *readReceiptVerticalWhitespace = nil; } // Vertical whitespace is added in case of read receipts - if (self.readReceipts.count) + if (hasReadReceipts) { [attributedString appendAttributedString:[RoomBubbleCellData readReceiptVerticalWhitespace]]; } @@ -337,7 +340,7 @@ static NSAttributedString *readReceiptVerticalWhitespace = nil; component.position = CGPointMake(0, positionY); // Add vertical whitespace in case of read receipts. - if (self.readReceipts[component.event.eventId]) + if (self.readReceipts[component.event.eventId].count) { [attributedString appendAttributedString:[RoomBubbleCellData readReceiptVerticalWhitespace]]; }