mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-01 05:36:57 +02:00
Chat screen implementation
Handle event selection when user taps on text message view. Note: The read receipts are still displayed by MatrixKit, they may overlap timestamp until Vector handle them correctly.
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
#import "EventFormatter.h"
|
||||
#import "RoomBubbleCellData.h"
|
||||
|
||||
#import "MXKRoomBubbleTableViewCell+Vector.h"
|
||||
|
||||
@implementation RoomDataSource
|
||||
|
||||
- (instancetype)initWithRoomId:(NSString *)roomId andMatrixSession:(MXSession *)matrixSession
|
||||
@@ -32,7 +34,10 @@
|
||||
// Replace event formatter
|
||||
self.eventFormatter = [[EventFormatter alloc] initWithMatrixSession:self.mxSession];
|
||||
|
||||
// Handle timestamp and read receips display at Vector app level (see [tableView: cellForRowAtIndexPath:])
|
||||
self.useCustomDateTimeLabel = YES;
|
||||
//FIXME GFO: disable default receipts display
|
||||
//self.useCustomReceipts = YES;
|
||||
|
||||
// TODO custom here self.eventsFilterForMessages according to Vector requirements
|
||||
|
||||
@@ -42,4 +47,53 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
|
||||
|
||||
// Finalize cell view customization here
|
||||
if ([cell isKindOfClass:MXKRoomBubbleTableViewCell.class])
|
||||
{
|
||||
MXKRoomBubbleTableViewCell *bubbleCell = (MXKRoomBubbleTableViewCell*)cell;
|
||||
|
||||
// Display timestamp for the last message.
|
||||
if (indexPath.row == [tableView numberOfRowsInSection:0] - 1)
|
||||
{
|
||||
if (bubbleCell.bubbleData.bubbleComponents.count)
|
||||
{
|
||||
[bubbleCell addTimestampLabelForComponent:bubbleCell.bubbleData.bubbleComponents.count - 1];
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether an event is currently selected: the other messages are then blurred
|
||||
if (_selectedEventId)
|
||||
{
|
||||
NSInteger index = [self indexOfCellDataWithEventId:_selectedEventId];
|
||||
|
||||
if (indexPath.row != index)
|
||||
{
|
||||
// The cell should be displayed in blur mode
|
||||
bubbleCell.blurred = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Highlight the selected event in the displayed message
|
||||
MXKRoomBubbleCellData *cellData = (MXKRoomBubbleCellData*)bubbleCell.bubbleData;
|
||||
|
||||
for (NSUInteger index = 0; index < cellData.bubbleComponents.count; index ++)
|
||||
{
|
||||
MXKRoomBubbleComponent *component = cellData.bubbleComponents[index];
|
||||
if ([component.event.eventId isEqualToString:_selectedEventId])
|
||||
{
|
||||
[bubbleCell selectComponent:index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user