Skip to content

Commit

Permalink
Merge pull request #1946 from nextcloud/feat/noid/parse-markdown-of-r…
Browse files Browse the repository at this point in the history
…oom-description

feat(markdown): Parse markdown of room description
  • Loading branch information
SystemKeeper authored Jan 20, 2025
2 parents 45d5b6c + d42566d commit dedd6da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions NextcloudTalk/NCChatTitleView.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ - (void)setTitle:(NSString *)title withSubtitle:(NSString *)subtitle
[attributedTitle addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:rangeTitle];

if (self.showSubtitle && subtitle != nil) {
NSMutableAttributedString *attributedSubtitle = [[NSMutableAttributedString alloc] initWithString:subtitle];
NSRange rangeSubtitle = NSMakeRange(0, [subtitle length]);
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:subtitle];
NSMutableAttributedString *attributedSubtitle = [SwiftMarkdownObjCBridge parseMarkdownWithMarkdownString:attributedString];
NSRange rangeSubtitle = NSMakeRange(0, [attributedSubtitle length]);
[attributedSubtitle addAttribute:NSFontAttributeName value:self.subtitleFont range:rangeSubtitle];
[attributedSubtitle addAttribute:NSForegroundColorAttributeName value:self.titleTextColor range:rangeSubtitle];
[attributedSubtitle addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:rangeSubtitle];
Expand Down
9 changes: 7 additions & 2 deletions NextcloudTalk/RoomInfoTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1911,8 +1911,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
if (!cell) {
cell = [[TextViewTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TextViewTableViewCell.identifier];
}

cell.textView.text = _room.roomDescription;

NSMutableAttributedString *attributedDescription = [[NSMutableAttributedString alloc] initWithString:_room.roomDescription];
NSRange range = NSMakeRange(0, [attributedDescription length]);
[attributedDescription addAttribute:NSFontAttributeName value:[UIFont preferredFontForTextStyle:UIFontTextStyleBody] range:range];
[attributedDescription addAttribute:NSForegroundColorAttributeName value:[UIColor labelColor] range:range];

cell.textView.attributedText = [SwiftMarkdownObjCBridge parseMarkdownWithMarkdownString:attributedDescription];
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
return cell;
}
Expand Down

0 comments on commit dedd6da

Please sign in to comment.