diff --git a/Riot/Utils/EventFormatter.m b/Riot/Utils/EventFormatter.m index 1d076e947..284d9c9ff 100644 --- a/Riot/Utils/EventFormatter.m +++ b/Riot/Utils/EventFormatter.m @@ -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