Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(markdown): Parse markdown of room description #1946

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading