summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-03-17 18:19:06 +0300
committerGravatar Vitaly Takmazov2022-03-17 18:19:06 +0300
commit055bec9d20331a0a5cd95bcd4038b6d4b2a6507e (patch)
tree60dd2ec8fb11696aa6cc838746f1dd45e722a51f /Juick
parent9fd5d1f8f158c943d60196f5710ec5c53adf13d0 (diff)
Fix itemToScroll calculation
Diffstat (limited to 'Juick')
-rw-r--r--Juick/ViewControllers/MessagesViewController.m4
1 files changed, 2 insertions, 2 deletions
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index aae1593..fb3f63b 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -87,8 +87,8 @@ NSString* const messageCellIdentifier = @"messageCell";
if (self.shouldScrollToUnreadOnRefresh) {
NSInteger messagesCount = [self.messages count];
if (messagesCount > 0) {
- NSInteger itemToScroll = [self.firstUnread integerValue] ? : self.messages.count - 1;
- NSIndexPath *lastRow = [NSIndexPath indexPathForRow:MIN(itemToScroll, messagesCount - 1) inSection:0];
+ NSInteger itemToScroll = MIN([self.firstUnread integerValue], self.messages.count - 1);
+ NSIndexPath *lastRow = [NSIndexPath indexPathForRow:itemToScroll inSection:0];
[self.tableView scrollToRowAtIndexPath:lastRow atScrollPosition:UITableViewScrollPositionBottom animated:NO];
}
self.firstUnread = nil;