summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
Diffstat (limited to 'Juick')
-rw-r--r--Juick/API.m2
-rw-r--r--Juick/ViewControllers/MessagesViewController.h1
-rw-r--r--Juick/ViewControllers/MessagesViewController.m9
3 files changed, 10 insertions, 2 deletions
diff --git a/Juick/API.m b/Juick/API.m
index 4c3edc2..9958d1c 100644
--- a/Juick/API.m
+++ b/Juick/API.m
@@ -245,7 +245,7 @@ NSString * const JuickErrorDomain = @"JuickErrorDomain";
-(void) get:(NSString *) path params:(NSDictionary *)params callback:(void(^)(NSDictionary *, NSError *))callback {
NSURL *url = [NSURL URLWithString:path relativeToURL:self.baseURL];
- NSURL *requestUrl = params ? [self url:url withParameters:params] : url;
+ NSURL *requestUrl = params && params.count ? [self url:url withParameters:params] : url;
[self fetchDataWithURL:requestUrl data:nil boundary:nil authorizationHeader:self.authorizationHeader callback:^(NSData *data, NSError *err) {
if (err) {
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
diff --git a/Juick/ViewControllers/MessagesViewController.h b/Juick/ViewControllers/MessagesViewController.h
index d2fc935..3b466f0 100644
--- a/Juick/ViewControllers/MessagesViewController.h
+++ b/Juick/ViewControllers/MessagesViewController.h
@@ -22,6 +22,7 @@ extern NSString* const messageCellIdentifier;
@property(nonatomic, assign) BOOL shouldAllowToSelectText;
@property(nonatomic) NSNumber * firstUnread;
-(void) refreshData;
+-(void) refreshControlActivated;
-(void) viewThreadForMessage:(Message *)msg mid:(NSNumber *)mid scrollTo:(NSNumber *)rid;
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];