Skip to content

Commit

Permalink
Content warningが設定されている場合、TL上で選択するまで本文を隠すようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
shibafu528 committed Jul 27, 2022
1 parent da720ed commit a47999a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Cocotodon/Timeline/TimelineViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@
/// TLの最大要素数
static const NSInteger kTimelineMaxItems = 1000;

static NSString* SummarizeContent(DONStatus *status) {
NSString *content;
if (status.spoilerText.length) {
content = [status.spoilerText stringByAppendingString:@" | (選択して続きを表示...)"];
} else {
content = status.plainContent;
}
return [content stringByRemovingLineBreaksAndJoinedByString:@" "];
}

// ----------

@interface TimelineViewController () <NSTextViewDelegate, NSTableViewDelegate, NSTableViewDataSource, NSMenuDelegate, DONStreamingEventDelegate>
Expand Down Expand Up @@ -251,7 +261,7 @@ - (NSView *)tableView:(NSTableView *)tableView
ExpandableCellView *expandable = (ExpandableCellView*) view;
NSMutableAttributedString *summary;
{
NSAttributedString *content = [[NSAttributedString alloc] initWithString:[status.originalStatus.expandContent stringByRemovingLineBreaksAndJoinedByString:@" "]];
NSAttributedString *content = [[NSAttributedString alloc] initWithString:SummarizeContent(status.originalStatus)];
NSAttributedString *expanded = [DONEmojiExpander expandFromAttributedString:content providedBy:status.originalStatus];
summary = [[NSMutableAttributedString alloc] initWithAttributedString:expanded];
}
Expand Down

0 comments on commit a47999a

Please sign in to comment.