summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/MessagesViewController.m
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/ViewControllers/MessagesViewController.m')
-rw-r--r--Juick/ViewControllers/MessagesViewController.m16
1 files changed, 12 insertions, 4 deletions
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index 80e8c73..823d838 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -23,7 +23,11 @@
@implementation MessagesViewController
-- (void) refreshData {
+-(void) refreshData {
+ [self refreshData:NO];
+}
+
+-(void) refreshData:(BOOL)scrollToBottom {
self.dataLoading = YES;
[[APIClient sharedClient] pullNextFromPath:self.path params:self.params callback:^(NSArray *next, NSError *err) {
NSArray *newMsgs = next;
@@ -49,6 +53,10 @@
[self.tableView endUpdates];
[self.refreshControl endRefreshing];
self.dataLoading = NO;
+ if (scrollToBottom) {
+ NSIndexPath *lastRow = [NSIndexPath indexPathForRow:self.messages.count - 1 inSection:0];
+ [self.tableView scrollToRowAtIndexPath:lastRow atScrollPosition:UITableViewScrollPositionBottom animated:YES];
+ }
}];
}
@@ -75,7 +83,7 @@
if ([self.path length] == 0) {
self.path = [APIClient feedUrl];
}
- [self refreshData];
+ [self refreshData:NO];
} else {
[User throwUnableToLogin:self];
}
@@ -85,7 +93,7 @@
if ([self.path length] == 0) {
self.path = [APIClient messagesUrl];
}
- [self refreshData];
+ [self refreshData:NO];
}
}
@@ -119,7 +127,7 @@
if (![self.path isEqualToString:[APIClient threadUrl]]) {
self.params = [@{@"before_mid":lastMid} mutableCopy];
}
- [self refreshData];
+ [self refreshData:NO];
}
}
}