dateTime to spec

read should be gray
unread should be bold and black

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 91f4f38c02
commit c693beb763

@ -186,8 +186,15 @@ NS_ASSUME_NONNULL_BEGIN
self.snippetLabel.attributedText = self.snippetLabel.attributedText =
[self attributedSnippetForThread:thread blockedPhoneNumberSet:blockedPhoneNumberSet]; [self attributedSnippetForThread:thread blockedPhoneNumberSet:blockedPhoneNumberSet];
self.dateTimeLabel.attributedText = [self attributedStringForDate:thread.lastMessageDate]; self.dateTimeLabel.text = [self stringForDate:thread.lastMessageDate];
self.dateTimeLabel.textColor = hasUnreadMessages ? [UIColor ows_materialBlueColor] : [UIColor ows_darkGrayColor];
if (hasUnreadMessages) {
self.dateTimeLabel.textColor = [UIColor ows_blackColor];
self.dateTimeLabel.font = self.dateTimeFont.ows_mediumWeight;
} else {
self.dateTimeLabel.textColor = [UIColor lightGrayColor];
self.dateTimeLabel.font = self.dateTimeFont;
}
NSUInteger unreadCount = [[OWSMessageUtils sharedManager] unreadMessagesInThread:thread]; NSUInteger unreadCount = [[OWSMessageUtils sharedManager] unreadMessagesInThread:thread];
if (unreadCount > 0) { if (unreadCount > 0) {
@ -284,11 +291,11 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Date formatting #pragma mark - Date formatting
- (NSAttributedString *)attributedStringForDate:(nullable NSDate *)date - (NSString *)stringForDate:(nullable NSDate *)date
{ {
if (date == nil) { if (date == nil) {
OWSProdLogAndFail(@"%@ date was unexpectedly nil", self.logTag); OWSProdLogAndFail(@"%@ date was unexpectedly nil", self.logTag);
return [NSAttributedString new]; return @"";
} }
NSString *dateTimeString; NSString *dateTimeString;
@ -302,11 +309,7 @@ NS_ASSUME_NONNULL_BEGIN
dateTimeString = [[DateUtil timeFormatter] stringFromDate:date]; dateTimeString = [[DateUtil timeFormatter] stringFromDate:date];
} }
return [[NSAttributedString alloc] initWithString:dateTimeString.uppercaseString return dateTimeString.uppercaseString;
attributes:@{
NSForegroundColorAttributeName : [UIColor blackColor],
NSFontAttributeName : self.dateTimeFont,
}];
} }
#pragma mark - Constants #pragma mark - Constants

Loading…
Cancel
Save