Эх сурвалжийг харах

Change name to getNotificationsOfServer

Marino Faggiana 8 жил өмнө
parent
commit
fb3514ade5

+ 1 - 1
Libraries external/OCCommunicationLib/OCCommunicationLib/OCCommunication.h

@@ -769,6 +769,6 @@ typedef enum {
 /// @name Get the server Notification
 ///-----------------------------------
 
-- (void) getNotificationsOfTheServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfNotifications, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
+- (void) getNotificationsOfServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfNotifications, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
 
 @end

+ 7 - 5
Libraries external/OCCommunicationLib/OCCommunicationLib/OCCommunication.m

@@ -1287,7 +1287,7 @@
 
 #pragma mark - Get Notification Server
 
-- (void) getNotificationsOfTheServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfNotifications, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest{
+- (void) getNotificationsOfServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfNotifications, 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];
@@ -1295,7 +1295,7 @@
     OCWebDAVClient *request = [OCWebDAVClient new];
     request = [self getRequestWithCredentials:request];
     
-    [request getNotificationsOfTheServer:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
+    [request getNotificationsOfServer:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
         
         NSData *responseData = (NSData*) responseObject;
         
@@ -1323,7 +1323,11 @@
                     notification.idNotification = [[data valueForKey:@"notification_id"] integerValue];
                     notification.app = [data valueForKey:@"app"];
                     notification.user = [data valueForKey:@"user"];
-                    notification.date = [data valueForKey:@"datetime"];
+                    
+                    NSString *dateString = [data valueForKey:@"datetime"];
+                    NSISO8601DateFormatter *formatter = [[NSISO8601DateFormatter alloc] init];
+                    notification.date = [formatter dateFromString:dateString];
+                    
                     notification.typeObject = [data valueForKey:@"object_type"];
                     notification.idObject = [data valueForKey:@"object_id"];
                     notification.subject = [data valueForKey:@"subject"];
@@ -1349,7 +1353,6 @@
                 
                 NSError *error = [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message];
                 failureRequest(response, error, request.redirectedServer);
-
             }
         }
     
@@ -1359,7 +1362,6 @@
     } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
         failureRequest(response, error, request.redirectedServer);
     }];
-
 }
 
 #pragma mark - Clear Cache

+ 1 - 1
Libraries external/OCCommunicationLib/OCCommunicationLib/OCNotifications.h

@@ -13,7 +13,7 @@
 @property NSInteger idNotification;
 @property (nonatomic, strong) NSString *app;
 @property (nonatomic, strong) NSString *user;
-@property long date;
+@property (nonatomic, strong) NSDate *date;
 @property (nonatomic, strong) NSString *typeObject;
 @property (nonatomic, strong) NSString *idObject;
 @property (nonatomic, strong) NSString *subject;

+ 2 - 2
Libraries external/OCCommunicationLib/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h

@@ -472,6 +472,6 @@ extern NSString * _Nullable OCWebDAVModificationDateKey;
 /// @name Get the server notification
 ///-----------------------------------
 
-- (void) getNotificationsOfTheServer:(NSString * _Nonnull)serverPath onCommunication:(OCCommunication * _Nonnull)sharedOCComunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response))success
-                         failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id  _Nullable responseObject, NSError * _Nonnull error))failure;
+- (void) getNotificationsOfServer:(NSString * _Nonnull)serverPath onCommunication:(OCCommunication * _Nonnull)sharedOCComunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response))success
+                          failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id  _Nullable responseObject, NSError * _Nonnull error))failure;
 @end

+ 2 - 2
Libraries external/OCCommunicationLib/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -622,8 +622,8 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
 
 #pragma mark - Get Notification
 
-- (void) getNotificationsOfTheServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
-                             failure:(void(^)(NSHTTPURLResponse *operation, id  _Nullable responseObject, NSError *error))failure{
+- (void) getNotificationsOfServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
+                          failure:(void(^)(NSHTTPURLResponse *operation, id  _Nullable responseObject, NSError *error))failure{
     
     _requestMethod = @"GET";
 

+ 1 - 0
iOSClient/AppDelegate.h

@@ -72,6 +72,7 @@
 @property BOOL hasServerShareeSupport;
 @property BOOL hasServerCapabilitiesSupport;
 @property OCCapabilities *capabilities;
+@property (nonatomic, strong) NSArray *listOfNotifications;
 
 // Network Operation
 @property (nonatomic, strong) NSOperationQueue *netQueue;

+ 20 - 20
iOSClient/CCGlobal.h

@@ -254,26 +254,26 @@ extern NSString *const BKPasscodeKeychainServiceName;
 #define selectorUploadRemovePhoto       @"uploadRemovePhoto"
 
 // Metadata.Net ACTION
-#define actionCreateFolder                  @"createFolder"
-#define actionDeleteFileDirectory           @"deleteFileOrFolder"
-#define actionDownloadFile                  @"downloadFile"
-#define actionDownloadThumbnail             @"downloadThumbnail"
-#define actionGetCapabilities               @"getCapabilitiesOfServer"
-#define actionGetFeaturesSuppServer         @"getFeaturesSupportedByServer"
-#define actionGetUserAndGroup               @"getUserAndGroup"
-#define actionGetNotificationsOfTheServer   @"getNotificationsOfTheServer"
-#define actionMoveFileOrFolder              @"moveFileOrFolder"
-#define actionReadFile                      @"readFile"
-#define actionReadFolder                    @"readFolder"
-#define actionReadShareServer               @"readShareServer"
-#define actionShare                         @"share"
-#define actionShareWith                     @"shareWith"
-#define actionUnShare                       @"unShare"
-#define actionUpdateShare                   @"updateShare"
-#define actionUploadFile                    @"uploadFile"
-#define actionUploadAsset                   @"uploadAsset"
-#define actionUploadTemplate                @"uploadTemplate"
-#define actionUploadOnlyPlist               @"uploadOnlyPlist"
+#define actionCreateFolder              @"createFolder"
+#define actionDeleteFileDirectory       @"deleteFileOrFolder"
+#define actionDownloadFile              @"downloadFile"
+#define actionDownloadThumbnail         @"downloadThumbnail"
+#define actionGetCapabilities           @"getCapabilitiesOfServer"
+#define actionGetFeaturesSuppServer     @"getFeaturesSupportedByServer"
+#define actionGetUserAndGroup           @"getUserAndGroup"
+#define actionGetNotificationsOfServer  @"getNotificationsOfServer"
+#define actionMoveFileOrFolder          @"moveFileOrFolder"
+#define actionReadFile                  @"readFile"
+#define actionReadFolder                @"readFolder"
+#define actionReadShareServer           @"readShareServer"
+#define actionShare                     @"share"
+#define actionShareWith                 @"shareWith"
+#define actionUnShare                   @"unShare"
+#define actionUpdateShare               @"updateShare"
+#define actionUploadFile                @"uploadFile"
+#define actionUploadAsset               @"uploadAsset"
+#define actionUploadTemplate            @"uploadTemplate"
+#define actionUploadOnlyPlist           @"uploadOnlyPlist"
 
 // Tipi di sorgente directory
 #define sorceDirectoryAccount           0

+ 1 - 1
iOSClient/Main/CCMain.m

@@ -1049,7 +1049,7 @@
         metadataNet.action = actionGetCapabilities;
         [app addNetworkingOperationQueue:app.netQueue delegate:self metadataNet:metadataNet];
         
-        metadataNet.action = actionGetNotificationsOfTheServer;
+        metadataNet.action = actionGetNotificationsOfServer;
         [app addNetworkingOperationQueue:app.netQueue delegate:self metadataNet:metadataNet];
         
         metadataNet.action = actionReadFile;

+ 3 - 0
iOSClient/Networking/OCNetworking.h

@@ -95,6 +95,9 @@
 - (void)getCapabilitiesOfServerSuccess:(OCCapabilities *)capabilities;
 - (void)getInfoServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
 
+// Notification
+- (void)getNotificationsOfServerSuccess:(NSArray *)listOfNotifications;
+
 // HUD
 - (void)progressTask:(NSString *)fileID serverUrl:(NSString *)serverUrl cryptated:(BOOL)cryptated progress:(float)progress;
 

+ 2 - 2
iOSClient/Networking/OCNetworking.m

@@ -935,14 +935,14 @@
 #pragma mark =====  Notification =====
 #pragma --------------------------------------------------------------------------------------------
 
-- (void)getNotificationsOfTheServer
+- (void)getNotificationsOfServer
 {
     OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
     
     [communication setCredentialsWithUser:_activeUser andPassword:_activePassword];
     [communication setUserAgent:[CCUtility getUserAgent:_typeCloud]];
     
-    [communication getNotificationsOfTheServer:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfNotifications, NSString *redirectedServer) {
+    [communication getNotificationsOfServer:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfNotifications, NSString *redirectedServer) {
         
         [self complete];