diff options
author | Vitaly Takmazov | 2022-01-21 13:11:52 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-01-21 13:11:52 +0300 |
commit | 9c3f889282816c3b7dcfb19e29fc1653e103c515 (patch) | |
tree | 6e4f415854e91792d9293c506d1e78875bba6b71 /Juick/ViewControllers/MessagesViewController.m | |
parent | d78dea95523e56917574dc8f480878d35ef2fbad (diff) |
Fix pull to refresh
* reset ?before_mid on pull to refresh
Diffstat (limited to 'Juick/ViewControllers/MessagesViewController.m')
-rw-r--r-- | Juick/ViewControllers/MessagesViewController.m | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m index 0fb04ac..4277578 100644 --- a/Juick/ViewControllers/MessagesViewController.m +++ b/Juick/ViewControllers/MessagesViewController.m @@ -98,6 +98,13 @@ NSString* const messageCellIdentifier = @"messageCell"; } } +-(void) refreshControlActivated { + NSMutableDictionary *refreshedParams = [self.params mutableCopy]; + refreshedParams[@"before_mid"] = nil; + self.params = refreshedParams; + [self refreshData]; +} + -(BOOL) isAtTop:(NSDictionary *)params { return [params objectForKey:@"before_mid"] == nil && [params objectForKey:@"to"] == nil; } @@ -120,7 +127,7 @@ NSString* const messageCellIdentifier = @"messageCell"; } #if !TARGET_OS_MACCATALYST self.refreshControl = [UIRefreshControl new]; - [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged]; + [self.refreshControl addTarget:self action:@selector(refreshControlActivated) forControlEvents:UIControlEventValueChanged]; #endif [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(newMessage:) name:NewMessageNotificationName object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationActivated) name:UIApplicationDidBecomeActiveNotification object:nil]; |