diff options
author | Vitaly Takmazov | 2017-09-27 22:24:38 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-09-27 22:24:38 +0300 |
commit | 6499148cb3f62e20534b62c181125ebeacfa3438 (patch) | |
tree | 3aa289caa409366e70dd1802d67df61903fa992b /Juick/Model/Message.m | |
parent | 25bc4f1357252dc0aeee70f0a638a4226231d5fb (diff) |
cleanup
Diffstat (limited to 'Juick/Model/Message.m')
-rw-r--r-- | Juick/Model/Message.m | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/Juick/Model/Message.m b/Juick/Model/Message.m index 4a6e96c..d4d6a88 100644 --- a/Juick/Model/Message.m +++ b/Juick/Model/Message.m @@ -7,7 +7,6 @@ // #import "Message.h" -#import "PDKeychainBindings.h" #import "AppDelegate.h" @implementation Message @@ -20,40 +19,4 @@ @"repliesCount": @"replies", @"repliesBy": @"repliesby"}; } - - -+(void) pullNextFromPath:(NSString *)path params:(NSDictionary *) params callback:(void(^)(NSArray *))callback { - AFHTTPSessionManager *manager = [APIClient sharedClient].manager; - if ([[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] != nil) { - manager.requestSerializer = [AFJSONRequestSerializer serializer]; - [manager.requestSerializer setAuthorizationHeaderFieldWithUsername:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] password:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]]; - } - [manager GET:path parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { - NSMutableArray *messages = [NSMutableArray new]; - [((NSArray *)responseObject) enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - [messages addObject:[Message yy_modelWithJSON:obj]]; - }]; - callback(messages); - } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { - NSLog(@"REST Error: %@", error); - NSInteger statusCode = ((NSHTTPURLResponse *)task.response).statusCode; - if (statusCode == 401) { - AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; - [appDelegate pushLoginForm]; - } - }]; -} - -+(NSString *) messagesUrl { - return @"https://api.juick.com/messages"; -} - -+(NSString *) threadUrl { - return @"https://api.juick.com/thread"; -} - -+(NSString *) feedUrl { - return @"https://api.juick.com/home"; -} - @end |