summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/MessagesViewController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-20 00:03:10 +0300
committerGravatar Vitaly Takmazov2018-07-20 00:03:10 +0300
commite76034045b49064329d6834862e8c78ab8525c91 (patch)
treeffea8268d406db2533f27f8ab9c9c49d6cd1ac6d /Juick/ViewControllers/MessagesViewController.m
parentc988224d13f63702c3cb3147c4b9f9a4ddbec212 (diff)
Pull-to-refresh fix
Diffstat (limited to 'Juick/ViewControllers/MessagesViewController.m')
-rw-r--r--Juick/ViewControllers/MessagesViewController.m8
1 files changed, 8 insertions, 0 deletions
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index a37f502..957fce5 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -31,6 +31,10 @@
self.dataLoading = YES;
[[APIClient sharedClient] pullNextFromPath:self.path params:self.params callback:^(NSArray *next, NSError *err) {
NSArray *newMsgs = next;
+ if ([self isAtTop:self.params]) {
+ [self.messages removeAllObjects];
+ [self.tableView reloadData];
+ }
NSUInteger oldCount = [self.messages count];
if ([self.path isEqualToString:[APIClient threadUrl]]) {
NSUInteger lastRid = [((Message *)[self.messages lastObject]).rid unsignedIntegerValue] + 1;
@@ -60,6 +64,10 @@
}];
}
+-(BOOL) isAtTop:(NSDictionary *)params {
+ return [params objectForKey:@"before_mid"] == nil && [params objectForKey:@"to"] == nil;
+}
+
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;