|
@@ -29,114 +29,17 @@
|
|
|
#import "NSString+Encode.h"
|
|
|
#import "NCBridgeSwift.h"
|
|
|
|
|
|
-#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
|
|
-
|
|
|
-@interface OCnetworking ()
|
|
|
-{
|
|
|
- NSString *_activeUser;
|
|
|
- NSString *_activeUserID;
|
|
|
- NSString *_activePassword;
|
|
|
- NSString *_activeUrl;
|
|
|
-}
|
|
|
-@end
|
|
|
-
|
|
|
@implementation OCnetworking
|
|
|
|
|
|
-- (id)initWithDelegate:(id)delegate metadataNet:(CCMetadataNet *)metadataNet withUser:(NSString *)withUser withUserID:(NSString *)withUserID withPassword:(NSString *)withPassword withUrl:(NSString *)withUrl
|
|
|
-{
|
|
|
- self = [super init];
|
|
|
-
|
|
|
- if (self) {
|
|
|
-
|
|
|
- _delegate = delegate;
|
|
|
-
|
|
|
- _metadataNet = [CCMetadataNet new];
|
|
|
- _metadataNet = [metadataNet copy];
|
|
|
-
|
|
|
- _activeUser = withUser;
|
|
|
- _activeUserID = withUserID;
|
|
|
- _activePassword = withPassword;
|
|
|
- _activeUrl = withUrl;
|
|
|
- }
|
|
|
-
|
|
|
- return self;
|
|
|
-}
|
|
|
-
|
|
|
-- (void)start
|
|
|
-{
|
|
|
- if (![NSThread isMainThread]) {
|
|
|
- [self performSelectorOnMainThread:@selector(start) withObject:nil waitUntilDone:NO];
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- [self willChangeValueForKey:@"isExecuting"];
|
|
|
- _isExecuting = YES;
|
|
|
- [self didChangeValueForKey:@"isExecuting"];
|
|
|
-
|
|
|
- if (self.isCancelled) {
|
|
|
-
|
|
|
- [self finish];
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- [self poolNetworking];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-- (void)finish
|
|
|
-{
|
|
|
- [self willChangeValueForKey:@"isExecuting"];
|
|
|
- [self willChangeValueForKey:@"isFinished"];
|
|
|
-
|
|
|
- _isExecuting = NO;
|
|
|
- _isFinished = YES;
|
|
|
-
|
|
|
- [self didChangeValueForKey:@"isExecuting"];
|
|
|
- [self didChangeValueForKey:@"isFinished"];
|
|
|
-}
|
|
|
-
|
|
|
-- (void)cancel
|
|
|
-{
|
|
|
- if (_isExecuting) {
|
|
|
-
|
|
|
- [self complete];
|
|
|
- }
|
|
|
-
|
|
|
- [super cancel];
|
|
|
-}
|
|
|
-
|
|
|
-- (void)poolNetworking
|
|
|
-{
|
|
|
-#ifndef EXTENSION
|
|
|
- [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
|
|
|
-#endif
|
|
|
-
|
|
|
- if([self respondsToSelector:NSSelectorFromString(_metadataNet.action)])
|
|
|
- [self performSelector:NSSelectorFromString(_metadataNet.action)];
|
|
|
-}
|
|
|
-
|
|
|
-#pragma --------------------------------------------------------------------------------------------
|
|
|
-#pragma mark ===== Delegate =====
|
|
|
-#pragma --------------------------------------------------------------------------------------------
|
|
|
-
|
|
|
-- (void)complete
|
|
|
-{
|
|
|
- [self finish];
|
|
|
-
|
|
|
-#ifndef EXTENSION
|
|
|
- [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
|
|
|
-#endif
|
|
|
-}
|
|
|
-
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
#pragma mark ===== Server =====
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
|
|
|
-- (void)checkServerUrl:(NSString *)serverUrl completion:(void (^)(NSString *message, NSInteger errorCode))completion
|
|
|
+- (void)checkServerUrl:(NSString *)serverUrl user:(NSString *)user userID:(NSString *)userID password:(NSString *)password completion:(void (^)(NSString *message, NSInteger errorCode))completion
|
|
|
{
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
- [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
|
|
|
+ [communication setCredentialsWithUser:user andUserID:userID andPassword:password];
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
[communication checkServer:serverUrl onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
@@ -177,7 +80,8 @@
|
|
|
[request addValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
|
|
|
|
|
|
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
|
|
|
- NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration delegate:self.delegate delegateQueue:nil];
|
|
|
+ //NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration delegate:self.delegate delegateQueue:nil];
|
|
|
+ NSURLSession *session;
|
|
|
|
|
|
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) {
|
|
|
|
|
@@ -650,8 +554,8 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
// Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
+ //if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
+ // [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
|
|
|
// Activity
|
|
|
[[NCManageDatabase sharedInstance] addActivityClient:serverUrl fileID:@"" action:k_activityDebugActionReadFolder selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:tableAccount.url];
|
|
@@ -727,13 +631,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:serverUrl fileID:@"" action:k_activityDebugActionReadFolder selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:tableAccount.url];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -824,10 +721,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -868,10 +761,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -964,10 +853,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1014,13 +899,6 @@
|
|
|
if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
|
|
|
errorCode = error.code;
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:path fileID:@"" action:k_activityDebugActionCreateFolder selector:@"" note:NSLocalizedString(@"_not_possible_create_folder_", nil) type:k_activityTypeFailure verbose:k_activityVerboseDefault activeUrl:tableAccount.url];
|
|
|
-
|
|
|
completion(account, nil, nil, message, errorCode);
|
|
|
|
|
|
} errorBeforeRequest:^(NSError *error) {
|
|
@@ -1074,13 +952,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionDeleteFileFolder selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:tableAccount.url];
|
|
|
-
|
|
|
completion(account, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1167,10 +1038,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1275,10 +1142,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1297,7 +1160,7 @@
|
|
|
[communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
- [communication shareWith:userOrGroup shareeType:shareeType inServer:[_activeUrl stringByAppendingString:@"/"] andFileOrFolderPath:[fileName encodeString:NSUTF8StringEncoding] andPermissions:permission onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
+ [communication shareWith:userOrGroup shareeType:shareeType inServer:[tableAccount.url stringByAppendingString:@"/"] andFileOrFolderPath:[fileName encodeString:NSUTF8StringEncoding] andPermissions:permission onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
|
|
|
//[self readShareServer];
|
|
|
completion(account, nil, 0);
|
|
@@ -1316,10 +1179,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1355,10 +1214,6 @@
|
|
|
} else {
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
-
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
|
|
|
completion(account, message, errorCode);
|
|
|
}];
|
|
@@ -1394,10 +1249,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1432,10 +1283,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1470,10 +1317,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1550,10 +1393,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1633,13 +1472,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionGetNotification selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:@""];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1674,10 +1506,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1745,9 +1573,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionSubscribingServerPush selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:@""];
|
|
|
-
|
|
|
completion(account, nil, nil, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1783,9 +1608,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionUnsubscribingPushProxy selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:@""];
|
|
|
-
|
|
|
completion(account, message, errorCode);
|
|
|
}];
|
|
|
|
|
@@ -1802,9 +1624,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionUnsubscribingServerPush selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:@""];
|
|
|
-
|
|
|
completion(account, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1843,10 +1662,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1885,13 +1700,6 @@
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
}
|
|
|
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
-
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionCapabilities selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:_activeUrl];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -1900,241 +1708,241 @@
|
|
|
#pragma mark ===== End-to-End Encryption =====
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
|
|
|
-- (void)getEndToEndPublicKeys
|
|
|
+- (void)getEndToEndPublicKeyWithAccount:(NSString *)account completion:(void (^)(NSString *account, NSString *publicKey, NSString *message, NSInteger errorCode))completion
|
|
|
{
|
|
|
+ tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
|
|
|
+ if (tableAccount == nil) {
|
|
|
+ completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
|
|
|
+ }
|
|
|
+
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
- [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
|
|
|
+ [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
- [communication getEndToEndPublicKeys:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer) {
|
|
|
+ [communication getEndToEndPublicKeys:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer) {
|
|
|
|
|
|
- _metadataNet.key = publicKey;
|
|
|
-
|
|
|
- if ([self.delegate respondsToSelector:@selector(getEndToEndPublicKeysSuccess:)])
|
|
|
- [self.delegate getEndToEndPublicKeysSuccess:_metadataNet];
|
|
|
-
|
|
|
- [self complete];
|
|
|
+ completion(account, publicKey, nil, 0);
|
|
|
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
|
|
|
|
|
+ NSString *message = @"";
|
|
|
NSInteger errorCode = response.statusCode;
|
|
|
if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
|
|
|
errorCode = error.code;
|
|
|
|
|
|
// Error
|
|
|
- if ([self.delegate respondsToSelector:@selector(getEndToEndPublicKeysFailure:message:errorCode:)])
|
|
|
- [self.delegate getEndToEndPublicKeysFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
|
|
|
-
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
+ if (errorCode == 503) {
|
|
|
+ message = NSLocalizedString(@"_server_error_retry_", nil);
|
|
|
+ } else {
|
|
|
+ message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
+ }
|
|
|
|
|
|
- [self complete];
|
|
|
+ completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-- (void)getEndToEndPrivateKeyCipher
|
|
|
+- (void)getEndToEndPrivateKeyCipherWithAccount:(NSString *)account completion:(void (^)(NSString *account, NSString *privateKeyChiper, NSString *message, NSInteger errorCode))completion
|
|
|
{
|
|
|
+ tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
|
|
|
+ if (tableAccount == nil) {
|
|
|
+ completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
|
|
|
+ }
|
|
|
+
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
- [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
|
|
|
+ [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
- [communication getEndToEndPrivateKeyCipher:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *privateKeyChiper, NSString *redirectedServer) {
|
|
|
-
|
|
|
- _metadataNet.key = privateKeyChiper;
|
|
|
-
|
|
|
- if ([self.delegate respondsToSelector:@selector(getEndToEndPrivateKeyCipherSuccess:)])
|
|
|
- [self.delegate getEndToEndPrivateKeyCipherSuccess:_metadataNet];
|
|
|
-
|
|
|
- [self complete];
|
|
|
+ [communication getEndToEndPrivateKeyCipher:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *privateKeyChiper, NSString *redirectedServer) {
|
|
|
|
|
|
+ completion(account, privateKeyChiper, nil, 0);
|
|
|
+
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
|
|
|
|
|
+ NSString *message = @"";
|
|
|
NSInteger errorCode = response.statusCode;
|
|
|
if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
|
|
|
errorCode = error.code;
|
|
|
|
|
|
// Error
|
|
|
- if ([self.delegate respondsToSelector:@selector(getEndToEndPrivateKeyCipherFailure:message:errorCode:)])
|
|
|
- [self.delegate getEndToEndPrivateKeyCipherFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
|
|
|
-
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
+ if (errorCode == 503) {
|
|
|
+ message = NSLocalizedString(@"_server_error_retry_", nil);
|
|
|
+ } else {
|
|
|
+ message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
+ }
|
|
|
|
|
|
- [self complete];
|
|
|
+ completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-- (void)signEndToEndPublicKey
|
|
|
+- (void)signEndToEndPublicKeyWithAccount:(NSString *)account publicKey:(NSString *)publicKey completion:(void (^)(NSString *account, NSString *publicKey, NSString *message, NSInteger errorCode))completion
|
|
|
{
|
|
|
+ tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
|
|
|
+ if (tableAccount == nil) {
|
|
|
+ completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
|
|
|
+ }
|
|
|
+
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
- // URL Encode
|
|
|
- NSString *publicKey = [CCUtility URLEncodeStringFromString:_metadataNet.key];
|
|
|
-
|
|
|
- [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
|
|
|
+ [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
- [communication signEndToEndPublicKey:[_activeUrl stringByAppendingString:@"/"] publicKey:publicKey onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer) {
|
|
|
+ [communication signEndToEndPublicKey:[tableAccount.url stringByAppendingString:@"/"] publicKey:[CCUtility URLEncodeStringFromString:publicKey] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer) {
|
|
|
|
|
|
- _metadataNet.key = publicKey;
|
|
|
-
|
|
|
- if ([self.delegate respondsToSelector:@selector(signEndToEndPublicKeySuccess:)])
|
|
|
- [self.delegate signEndToEndPublicKeySuccess:_metadataNet];
|
|
|
-
|
|
|
- [self complete];
|
|
|
+ completion(account, publicKey, nil, 0);
|
|
|
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
|
|
|
|
|
+ NSString *message = @"";
|
|
|
NSInteger errorCode = response.statusCode;
|
|
|
if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
|
|
|
errorCode = error.code;
|
|
|
|
|
|
// Error
|
|
|
- if ([self.delegate respondsToSelector:@selector(signEndToEndPublicKeyFailure:message:errorCode:)])
|
|
|
- [self.delegate signEndToEndPublicKeyFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
|
|
|
-
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
+ if (errorCode == 503) {
|
|
|
+ message = NSLocalizedString(@"_server_error_retry_", nil);
|
|
|
+ } else {
|
|
|
+ message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
+ }
|
|
|
|
|
|
- [self complete];
|
|
|
+ completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-- (void)storeEndToEndPrivateKeyCipher
|
|
|
+- (void)storeEndToEndPrivateKeyCipherWithAccount:(NSString *)account privateKeyChiper:(NSString *)privateKeyChiper completion:(void (^)(NSString *account, NSString *privateKey, NSString *message, NSInteger errorCode))completion
|
|
|
{
|
|
|
- OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
+ tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
|
|
|
+ if (tableAccount == nil) {
|
|
|
+ completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
|
|
|
+ }
|
|
|
|
|
|
- // URL Encode
|
|
|
- NSString *privateKeyChiper = [CCUtility URLEncodeStringFromString:_metadataNet.keyCipher];
|
|
|
+ OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
- [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
|
|
|
+ [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
- [communication storeEndToEndPrivateKeyCipher:[_activeUrl stringByAppendingString:@"/"] privateKeyChiper:privateKeyChiper onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *privateKey, NSString *redirectedServer) {
|
|
|
-
|
|
|
- if ([self.delegate respondsToSelector:@selector(storeEndToEndPrivateKeyCipherSuccess:)])
|
|
|
- [self.delegate storeEndToEndPrivateKeyCipherSuccess:_metadataNet];
|
|
|
+ [communication storeEndToEndPrivateKeyCipher:[tableAccount.url stringByAppendingString:@"/"] privateKeyChiper:[CCUtility URLEncodeStringFromString:privateKeyChiper] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *privateKey, NSString *redirectedServer) {
|
|
|
|
|
|
- [self complete];
|
|
|
+ completion(account, privateKey, nil, 0);
|
|
|
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
|
|
|
|
|
+ NSString *message = @"";
|
|
|
NSInteger errorCode = response.statusCode;
|
|
|
if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
|
|
|
errorCode = error.code;
|
|
|
|
|
|
// Error
|
|
|
- if ([self.delegate respondsToSelector:@selector(storeEndToEndPrivateKeyCipherFailure:message:errorCode:)])
|
|
|
- [self.delegate storeEndToEndPrivateKeyCipherFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
|
|
|
-
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
+ if (errorCode == 503) {
|
|
|
+ message = NSLocalizedString(@"_server_error_retry_", nil);
|
|
|
+ } else {
|
|
|
+ message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
+ }
|
|
|
|
|
|
- [self complete];
|
|
|
+ completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-- (void)deleteEndToEndPublicKey
|
|
|
+- (void)deleteEndToEndPublicKeyWithAccount:(NSString *)account completion:(void (^)(NSString *account, NSString *message, NSInteger errorCode))completion
|
|
|
{
|
|
|
+ tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
|
|
|
+ if (tableAccount == nil) {
|
|
|
+ completion(account, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
|
|
|
+ }
|
|
|
+
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
- [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
|
|
|
+ [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
- [communication deleteEndToEndPublicKey:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
-
|
|
|
- if ([self.delegate respondsToSelector:@selector(deleteEndToEndPublicKeySuccess:)])
|
|
|
- [self.delegate deleteEndToEndPublicKeySuccess:_metadataNet];
|
|
|
+ [communication deleteEndToEndPublicKey:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
|
|
|
- [self complete];
|
|
|
+ completion(account, nil ,0);
|
|
|
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
|
|
|
|
|
+ NSString *message = @"";
|
|
|
NSInteger errorCode = response.statusCode;
|
|
|
if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
|
|
|
errorCode = error.code;
|
|
|
|
|
|
// Error
|
|
|
- if ([self.delegate respondsToSelector:@selector(deleteEndToEndPublicKeyFailure:message:errorCode:)])
|
|
|
- [self.delegate deleteEndToEndPublicKeyFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
|
|
|
-
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
+ if (errorCode == 503) {
|
|
|
+ message = NSLocalizedString(@"_server_error_retry_", nil);
|
|
|
+ } else {
|
|
|
+ message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
+ }
|
|
|
|
|
|
- [self complete];
|
|
|
+ completion(account, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-- (void)deleteEndToEndPrivateKey
|
|
|
+- (void)deleteEndToEndPrivateKeyWithAccount:(NSString *)account completion:(void (^)(NSString *account, NSString *message, NSInteger errorCode))completion
|
|
|
{
|
|
|
+ tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
|
|
|
+ if (tableAccount == nil) {
|
|
|
+ completion(account, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
|
|
|
+ }
|
|
|
+
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
- [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
|
|
|
+ [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
- [communication deleteEndToEndPrivateKey:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
-
|
|
|
- if ([self.delegate respondsToSelector:@selector(deleteEndToEndPrivateKeySuccess:)])
|
|
|
- [self.delegate deleteEndToEndPrivateKeySuccess:_metadataNet];
|
|
|
+ [communication deleteEndToEndPrivateKey:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
|
|
|
- [self complete];
|
|
|
+ completion(account, nil, 0);
|
|
|
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
|
|
|
|
|
+ NSString *message = @"";
|
|
|
NSInteger errorCode = response.statusCode;
|
|
|
if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
|
|
|
errorCode = error.code;
|
|
|
|
|
|
// Error
|
|
|
- if ([self.delegate respondsToSelector:@selector(deleteEndToEndPrivateKeyFailure:message:errorCode:)])
|
|
|
- [self.delegate deleteEndToEndPrivateKeyFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
|
|
|
-
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
+ if (errorCode == 503) {
|
|
|
+ message = NSLocalizedString(@"_server_error_retry_", nil);
|
|
|
+ } else {
|
|
|
+ message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
+ }
|
|
|
|
|
|
- [self complete];
|
|
|
+ completion(account, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-- (void)getEndToEndServerPublicKey
|
|
|
+- (void)getEndToEndServerPublicKeyWithAccount:(NSString *)account completion:(void (^)(NSString *account, NSString *publicKey, NSString *message, NSInteger errorCode))completion
|
|
|
{
|
|
|
+ tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
|
|
|
+ if (tableAccount == nil) {
|
|
|
+ completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
|
|
|
+ }
|
|
|
+
|
|
|
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
|
|
|
|
|
- [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
|
|
|
+ [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
- [communication getEndToEndServerPublicKey:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer) {
|
|
|
-
|
|
|
- _metadataNet.key = publicKey;
|
|
|
-
|
|
|
- if ([self.delegate respondsToSelector:@selector(getEndToEndServerPublicKeySuccess:)])
|
|
|
- [self.delegate getEndToEndServerPublicKeySuccess:_metadataNet];
|
|
|
-
|
|
|
- [self complete];
|
|
|
+ [communication getEndToEndServerPublicKey:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer) {
|
|
|
|
|
|
+ completion(account, publicKey, nil, 0);
|
|
|
+
|
|
|
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
|
|
|
|
|
+ NSString *message = @"";
|
|
|
NSInteger errorCode = response.statusCode;
|
|
|
if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
|
|
|
errorCode = error.code;
|
|
|
|
|
|
// Error
|
|
|
- if ([self.delegate respondsToSelector:@selector(getEndToEndServerPublicKeyFailure:message:errorCode:)])
|
|
|
- [self.delegate getEndToEndServerPublicKeyFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
|
|
|
-
|
|
|
- // Request trusted certificated
|
|
|
- if ([error code] == NSURLErrorServerCertificateUntrusted && self.delegate)
|
|
|
- [[CCCertificate sharedManager] presentViewControllerCertificateWithTitle:[error localizedDescription] viewController:(UIViewController *)self.delegate delegate:self];
|
|
|
+ if (errorCode == 503) {
|
|
|
+ message = NSLocalizedString(@"_server_error_retry_", nil);
|
|
|
+ } else {
|
|
|
+ message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
+ }
|
|
|
|
|
|
- [self complete];
|
|
|
+ completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
|
|
|
@@ -2156,7 +1964,7 @@
|
|
|
|
|
|
NSString *fileIDServer = [[NCUtility sharedInstance] convertFileIDClientToFileIDServer:fileID];
|
|
|
|
|
|
- [communication createLinkRichdocuments:[_activeUrl stringByAppendingString:@"/"] fileID:fileIDServer onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *link, NSString *redirectedServer) {
|
|
|
+ [communication createLinkRichdocuments:[tableAccount.url stringByAppendingString:@"/"] fileID:fileIDServer onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *link, NSString *redirectedServer) {
|
|
|
|
|
|
completion(account, link, nil, 0);
|
|
|
|
|
@@ -2173,9 +1981,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionUnsubscribingServerPush selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:@""];
|
|
|
-
|
|
|
completion(account, nil,message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -2209,9 +2014,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionUnsubscribingServerPush selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:@""];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -2245,9 +2047,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionUnsubscribingServerPush selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:@""];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -2284,9 +2083,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionUnsubscribingServerPush selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:_activeUrl];
|
|
|
-
|
|
|
completion(account, nil, message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -2365,9 +2161,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionUnsubscribingServerPush selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:_activeUrl];
|
|
|
-
|
|
|
completion(account, nil,message, errorCode);
|
|
|
}];
|
|
|
}
|
|
@@ -2385,7 +2178,7 @@
|
|
|
[communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
|
|
|
[communication setUserAgent:[CCUtility getUserAgent]];
|
|
|
|
|
|
- NSString *path = [NSString stringWithFormat:@"%@%@/trashbin/%@/trash", _activeUrl, k_dav, tableAccount.userID];
|
|
|
+ NSString *path = [NSString stringWithFormat:@"%@%@/trashbin/%@/trash", tableAccount.url, k_dav, tableAccount.userID];
|
|
|
|
|
|
[communication emptyTrash:path onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
|
|
|
|
@@ -2404,9 +2197,6 @@
|
|
|
else
|
|
|
message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
|
|
|
|
|
|
- // Activity
|
|
|
- [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionUnsubscribingServerPush selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:@""];
|
|
|
-
|
|
|
completion(account, message, errorCode);
|
|
|
}];
|
|
|
}
|