mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-22 15:42:10 +02:00
Configure attributed text for room creation event and for multiple events
This commit is contained in:
@@ -180,7 +180,7 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
return [super attributedStringFromEvent:event withRoomState:roomState error:error];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,30 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
|
||||
|
||||
if (events.count)
|
||||
{
|
||||
if (events[0].eventType == MXEventTypeRoomMember)
|
||||
MXEvent *roomCreateEvent = [events filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"type == %@", kMXEventTypeStringRoomCreate]].firstObject;
|
||||
|
||||
if (roomCreateEvent)
|
||||
{
|
||||
MXKEventFormatterError tmpError;
|
||||
displayText = [super attributedStringFromEvent:roomCreateEvent withRoomState:roomState error:&tmpError].string;
|
||||
|
||||
NSAttributedString *rendered = [self renderString:displayText forEvent:roomCreateEvent];
|
||||
NSMutableAttributedString *result = [[NSMutableAttributedString alloc] initWithAttributedString:rendered];
|
||||
[result setAttributes:@{
|
||||
NSFontAttributeName: [UIFont systemFontOfSize:13],
|
||||
NSForegroundColorAttributeName: ThemeService.shared.theme.textSecondaryColor
|
||||
} range:NSMakeRange(0, rendered.length)];
|
||||
// add one char space
|
||||
[result appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
|
||||
// add more link
|
||||
NSAttributedString *linkMore = [[NSAttributedString alloc] initWithString:@"More" attributes:@{
|
||||
NSFontAttributeName: [UIFont systemFontOfSize:13],
|
||||
NSForegroundColorAttributeName: ThemeService.shared.theme.tintColor
|
||||
}];
|
||||
[result appendAttributedString:linkMore];
|
||||
return result;
|
||||
}
|
||||
else if (events[0].eventType == MXEventTypeRoomMember)
|
||||
{
|
||||
// This is a series for cells tagged with RoomBubbleCellDataTagMembership
|
||||
// TODO: Build a complete summary like Riot-web
|
||||
|
||||
Reference in New Issue
Block a user