summaryrefslogtreecommitdiff
path: root/Juick/Model
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/Model')
-rw-r--r--Juick/Model/Message.h5
-rw-r--r--Juick/Model/Message.m37
-rw-r--r--Juick/Model/User.h2
3 files changed, 1 insertions, 43 deletions
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 <Foundation/Foundation.h>
-#import "PDKeychainBindings.h"
+@import PDKeychainBindingsController;
#import "SIAlertView.h"
#import "APIClient.h"
#import "YYModel.h"