Refactored http communications to be more abstract and OOP

This commit is contained in:
Diego Waxemberg
2015-02-01 04:26:47 -05:00
parent 75d3f23f0a
commit 879f304a79
19 changed files with 460 additions and 240 deletions
+3 -1
View File
@@ -12,6 +12,7 @@
#import "Utils.h"
#import "DataManager.h"
#import "DiscoveryWorker.h"
#import "ServerInfoResponse.h"
@implementation DiscoveryManager {
NSMutableArray* _hostQueue;
@@ -39,7 +40,8 @@
- (void) discoverHost:(NSString *)hostAddress withCallback:(void (^)(Host *))callback {
HttpManager* hMan = [[HttpManager alloc] initWithHost:hostAddress uniqueId:_uniqueId deviceName:deviceName cert:_cert];
HttpResponse* serverInfoResponse = [hMan executeRequestSynchronously:[hMan newServerInfoRequest]];
ServerInfoResponse* serverInfoResponse = [[ServerInfoResponse alloc] init];
[hMan executeRequestSynchronously:[HttpRequest requestForResponse:serverInfoResponse withUrlRequest:[hMan newServerInfoRequest]]];
Host* host = nil;
if ([serverInfoResponse isStatusOk]) {