Respond to CR.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-06-20 13:12:51 -04:00
parent 5796bbd858
commit de453b2960
2 changed files with 8 additions and 6 deletions

View File

@ -3812,8 +3812,7 @@ typedef enum : NSUInteger {
- (void)updateBackButtonUnreadCount
{
AssertIsOnMainThread();
// Max out the unread count at 99.
self.backButtonUnreadCount = MIN((NSUInteger)99, [self.messagesManager unreadMessagesCountExcept:self.thread]);
self.backButtonUnreadCount = [self.messagesManager unreadMessagesCountExcept:self.thread];
}
- (void)setBackButtonUnreadCount:(NSUInteger)unreadCount
@ -3829,7 +3828,10 @@ typedef enum : NSUInteger {
_backButtonUnreadCountView.hidden = unreadCount <= 0;
OWSAssert(_backButtonUnreadCountLabel != nil);
_backButtonUnreadCountLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)unreadCount];
// Max out the unread count at 99+.
const NSUInteger kMaxUnreadCount = 99;
_backButtonUnreadCountLabel.text = [@(MIN(kMaxUnreadCount, unreadCount)) stringValue];
}
#pragma mark 3D Touch Preview Actions

View File

@ -117,8 +117,6 @@ const NSUInteger kContactPictureViewDiameter = 52;
NSAttributedString *attributedDate = [self dateAttributedString:thread.lastMessageDate];
NSUInteger unreadCount = [[TSMessagesManager sharedManager] unreadMessagesInThread:thread];
// Max out the per-thread unread count at 99.
unreadCount = MIN((NSUInteger)99, unreadCount);
self.nameLabel.text = name;
self.snippetLabel.attributedText = snippetText;
@ -220,7 +218,9 @@ const NSUInteger kContactPictureViewDiameter = 52;
[_messageCounter addSubview:_unreadLabel];
}
_unreadLabel.text = [[NSNumber numberWithUnsignedInteger:unreadMessages] stringValue];
// Max out the unread count at 99+.
const NSUInteger kMaxUnreadCount = 99;
_unreadLabel.text = [@(MIN(kMaxUnreadCount, unreadMessages)) stringValue];
[_unreadLabel sizeToFit];
CGPoint offset = CGPointMake(0.0f, 5.0f);