mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Use new apis
This commit is contained in:
parent
b4f8f4f5ef
commit
31587a0c3e
2 changed files with 23 additions and 9 deletions
|
@ -88,19 +88,33 @@ static const CGFloat kDirectRoomBorderWidth = 3.0;
|
|||
{
|
||||
// Report computed values as is
|
||||
self.roomTitle.text = roomCellData.roomDisplayname;
|
||||
self.lastEventDate.text = roomCellData.lastEventDate;
|
||||
MXWeakify(self);
|
||||
[roomCellData lastEventDateString:^(NSString *dateString) {
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
self.lastEventDate.text = dateString;
|
||||
}];
|
||||
|
||||
// Manage lastEventAttributedTextMessage optional property
|
||||
if ([roomCellData respondsToSelector:@selector(lastEventAttributedTextMessage)])
|
||||
if ([roomCellData respondsToSelector:@selector(lastEventAttributedText:)])
|
||||
{
|
||||
// Force the default text color for the last message (cancel highlighted message color)
|
||||
NSMutableAttributedString *lastEventDescription = [[NSMutableAttributedString alloc] initWithAttributedString:roomCellData.lastEventAttributedTextMessage];
|
||||
[lastEventDescription addAttribute:NSForegroundColorAttributeName value:ThemeService.shared.theme.textSecondaryColor range:NSMakeRange(0, lastEventDescription.length)];
|
||||
self.lastEventDescription.attributedText = lastEventDescription;
|
||||
MXWeakify(self);
|
||||
[roomCellData lastEventAttributedText:^(NSAttributedString *attributedText) {
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
// Force the default text color for the last message (cancel highlighted message color)
|
||||
NSMutableAttributedString *lastEventDescription = [[NSMutableAttributedString alloc] initWithAttributedString:attributedText];
|
||||
[lastEventDescription addAttribute:NSForegroundColorAttributeName
|
||||
value:ThemeService.shared.theme.textSecondaryColor
|
||||
range:NSMakeRange(0, lastEventDescription.length)];
|
||||
self.lastEventDescription.attributedText = lastEventDescription;
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.lastEventDescription.text = roomCellData.lastEventTextMessage;
|
||||
MXWeakify(self);
|
||||
[roomCellData lastEventText:^(NSString *text) {
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
self.lastEventDescription.text = text;
|
||||
}];
|
||||
}
|
||||
|
||||
self.unsentImageView.hidden = roomCellData.roomSummary.room.sentStatus == RoomSentStatusOk;
|
||||
|
|
|
@ -76,11 +76,11 @@
|
|||
NSComparator comparator = ^NSComparisonResult(MXKRecentCellData *recentCellData1, MXKRecentCellData *recentCellData2) {
|
||||
|
||||
NSComparisonResult result = NSOrderedAscending;
|
||||
if (recentCellData2.roomSummary.lastMessageOriginServerTs > recentCellData1.roomSummary.lastMessageOriginServerTs)
|
||||
if (recentCellData2.roomSummary.lastMessage.originServerTs > recentCellData1.roomSummary.lastMessage.originServerTs)
|
||||
{
|
||||
result = NSOrderedDescending;
|
||||
}
|
||||
else if (recentCellData2.roomSummary.lastMessageOriginServerTs == recentCellData1.roomSummary.lastMessageOriginServerTs)
|
||||
else if (recentCellData2.roomSummary.lastMessage.originServerTs == recentCellData1.roomSummary.lastMessage.originServerTs)
|
||||
{
|
||||
result = NSOrderedSame;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue