mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
MELS: EventFormater: provide a string for membership events as simple as possible for now
This commit is contained in:
parent
01ed7f63c8
commit
498fe978fc
1 changed files with 24 additions and 0 deletions
|
@ -35,6 +35,30 @@
|
|||
|
||||
@implementation EventFormatter
|
||||
|
||||
- (NSAttributedString*)attributedStringFromEvents:(NSArray<MXEvent*>*)events withRoomState:(MXRoomState*)roomState error:(MXKEventFormatterError*)error
|
||||
{
|
||||
NSString *displayText;
|
||||
|
||||
if (events.count)
|
||||
{
|
||||
if (events[0].eventType == MXEventTypeRoomMember)
|
||||
{
|
||||
// This is a serie for cells tagged with RoomBubbleCellDataTagMembership
|
||||
// TODO: Build a complete summary like Riot-web
|
||||
// TODO: i18n the temp string
|
||||
displayText = [NSString stringWithFormat:@"%@ membership changes", @(events.count)];
|
||||
}
|
||||
}
|
||||
|
||||
if (displayText)
|
||||
{
|
||||
// Build the attributed string with the right font and color for the events
|
||||
return [self renderString:displayText forEvent:events[0]];
|
||||
}
|
||||
|
||||
return [super attributedStringFromEvents:events withRoomState:roomState error:error];
|
||||
}
|
||||
|
||||
- (instancetype)initWithMatrixSession:(MXSession *)matrixSession
|
||||
{
|
||||
self = [super initWithMatrixSession:matrixSession];
|
||||
|
|
Loading…
Reference in a new issue