|
@@ -37,6 +37,8 @@
|
|
|
#import "AFURLSessionManager.h"
|
|
|
#import "OCShareUser.h"
|
|
|
#import "OCCapabilities.h"
|
|
|
+#import "OCNotifications.h"
|
|
|
+#import "OCXMLNotificationsParser.h"
|
|
|
|
|
|
@interface OCCommunication ()
|
|
|
|
|
@@ -1284,7 +1286,7 @@
|
|
|
|
|
|
#pragma mark - Get Notification Server
|
|
|
|
|
|
-- (void) getNotificationsOfTheServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, OCCapabilities *capabilities, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest{
|
|
|
+- (void) getNotificationsOfTheServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, OCNotifications *notifications, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest{
|
|
|
|
|
|
serverPath = [serverPath encodeString:NSUTF8StringEncoding];
|
|
|
serverPath = [serverPath stringByAppendingString:k_url_acces_remote_notification_api];
|
|
@@ -1292,15 +1294,16 @@
|
|
|
OCWebDAVClient *request = [OCWebDAVClient new];
|
|
|
request = [self getRequestWithCredentials:request];
|
|
|
|
|
|
-
|
|
|
[request getNotificationsOfTheServer:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
|
|
|
|
|
|
NSData *responseData = (NSData*) responseObject;
|
|
|
- OCXMLSharedParser *parser = [[OCXMLSharedParser alloc]init];
|
|
|
+ OCXMLNotificationsParser *parser = [[OCXMLNotificationsParser alloc] init];
|
|
|
|
|
|
[parser initParserWithData:responseData];
|
|
|
+ NSMutableArray *notificationsList = [parser.notificationsList mutableCopy];
|
|
|
|
|
|
- NSLog(@"parser");
|
|
|
+ //Return success
|
|
|
+ successRequest(response, notificationsList, request.redirectedServer);
|
|
|
|
|
|
} failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
|
|
|
failureRequest(response, error, request.redirectedServer);
|