Permalink
Browse files

Merge pull request #107 from TomKremer/master

AFNetworking 2.0.x migration
  • Loading branch information...
2 parents 1ff9d89 + bac04e8 commit c42dd295fde1e40be7fd91fca1ee14982aeb9ee5 @kylebrowning committed Jun 26, 2014
Showing with 136 additions and 187 deletions.
  1. +3 −3 DIOSCSRFAFHTTPClient.h
  2. +13 −13 DIOSCSRFAFHTTPClient.m
  3. +1 −1 DIOSComment.h
  4. +6 −20 DIOSComment.m
  5. +1 −1 DIOSEntity.h
  6. +7 −18 DIOSEntity.m
  7. +1 −0 DIOSFile.h
  8. +4 −9 DIOSFile.m
  9. +1 −1 DIOSNode.h
  10. +8 −22 DIOSNode.m
  11. +8 −4 DIOSSession.h
  12. +40 −24 DIOSSession.m
  13. +1 −1 DIOSSystem.h
  14. +2 −5 DIOSSystem.m
  15. +8 −13 DIOSTaxonomy.m
  16. +1 −2 DIOSUser.h
  17. +10 −36 DIOSUser.m
  18. +2 −1 DIOSView.h
  19. +4 −5 DIOSView.m
  20. +2 −2 README.md
  21. +8 −1 Settings.h
  22. +5 −5 drupal-ios-sdk.podspec
View
@@ -6,11 +6,11 @@
// Copyright (c) 2013 Zoltán Váradi. All rights reserved.
//
-#import "AFHTTPClient.h"
+#import "AFHTTPRequestOperationManager.h"
-@interface DIOSCSRFAFHTTPClient : AFHTTPClient
+@interface DIOSCSRFAFHTTPClient : AFHTTPRequestOperationManager
- (NSString*)getCSRFToken;
-(void)getCSRFTokenWithSuccess:(void (^)(NSString *csrfToken))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
-@end
+@end
View
@@ -31,22 +31,22 @@ -(void)getCSRFTokenWithSuccess:(void (^)(NSString *csrfToken))success
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
failure(operation, error);
}];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
}
- (void)postPath:(NSString *)path
parameters:(NSDictionary *)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure {
[self getCSRFTokenWithSuccess:^(NSString *csrfToken) {
- NSMutableURLRequest *request = [self requestWithMethod:@"POST" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:path parameters:parameters error:nil];
[request setValue: csrfToken forHTTPHeaderField:@"X-CSRF-Token"];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
} failure:^(AFHTTPRequestOperation *csrfOperation, NSError *error) {
- NSURLRequest *request = [self requestWithMethod:@"POST" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:path parameters:parameters error:nil];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
}];
}
@@ -55,14 +55,14 @@ - (void)putPath:(NSString *)path
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure {
[self getCSRFTokenWithSuccess:^(NSString *csrfToken) {
- NSMutableURLRequest *request = [self requestWithMethod:@"PUT" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"PUT" URLString:path parameters:parameters error:nil];
[request setValue: csrfToken forHTTPHeaderField:@"X-CSRF-Token"];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
} failure:^(AFHTTPRequestOperation *csrfOperation, NSError *error) {
- NSURLRequest *request = [self requestWithMethod:@"PUT" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"PUT" URLString:path parameters:parameters error:nil];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
}];
}
@@ -71,14 +71,14 @@ - (void)deletePath:(NSString *)path
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure {
[self getCSRFTokenWithSuccess:^(NSString *csrfToken) {
- NSMutableURLRequest *request = [self requestWithMethod:@"DELETE" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"DELETE" URLString:path parameters:parameters error:nil];
[request setValue: csrfToken forHTTPHeaderField:@"X-CSRF-Token"];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
} failure:^(AFHTTPRequestOperation *csrfOperation, NSError *error) {
- NSURLRequest *request = [self requestWithMethod:@"DELETE" path:path parameters:parameters];
+ NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"DELETE" URLString:path parameters:parameters error:nil];
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
- [self enqueueHTTPRequestOperation:operation];
+ [self.operationQueue addOperation:operation];
}];
}
View
@@ -66,4 +66,4 @@
+ (void)commentIndex:(NSDictionary *)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-@end
+@end
View
@@ -38,6 +38,7 @@
#import "DIOSComment.h"
#import "DIOSSession.h"
+
@implementation DIOSComment
@@ -55,10 +56,7 @@ + (void)commentGet:(NSDictionary *)comment
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:nil
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:nil success:success failure:failure];
}
}
@@ -76,10 +74,7 @@ + (void)commentSave:(NSDictionary *)comment
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] postPath:path
- parameters:comment
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:comment success:success failure:failure];
}
}
@@ -97,10 +92,7 @@ + (void)commentUpdate:(NSDictionary *)comment
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] putPath:path
- parameters:comment
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] PUT:path parameters:comment success:success failure:failure];
}
}
@@ -119,10 +111,7 @@ + (void)commentDelete:(NSDictionary *)comment
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] deletePath:path
- parameters:comment
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] DELETE:path parameters:comment success:success failure:failure];
}
}
@@ -156,10 +145,7 @@ + (void)commentIndex:(NSDictionary *)params
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:params
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:params success:success failure:failure];
}
}
@end
View
@@ -61,4 +61,4 @@
eid:(NSString*)eId
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-@end
+@end
View
@@ -36,7 +36,8 @@
#import "DIOSEntity.h"
#import "DIOSSession.h"
-#import "AFJSONRequestOperation.h"
+#import "AFHTTPRequestOperation.h"
+
@implementation DIOSEntity
#pragma mark nodeGets
@@ -55,10 +56,7 @@ + (void)entityGet:(NSDictionary *)entity
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:nil
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:nil success:success failure:failure];
}
}
@@ -78,10 +76,7 @@ + (void)entitySave:(NSDictionary *)entity
failure:failure];
}
else {
- [[DIOSSession sharedSession] postPath:path
- parameters:entity
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:entity success:success failure:failure];
}
}
@@ -102,10 +97,7 @@ + (void)entityUpdate:(NSDictionary *)entity
failure:failure];
}
else {
- [[DIOSSession sharedSession] putPath:path
- parameters:entity
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] PUT:path parameters:entity success:success failure:failure];
}
}
@@ -126,10 +118,7 @@ + (void)entityDelete:(NSDictionary *)entity
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] deletePath:path
- parameters:entity
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] DELETE:path parameters:entity success:success failure:failure];
}
}
-@end
+@end
View
@@ -34,6 +34,7 @@
// file under either the MPL or the GPL.
//
// ***** END LICENSE BLOCK *****
+
#import "AFHTTPRequestOperation.h"
@interface DIOSFile : NSObject
View
@@ -38,6 +38,7 @@
#import "DIOSFile.h"
#import "UIImageView+AFNetworking.h"
#import "DIOSSession.h"
+
@implementation DIOSFile
+ (void) fileGet:(NSDictionary *)params
@@ -52,10 +53,7 @@ + (void) fileGet:(NSDictionary *)params
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:params
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:params success:success failure:failure];
}
}
@@ -71,10 +69,7 @@ + (void)fileSave:(NSDictionary *)file
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] postPath:path
- parameters:file
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:file success:success failure:failure];
}
}
+ (UIImageView *) getImageViewForFileImage:(NSDictionary *) file; {
@@ -83,4 +78,4 @@ + (UIImageView *) getImageViewForFileImage:(NSDictionary *) file; {
[remoteImage setImageWithURL:url];
return remoteImage;
}
-@end
+@end
View
@@ -66,4 +66,4 @@
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
-@end
+@end
View
@@ -36,7 +36,8 @@
#import "DIOSNode.h"
#import "DIOSSession.h"
-#import "AFJSONRequestOperation.h"
+#import "AFHTTPRequestOperation.h"
+
@implementation DIOSNode
#pragma mark nodeGets
@@ -53,10 +54,7 @@ + (void)nodeGet:(NSDictionary *)node
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:nil
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:nil success:success failure:failure];
}
}
@@ -75,10 +73,7 @@ + (void)nodeSave:(NSDictionary *)node
failure:failure];
}
else {
- [[DIOSSession sharedSession] postPath:path
- parameters:node
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] POST:path parameters:node success:success failure:failure];
}
}
@@ -97,10 +92,7 @@ + (void)nodeUpdate:(NSDictionary *)node
failure:failure];
}
else {
- [[DIOSSession sharedSession] putPath:path
- parameters:node
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] PUT:path parameters:node success:success failure:failure];
}
}
@@ -119,10 +111,7 @@ + (void)nodeDelete:(NSDictionary *)node
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] deletePath:path
- parameters:node
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] DELETE:path parameters:node success:success failure:failure];
}
}
#pragma mark nodeIndex
@@ -154,11 +143,8 @@ + (void)nodeIndex:(NSDictionary *)params
success:success
failure:failure];
} else {
- [[DIOSSession sharedSession] getPath:path
- parameters:params
- success:success
- failure:failure];
+ [[DIOSSession sharedSession] GET:path parameters:params success:success failure:failure];
}
}
-@end
+@end
Oops, something went wrong.

0 comments on commit c42dd29

Please sign in to comment.