Read markers should be synchronised across clients

The read marker may be defined on an event which is not displayed in the room history.
The MatrixKit has been updated to handle this kind of event in the MXKRoomBubbleCellData object.
Previously these events were ignored during the bubbles rendering. Now a bubble component is created even if the event has no actual display.
This component is useful to display the read marker in the room history, and to allow the user to jump on this read marker.

vector-im/riot-meta#8
This commit is contained in:
Giom Foret
2017-06-13 17:43:32 +02:00
parent 3c66e60d32
commit 7459f529e6
8 changed files with 327 additions and 196 deletions
+12 -3
View File
@@ -45,6 +45,8 @@
#import "UsersDevicesViewController.h"
#import "RoomEmptyBubbleCell.h"
#import "RoomIncomingTextMsgBubbleCell.h"
#import "RoomIncomingTextMsgWithoutSenderInfoBubbleCell.h"
#import "RoomIncomingTextMsgWithPaginationTitleBubbleCell.h"
@@ -269,6 +271,8 @@
[self.bubblesTableView registerClass:RoomOutgoingEncryptedTextMsgWithoutSenderNameBubbleCell.class forCellReuseIdentifier:RoomOutgoingEncryptedTextMsgWithoutSenderNameBubbleCell.defaultReuseIdentifier];
[self.bubblesTableView registerClass:RoomOutgoingEncryptedTextMsgWithPaginationTitleWithoutSenderNameBubbleCell.class forCellReuseIdentifier:RoomOutgoingEncryptedTextMsgWithPaginationTitleWithoutSenderNameBubbleCell.defaultReuseIdentifier];
[self.bubblesTableView registerClass:RoomEmptyBubbleCell.class forCellReuseIdentifier:RoomEmptyBubbleCell.defaultReuseIdentifier];
// Prepare jump to last unread banner
self.jumpToLastUnreadLabel.attributedText = [[NSAttributedString alloc] initWithString:NSLocalizedStringFromTable(@"room_jump_to_first_unread", @"Vector", nil) attributes:@{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle), NSUnderlineColorAttributeName: kRiotTextColorBlack, NSForegroundColorAttributeName: kRiotTextColorBlack}];
@@ -1504,8 +1508,12 @@
{
id<MXKRoomBubbleCellDataStoring> bubbleData = (id<MXKRoomBubbleCellDataStoring>)cellData;
// Select the suitable table view cell class
if (bubbleData.isIncoming)
// Select the suitable table view cell class, by considering first the empty bubble cell.
if (!bubbleData.attributedTextMessage)
{
cellViewClass = RoomEmptyBubbleCell.class;
}
else if (bubbleData.isIncoming)
{
if (bubbleData.isAttachmentWithThumbnail)
{
@@ -2512,7 +2520,8 @@
// Move the read marker to the current read receipt position.
[self.roomDataSource.room forgetReadMarker];
[self refreshJumpToLastUnreadBannerDisplay];
// Hide the banner
self.jumpToLastUnreadBannerContainer.hidden = YES;
}
}