From 6499148cb3f62e20534b62c181125ebeacfa3438 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 27 Sep 2017 22:24:38 +0300 Subject: cleanup --- Juick/Model/Message.h | 5 ----- Juick/Model/Message.m | 37 ------------------------------------- Juick/Model/User.h | 2 +- 3 files changed, 1 insertion(+), 43 deletions(-) (limited to 'Juick/Model') diff --git a/Juick/Model/Message.h b/Juick/Model/Message.h index 438f693..1b41315 100644 --- a/Juick/Model/Message.h +++ b/Juick/Model/Message.h @@ -21,9 +21,4 @@ @property NSString *repliesBy; @property NSNumber *repliesCount; -+(void) pullNextFromPath:(NSString *)path params:(NSDictionary *)params callback:(void(^)(NSArray *))callback; -+(NSString *) messagesUrl; -+(NSString *) threadUrl; -+(NSString *) feedUrl; - @end 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 diff --git a/Juick/Model/User.h b/Juick/Model/User.h index 84300f3..ca84d50 100644 --- a/Juick/Model/User.h +++ b/Juick/Model/User.h @@ -7,7 +7,7 @@ // #import -#import "PDKeychainBindings.h" +@import PDKeychainBindingsController; #import "SIAlertView.h" #import "APIClient.h" #import "YYModel.h" -- cgit v1.2.3