Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarinofaggiana <marino@marinofaggiana.com>2020-06-22 16:58:32 +0300
committermarinofaggiana <marino@marinofaggiana.com>2020-06-22 16:58:32 +0300
commit8affa72f546f1858f64dd2f74e3c8ea06c3e9171 (patch)
tree9d6aeb2d01bd38e55f3d96213e6c84973ad56304 /Libraries external
parent0772fa2e35ac8005893f9511f184fece52e35aa1 (diff)
coding
Diffstat (limited to 'Libraries external')
-rw-r--r--Libraries external/OCCommunicationLib/HCFeatures.h44
-rw-r--r--Libraries external/OCCommunicationLib/HCFeatures.m38
-rw-r--r--Libraries external/OCCommunicationLib/NCComments.h38
-rw-r--r--Libraries external/OCCommunicationLib/NCComments.m43
-rw-r--r--Libraries external/OCCommunicationLib/NCRichDocumentTemplate.h40
-rw-r--r--Libraries external/OCCommunicationLib/NCRichDocumentTemplate.m29
-rw-r--r--Libraries external/OCCommunicationLib/OCActivity.h45
-rw-r--r--Libraries external/OCCommunicationLib/OCActivity.m54
-rw-r--r--Libraries external/OCCommunicationLib/OCCapabilities.h129
-rw-r--r--Libraries external/OCCommunicationLib/OCCapabilities.m52
-rwxr-xr-xLibraries external/OCCommunicationLib/OCCommunication.h1005
-rw-r--r--Libraries external/OCCommunicationLib/OCCommunication.m3565
-rwxr-xr-xLibraries external/OCCommunicationLib/OCErrorMsg.h50
-rw-r--r--Libraries external/OCCommunicationLib/OCExternalSites.h36
-rw-r--r--Libraries external/OCCommunicationLib/OCExternalSites.m45
-rwxr-xr-xLibraries external/OCCommunicationLib/OCFileDto.h67
-rwxr-xr-xLibraries external/OCCommunicationLib/OCFileDto.m56
-rwxr-xr-xLibraries external/OCCommunicationLib/OCFrameworkConstants.h134
-rw-r--r--Libraries external/OCCommunicationLib/OCNotifications.h45
-rw-r--r--Libraries external/OCCommunicationLib/OCNotifications.m55
-rw-r--r--Libraries external/OCCommunicationLib/OCNotificationsAction.h33
-rw-r--r--Libraries external/OCCommunicationLib/OCNotificationsAction.m28
-rw-r--r--Libraries external/OCCommunicationLib/OCRichObjectStrings.h20
-rw-r--r--Libraries external/OCCommunicationLib/OCRichObjectStrings.m13
-rwxr-xr-xLibraries external/OCCommunicationLib/OCShareUser.h42
-rwxr-xr-xLibraries external/OCCommunicationLib/OCShareUser.m33
-rwxr-xr-xLibraries external/OCCommunicationLib/OCSharedDto.h68
-rwxr-xr-xLibraries external/OCCommunicationLib/OCSharedDto.m55
-rw-r--r--Libraries external/OCCommunicationLib/OCUserProfile.h51
-rw-r--r--Libraries external/OCCommunicationLib/OCUserProfile.m50
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/NSDate+ISO8601.h57
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/NSDate+ISO8601.m59
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/NSDate+RFC1123.h51
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/NSDate+RFC1123.m80
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/OCHTTPRequestOperation.h33
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/OCHTTPRequestOperation.m38
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h713
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m1623
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLCommentsParser.h37
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLCommentsParser.m119
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLGetAppPasswordParser.h37
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLGetAppPasswordParser.m61
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLListParser.h42
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLListParser.m229
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLServerErrorsParser.h48
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLServerErrorsParser.m137
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLShareByLinkParser.h39
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLShareByLinkParser.m101
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLSharedParser.h45
-rwxr-xr-xLibraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLSharedParser.m247
-rwxr-xr-xLibraries external/OCCommunicationLib/Utils/NSString+Encode.h32
-rwxr-xr-xLibraries external/OCCommunicationLib/Utils/NSString+Encode.m69
-rwxr-xr-xLibraries external/OCCommunicationLib/Utils/OCConstants.h45
-rwxr-xr-xLibraries external/OCCommunicationLib/Utils/UtilsFramework.h318
-rwxr-xr-xLibraries external/OCCommunicationLib/Utils/UtilsFramework.m646
55 files changed, 0 insertions, 10869 deletions
diff --git a/Libraries external/OCCommunicationLib/HCFeatures.h b/Libraries external/OCCommunicationLib/HCFeatures.h
deleted file mode 100644
index 81469b7c0..000000000
--- a/Libraries external/OCCommunicationLib/HCFeatures.h
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// HCFeatures.h
-//
-// Created by Marino Faggiana on 14/04/19.
-// Copyright © 2019 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface HCFeatures : NSObject
-
-@property BOOL isTrial;
-@property BOOL trialExpired;
-@property double trialRemainingSec;
-@property double trialEndTime;
-@property (nonatomic, strong) NSString *trialEnd;
-
-@property BOOL accountRemoveExpired;
-@property double accountRemoveRemainingSec;
-@property double accountRemoveTime;
-@property (nonatomic, strong) NSString *accountRemove;
-
-@property (nonatomic, strong) NSString *nextGroupExpirationGroup;
-@property BOOL nextGroupExpirationGroupExpired;
-@property double nextGroupExpirationExpiresTime;
-@property (nonatomic, strong) NSString *nextGroupExpirationExpires;
-
-
-@end
diff --git a/Libraries external/OCCommunicationLib/HCFeatures.m b/Libraries external/OCCommunicationLib/HCFeatures.m
deleted file mode 100644
index 2e17a5d1f..000000000
--- a/Libraries external/OCCommunicationLib/HCFeatures.m
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// HCFeatures.m
-//
-// Created by Marino Faggiana on 14/04/19.
-// Copyright © 2019 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "HCFeatures.h"
-
-@implementation HCFeatures
-
-- (id)init
-{
- self = [super init];
-
- self.trialEnd = @"";
- self.accountRemove = @"";
- self.nextGroupExpirationGroup = @"";
- self.nextGroupExpirationExpires = @"";
-
- return self;
-}
-@end
diff --git a/Libraries external/OCCommunicationLib/NCComments.h b/Libraries external/OCCommunicationLib/NCComments.h
deleted file mode 100644
index 932cc959a..000000000
--- a/Libraries external/OCCommunicationLib/NCComments.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// NCComments.h
-//
-// Created by Marino Faggiana on 08/08/19.
-// Copyright © 2019 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface NCComments : NSObject
-
-@property (nonatomic, strong) NSString *actorDisplayName;
-@property (nonatomic, strong) NSString *actorId;
-@property (nonatomic, strong) NSString *actorType;
-@property (nonatomic, strong) NSDate *creationDateTime;
-@property BOOL isUnread;
-@property (nonatomic, strong) NSString *message;
-@property (nonatomic, strong) NSString *messageID;
-@property (nonatomic, strong) NSString *objectId;
-@property (nonatomic, strong) NSString *objectType;
-@property (nonatomic, strong) NSString *verb;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/NCComments.m b/Libraries external/OCCommunicationLib/NCComments.m
deleted file mode 100644
index 3aa784fec..000000000
--- a/Libraries external/OCCommunicationLib/NCComments.m
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// NCComments.m
-//
-// Created by Marino Faggiana on 08/08/19.
-// Copyright © 2019 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "NCComments.h"
-
-@implementation NCComments
-
-- (id)init
-{
- self = [super init];
-
- self.verb = @"";
- self.actorType = @"";
- self.actorId = @"";
- self.creationDateTime = [NSDate date];
- self.objectType = @"";
- self.actorDisplayName = @"";
- self.message = @"";
- self.messageID = @"";
- self.objectId = @"";
-
- return self;
-}
-@end
diff --git a/Libraries external/OCCommunicationLib/NCRichDocumentTemplate.h b/Libraries external/OCCommunicationLib/NCRichDocumentTemplate.h
deleted file mode 100644
index 867d954e4..000000000
--- a/Libraries external/OCCommunicationLib/NCRichDocumentTemplate.h
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// NCRichDocumentTemplate.h
-// Nextcloud
-//
-// Created by Marino Faggiana on 14/11/2018.
-// Copyright (c) 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface NCRichDocumentTemplate : NSObject
-
-@property NSInteger templateID;
-@property (nonatomic, strong) NSString *delete;
-@property (nonatomic, strong) NSString *extension;
-@property (nonatomic, strong) NSString *name;
-@property (nonatomic, strong) NSString *preview;
-@property (nonatomic, strong) NSString *type;
-
-@end
-
-NS_ASSUME_NONNULL_END
diff --git a/Libraries external/OCCommunicationLib/NCRichDocumentTemplate.m b/Libraries external/OCCommunicationLib/NCRichDocumentTemplate.m
deleted file mode 100644
index 0bdd64875..000000000
--- a/Libraries external/OCCommunicationLib/NCRichDocumentTemplate.m
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// NCRichDocumentTemplate.m
-// Nextcloud
-//
-// Created by Marino Faggiana on 14/11/2018.
-// Copyright (c) 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-
-#import "NCRichDocumentTemplate.h"
-
-@implementation NCRichDocumentTemplate
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCActivity.h b/Libraries external/OCCommunicationLib/OCActivity.h
deleted file mode 100644
index 363862175..000000000
--- a/Libraries external/OCCommunicationLib/OCActivity.h
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// OCActivity.h
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 01/03/17.
-// Copyright © 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OCActivity : NSObject
-
-@property NSInteger idActivity;
-@property (nonatomic, strong) NSDate *date;
-@property (nonatomic, strong) NSString *app;
-@property (nonatomic, strong) NSString *type;
-@property (nonatomic, strong) NSString *user;
-@property (nonatomic, strong) NSString *subject;
-@property (nonatomic, strong) NSArray *subject_rich;
-@property (nonatomic, strong) NSString *message;
-@property (nonatomic, strong) NSArray *message_rich;
-@property (nonatomic, strong) NSString *icon;
-@property (nonatomic, strong) NSString *link;
-@property (nonatomic, strong) NSString *object_type;
-@property NSInteger object_id;
-@property (nonatomic, strong) NSString *object_name;
-@property (nonatomic, strong) NSArray *previews;
-
-@end
-
diff --git a/Libraries external/OCCommunicationLib/OCActivity.m b/Libraries external/OCCommunicationLib/OCActivity.m
deleted file mode 100644
index 298e540b9..000000000
--- a/Libraries external/OCCommunicationLib/OCActivity.m
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-// OCActivity.m
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 01/03/17.
-// Copyright © 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "OCActivity.h"
-
-@implementation OCActivity
-
-- (id)init {
-
- self = [super init];
-
- if (self) {
-
- self.idActivity = 0;
- self.date = [NSDate date];
- self.app = @"";
- self.type = @"";
- self.user = @"";
- self.message = @"";
- self.message_rich = [NSArray new];
- self.icon = @"";
- self.link = @"";
- self.previews = [NSArray new];
- self.subject = @"";
- self.subject_rich = [NSArray new];
- self.object_type = @"";
- self.object_id = 0;
- self.object_name = @"";
- }
-
- return self;
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCCapabilities.h b/Libraries external/OCCommunicationLib/OCCapabilities.h
deleted file mode 100644
index 0334d7c7a..000000000
--- a/Libraries external/OCCommunicationLib/OCCapabilities.h
+++ /dev/null
@@ -1,129 +0,0 @@
-//
-// OCCapabilities.h
-// ownCloud iOS library
-//
-// Created by Gonzalo Gonzalez on 4/11/15.
-// Copyright © 2015 ownCloud. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OCCapabilities : NSObject
-
-/*VERSION*/
-@property (nonatomic) NSInteger versionMajor;
-@property (nonatomic) NSInteger versionMinor;
-@property (nonatomic) NSInteger versionMicro;
-@property (nonatomic, strong) NSString *versionString;
-@property (nonatomic, strong) NSString *versionEdition;
-
-/*CAPABILITIES*/
-
-/*CORE*/
-@property (nonatomic) NSInteger corePollInterval;
-@property (nonatomic, strong) NSString *coreWebDavRoot;
-
-/*FILES SHARING*/
-
-@property (nonatomic) BOOL isFilesSharingAPIEnabled;
-@property (nonatomic) NSInteger filesSharingDefaulPermissions;
-@property (nonatomic) BOOL isFilesSharingGroupSharing;
-@property (nonatomic) BOOL isFilesSharingReSharing;
-
-//FILE SHARING - PUBLIC
-
-@property (nonatomic) BOOL isFilesSharingPublicShareLinkEnabled;
-@property (nonatomic) BOOL isFilesSharingAllowPublicUploadsEnabled;
-@property (nonatomic) BOOL isFilesSharingAllowPublicUserSendMail;
-@property (nonatomic) BOOL isFilesSharingAllowPublicUploadFilesDrop;
-@property (nonatomic) BOOL isFilesSharingAllowPublicMultipleLinks;
-
-@property (nonatomic) BOOL isFilesSharingPublicExpireDateByDefaultEnabled;
-@property (nonatomic) BOOL isFilesSharingPublicExpireDateEnforceEnabled;
-@property (nonatomic) NSInteger filesSharingPublicExpireDateDays;
-
-@property (nonatomic) BOOL isFilesSharingPublicPasswordEnforced;
-
-//FILE SHARING - USER
-
-@property (nonatomic) BOOL isFilesSharingAllowUserSendMail;
-@property (nonatomic) BOOL isFilesSharingUserExpireDate;
-
-//FILE SHARING - GROUP
-
-@property (nonatomic) BOOL isFilesSharingGroupEnabled;
-@property (nonatomic) BOOL isFilesSharingGroupExpireDate;
-
-//FILE SHARING - FEDERATION
-
-@property (nonatomic) BOOL isFilesSharingFederationAllowUserSendShares;
-@property (nonatomic) BOOL isFilesSharingFederationAllowUserReceiveShares;
-@property (nonatomic) BOOL isFilesSharingFederationExpireDate;
-
-//FILE SHARING - SHAREBYMAIL
-
-@property (nonatomic) BOOL isFileSharingShareByMailEnabled;
-@property (nonatomic) BOOL isFileSharingShareByMailExpireDate;
-@property (nonatomic) BOOL isFileSharingShareByMailPassword;
-@property (nonatomic) BOOL isFileSharingShareByMailUploadFilesDrop;
-
-// External sites
-@property (nonatomic) BOOL isExternalSitesServerEnabled;
-@property (nonatomic, strong) NSString *externalSiteV1;
-
-// Notification
-@property (nonatomic) BOOL isNotificationServerEnabled;
-@property (nonatomic, strong) NSString *notificationOcsEndpoints;
-@property (nonatomic, strong) NSString *notificationPush;
-
-// Spreed
-@property (nonatomic) BOOL isSpreedServerEnabled;
-@property (nonatomic, strong) NSString *spreedFeatures;
-
-/*FILES*/
-@property (nonatomic) BOOL isFileBigFileChunkingEnabled;
-@property (nonatomic) BOOL isFileUndeleteEnabled;
-@property (nonatomic) BOOL isFileVersioningEnabled;
-
-// Theming
-@property (nonatomic, strong) NSString *themingBackground;
-@property (nonatomic) BOOL themingBackgroundDefault;
-@property (nonatomic) BOOL themingBackgroundPlain;
-@property (nonatomic, strong) NSString *themingColor;
-@property (nonatomic, strong) NSString *themingColorElement;
-@property (nonatomic, strong) NSString *themingColorText;
-@property (nonatomic, strong) NSString *themingLogo;
-@property (nonatomic, strong) NSString *themingName;
-@property (nonatomic, strong) NSString *themingSlogan;
-@property (nonatomic, strong) NSString *themingUrl;
-
-// End to End Encryption
-@property (nonatomic) BOOL isEndToEndEncryptionEnabled;
-@property (nonatomic, strong) NSString *endToEndEncryptionVersion;
-
-// Richdocuments
-@property (nonatomic, strong) NSArray *richdocumentsMimetypes;
-@property (nonatomic) BOOL richdocumentsDirectEditing;
-
-// Activity
-@property (nonatomic) BOOL isActivityV2Enabled;
-@property (nonatomic, strong) NSString *activityV2;
-
-// HC
-@property (nonatomic) BOOL isHandwerkcloudEnabled;
-@property (nonatomic, strong) NSString *HCShopUrl;
-
-// Imagemeter
-@property (nonatomic) BOOL isImagemeterEnabled;
-
-// Fulltextsearch
-@property (nonatomic) BOOL isFulltextsearchEnabled;
-
-// Extended Support
-@property (nonatomic) BOOL isExtendedSupportEnabled;
-
-// Pagination
-@property (nonatomic) BOOL isPaginationEnabled;
-@property (nonatomic, strong) NSString *paginationEndponit;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCCapabilities.m b/Libraries external/OCCommunicationLib/OCCapabilities.m
deleted file mode 100644
index 73fd90715..000000000
--- a/Libraries external/OCCommunicationLib/OCCapabilities.m
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// OCCapabilities.m
-// ownCloud iOS library
-//
-// Created by Gonzalo Gonzalez on 4/11/15.
-// Copyright © 2015 ownCloud. All rights reserved.
-//
-
-#import "OCCapabilities.h"
-
-@implementation OCCapabilities
-
-- (id)init {
- self = [super init];
- if (self) {
- self.versionMajor = 0;
- self.versionMinor = 0;
- self.versionMicro = 0;
- self.versionString = @"";
- self.versionEdition = @"";
- self.corePollInterval = 0;
-
- self.themingBackground = @"";
- self.themingColor = @"";
- self.themingColorElement = @"";
- self.themingColorText = @"";
- self.themingLogo = @"";
- self.themingName = @"";
- self.themingSlogan = @"";
- self.themingUrl = @"";
-
- self.externalSiteV1 = @"";
-
- self.endToEndEncryptionVersion = @"";
-
- self.notificationOcsEndpoints = @"";
- self.notificationPush = @"";
-
- self.spreedFeatures = @"";
-
- self.richdocumentsMimetypes = [NSArray new];
-
- self.HCShopUrl = @"";
-
- self.paginationEndponit = @"";
-
- self.coreWebDavRoot = @"remote.php/webdav";
- }
- return self;
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCCommunication.h b/Libraries external/OCCommunicationLib/OCCommunication.h
deleted file mode 100755
index 12c7f3989..000000000
--- a/Libraries external/OCCommunicationLib/OCCommunication.h
+++ /dev/null
@@ -1,1005 +0,0 @@
-//
-// OCCommunication.h
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-// Add : getNotificationServer & setNotificationServer
-// Add : getUserProfileServer
-// Add : Support for Favorite
-// Add : getActivityServer
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-// Copyright (c) 2017 Marino Faggiana. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@class OCHTTPRequestOperation;
-@class AFURLSessionManager;
-@class AFSecurityPolicy;
-@class OCCapabilities;
-@class OCUserProfile;
-@class HCFeatures;
-
-@interface OCCommunication : NSObject
-
-//Type of credential
-typedef enum {
- credentialNotSet = -1,
- credentialNormal = 0, //user, password
- credentialCookie = 1,
- credentialOauth = 2
-} kindOfCredentialEnum;
-
-
-typedef enum {
- OCErrorUnknow = 90, //On all errors
- OCErrorForbidenCharacters = 100, //On create folder and rename
- OCErrorMovingDestinyNameHaveForbiddenCharacters = 110,//On move file or folder
- OCErrorMovingTheDestinyAndOriginAreTheSame = 111, //On move file or folder
- OCErrorMovingFolderInsideHimself = 112, //On move file or folder
- OCErrorFileToUploadDoesNotExist = 120 //The file that we want upload does not exist
-} OCErrorEnum;
-
-//Private properties
-@property NSInteger kindOfCredential;
-@property (nonatomic, strong) NSString *user;
-@property (nonatomic, strong) NSString *userID;
-@property (nonatomic, strong) NSString *password;
-@property (nonatomic, strong) NSString *userAgent;
-
-//Public properties
-@property (nonatomic, strong) NSMutableArray *downloadTaskNetworkQueueArray;
-
-@property (nonatomic, strong) AFURLSessionManager *uploadSessionManager;
-@property (nonatomic, strong) AFURLSessionManager *downloadSessionManager;
-@property (nonatomic, strong) AFURLSessionManager *networkSessionManager;
-@property (nonatomic, strong) AFSecurityPolicy * securityPolicy;
-
-/*This flag control the use of cookies on the requests.
- -On OC6 the use of cookies limit to one request at the same time. So if we want to do several requests at the same time you should set this as NO (by default).
- -On OC7 we can do several requests at the same time with the same session so you can set this flag to YES.
- */
-@property BOOL isCookiesAvailable;
-
-/* This flag indicate if the server handling forbidden characters */
-@property BOOL isForbiddenCharactersAvailable;
-
-@property NSInteger nextcloudVersion;
-
-///-----------------------------------
-/// @name Init with Upload Session Manager
-///-----------------------------------
-
-/**
- * Method to init the OCCommunication with a AFURLSessionManager (upload session) to receive the SSL callbacks to support Self Signed servers
- *
- * @param uploadSessionManager -> AFURLSessionManager
- */
--(id) initWithUploadSessionManager:(AFURLSessionManager *) uploadSessionManager;
-
-
-/**
- * Method to init the OCCommunication with a AFURLSessionManager (uploads and downloads sessions) to receive the SSL callbacks to support Self Signed servers
- *
- * @param uploadSessionManager -> AFURLSessionManager
- * @param downloadSessionManager -> AFURLSessionManager
- *
- */
--(id) initWithUploadSessionManager:(AFURLSessionManager *) uploadSessionManager andDownloadSessionManager:(AFURLSessionManager *) downloadSessionManager andNetworkSessionManager:(AFURLSessionManager *) networkSessionManager;
-
-
-- (AFSecurityPolicy *) createSecurityPolicy;
-- (void)setSecurityPolicyManagers:(AFSecurityPolicy *)securityPolicy;
-
-
-#pragma mark - Credentials
-
-///-----------------------------------
-/// @name Set Credential With User
-///-----------------------------------
-
-/**
- * Method to set credentials with user and password
- *
- * @param user -> NSString username
- * @param userID -> NSString userID
- * @param password -> NSString password
- */
-- (void) setCredentialsWithUser:(NSString*) user andUserID:(NSString *) userID andPassword:(NSString*) password;
-
-
-///-----------------------------------
-/// @name Set Credential with cookie
-///-----------------------------------
-
-/**
- * Method that set credentials with cookie.
- * Used for SAML servers.
- *
- * @param cookie -> NSString cookie string
- */
-- (void) setCredentialsWithCookie:(NSString*) cookie;
-
-
-///-----------------------------------
-/// @name Set Credential with OAuth
-///-----------------------------------
-
-/**
- * Method to set credentials for OAuth with token
- *
- * @param token -> NSString token
- */
-- (void) setCredentialsOauthWithToken:(NSString*) token;
-
-/**
- * @optional
- *
- * Method to set the user agent, in order to identify the client app to the server.
- *
- * @param userAgent -> String with the user agent. Ex. "iOS-ownCloud"
- */
-- (void) setUserAgent:(NSString *)userAgent;
-
-
-/*
- * Method to update the a request with the current credentials
- */
-- (id) getRequestWithCredentials:(id) request;
-
-- (void) setupNextcloudVersion:(NSInteger) version;
-
-
-#pragma mark - Network operations
-
-///-----------------------------------
-/// @name Check Server
-///-----------------------------------
-
-/**
- * Method to check if on the path exist a ownCloud server
- *
- * @param path -> NSString with the url of the server with
- * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @warning this method do not need set the Credentials before because with this method we can know the kind of authentication needed.
- *
- * @warning the "path" must not be on URL Encoding.
- * Ex:
- * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/
- *
- */
-- (void) checkServer: (NSString *) path
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-///-----------------------------------
-/// @name createFolder
-///-----------------------------------
-
-/**
- * Method to create a folder giving the full address where we want put the folder
- *
- * @param path -> NSString with the url where we want put the folder.
- * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @param isFCSupported -> From Owncloud 8.1 the forbidden characters are controller by the server except the '/'. With this flag
- * we controller if the server support forbbiden characters. To know that you can use "hasServerForbiddenCharactersSupport ..." request in this class.
- *
- * @warning remember that you must to set the Credentials before call this method or any other.
- *
- * @warning the "path" must not be on URL Encoding.
- * Ex:
- * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Pop Music/
- * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Pop%20Music/
- *
- * @warning the folder name must not contain the next forbidden characers: "\", "/","<",">",":",""","|","?","*"
- */
-
-- (void) createFolder: (NSString *) path
- onCommunication:(OCCommunication *)sharedOCCommunication withForbiddenCharactersSupported:(BOOL)isFCSupported
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest
- errorBeforeRequest:(void(^)(NSError *error)) errorBeforeRequest;
-
-
-///-----------------------------------
-/// @name moveFileOrFolder
-///-----------------------------------
-
-/**
- * Method to move or rename a file/folder
- *
- * MOVE
- * @param sourcePath -> NSString with the url of the file or folder that you want move
- * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
- * @param destinyPath -> NSString with the new url where we cant move the file or folder
- * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other Folder/Music
- *
- * RENAME
- * @param sourcePath -> NSString with the url of the file or folder that you want move
- * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
- * @param destinyPath -> NSString with the new url where we cant move the file or folder
- * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Movies
- *
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @param isFCSupported -> From Owncloud 8.1 the forbidden characters are controller by the server except the '/'. With this flag
- * we controller if the server support forbbiden characters. To know that you can use "hasServerForbiddenCharactersSupport ..." request in this class.
- *
- * @warning the move will overwritte an existing file on the destiny.
- *
- * @warning remember that you must to set the Credentials before call this method or any other.
- *
- * @warning the "sourcePath" and "destinyPath" must not be on URL Encoding.
- * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other Folder/Music
- * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other%20Folder/Music
- *
- * @warning: to move a folder the "sourcePath" and "destinyPath" must end on "/" character
- * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music/
- * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
- *
- * @warning: to move a file the "sourcePath" and "destinyPath" must not end on "/" character
- * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music.mp3
- * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music.mp3/
- */
-
-- (void) moveFileOrFolder:(NSString *)sourcePath
- toDestiny:(NSString *)destinyPath
- onCommunication:(OCCommunication *)sharedOCCommunication withForbiddenCharactersSupported:(BOOL)isFCSupported
- successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectServer))successRequest
- failureRequest:(void (^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failureRequest
- errorBeforeRequest:(void (^)(NSError *error))errorBeforeRequest;
-
-
-
-///-----------------------------------
-/// @name Read Folder
-///-----------------------------------
-
-/**
- * Block to get the list of files/folders for a path
- *
- * @param path -> NSString with the url of the path
- * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
- *
- * @param token -> User Session token. To get this token you should be use "getUserSessionToken" method of UtilsFramework class
- * We use this token to be sure that the callbacks of the request are for the correct user. We need that when we use multiaccount.
- * if not you can leave as nil.
- *
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @warning the "path" must not be on URL Encoding.
- * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other Folder/Music
- * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other%20Folder/Music
- *
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- */
-- (void) readFolder: (NSString *) path depth:(NSString *)depth withUserSessionToken:(NSString *)token
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
-
-
-
-///-----------------------------------
-/// @name Read File
-///-----------------------------------
-
-/**
- * Block to get the unique file/folder of a path. Used to get the properties of the file.
- *
- * @param path -> NSString with the url of the path
- * Ex: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Music
- *
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @warning the "path" must not be on URL Encoding.
- * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other Folder/Music
- * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other%20Folder/Music
- *
- */
-- (void) readFile: (NSString *) path
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-
-///-----------------------------------
-/// @name Delete a file or a folder
-///-----------------------------------
-
-/**
- * This method delete a file or a folder
- *
- * @param path -> NSString with the url of the file or the folder that the user want to delete
- * Ex:http://www.myowncloudserver.com/owncloud/remote.php/webdav/Folder
- *
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @warning the "path" must not be on URL Encoding.
- * Correct path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other Folder/Music
- * Wrong path: http://www.myowncloudserver.com/owncloud/remote.php/webdav/Other%20Folder/Music
- *
- * @warning remember that you must to set the Credentials before call this method or any other.
- *
- */
-- (void) deleteFileOrFolder:(NSString *)path
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest
- failureRquest:(void (^)(NSHTTPURLResponse *resposne, NSError *error, NSString *redirectedServer))failureRequest;
-
-///-----------------------------------
-/// @name Download File Session
-///-----------------------------------
-
-/**
- * Method to download a file. All the files will be download one by one in a queue. The files download also in background when the system close the app.
- *
- * This method download a file of a path and returns blocks
- *
- * progress: get the download inputs about the progress of the download
- * successRequest: the download it's complete
- * failureRequest: the download fail
- *
- * @param NSString -> remotePath the path of the file
- * @param NSString -> localPath the local path where we want store the file
- * @param BOOL -> defaultPriority define if the priority is defined by the library (default) or not. It used to manage multiple downloads from the app.
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return NSURLSessionDownloadTask -> You can cancel the download using this object
- * Ex: [downloadTask cancel]
- *
- * @warning remember that you must to set the Credentials before call this method or any other.
- *
- * @warning this method use NSURLSession only supported in iOS 7, with iOS 6 use the previous method
- *
- */
-
-- (NSURLSessionDownloadTask *) downloadFileSession:(NSString *)remotePath toDestiny:(NSString *)localPath defaultPriority:(BOOL)defaultPriority encode:(BOOL)encode onCommunication:(OCCommunication *)sharedOCCommunication progress:(void(^)(NSProgress *progress))downloadProgress successRequest:(void(^)(NSURLResponse *response, NSURL *filePath)) successRequest failureRequest:(void(^)(NSURLResponse *response, NSError *error)) failureRequest;
-
-///-----------------------------------
-/// @name Set Download Task Complete Block
-///-----------------------------------
-
-/**
- *
- * Method to set the callbak block of the pending download background tasks.
- *
- * @param block A block object to be executed when a session task is completed. The block should be return the location where the download must be stored, and takes three arguments: the session, the download task, and location where is stored the file.
- *
- */
-
-- (void)setDownloadTaskComleteBlock: (NSURL * (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block;
-
-
-///-----------------------------------
-/// @name Set Download Task Did Get Body Data Block
-///-----------------------------------
-
-/**
- * Sets a block that get callbacks of the NSURLDownloadSessionTask progress
- *
- * @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes four arguments: the session, the download task, the number of the bytes read, the total bytes expected to read. This block may be called multiple times, and will execute on the main thread.
- */
-
-- (void) setDownloadTaskDidGetBodyDataBlock: (void(^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite)) block;
-
-///-----------------------------------
-/// @name Upload File
-///-----------------------------------
-
-/**
- * Method to upload a file. All the files will be upload one by one in a queue. The files upload also in background when the system close the app.
- *
- * This method download a file of a path and returns blocks
- *
- * progress: get the download inputs about the progress of the download
- * successRequest: the download it's complete
- * failureRequest: the download fail
- * failureBeforeRequest: the download fail
- *
- * @param NSString -> localPath the path where is the file that we want upload
- * @param NSString -> remotePath the path where we want upload the file
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return NSURLSessionUploadTask -> You can cancel the upload using this object
- * Ex: [uploadTask cancel]
- *
- * @warning remember that you must to set the Credentials before call this method or any other.
- *
- * @warning this method use NSURLSession only supported in iOS 7, with iOS 6 use the previous method
- *
- */
-
-- (NSURLSessionUploadTask *) uploadFileSession:(NSString *) localPath toDestiny:(NSString *) remotePath encode:(BOOL)encode onCommunication:(OCCommunication *)sharedOCCommunication progress:(void(^)(NSProgress *progress))uploadProgress successRequest:(void(^)(NSURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSURLResponse *response, NSString *redirectedServer, NSError *error)) failureRequest failureBeforeRequest:(void(^)(NSError *error)) failureBeforeRequest;
-
-
-///-----------------------------------
-/// @name Set Task Did Complete Block
-///-----------------------------------
-
-
-/**
- *
- * Method to set the callbaks block of the pending background tasks.
- *
- * @param block A block object to be executed when a session task is completed. The blockhas not return value, and takes three arguments: the session, the task, and any error that occurred in the process of executing the task.
- *
- */
-
-- (void) setTaskDidCompleteBlock: (void(^)(NSURLSession *session, NSURLSessionTask *task, NSError *error)) block;
-
-
-///-----------------------------------
-/// @name Set Task Did Send Body Data Block
-///-----------------------------------
-
-/**
- * Sets a block that get callbacks of the NSURLSessionTask progress
- *
- * @param block A block object to be called when an undetermined number of bytes have been uploaded to the server. This block has no return value and takes five arguments: the session, the task, the number of bytes written since the last time the upload progress block was called, the total bytes written, and the total bytes expected to be written during the request, as initially determined by the length of the HTTP body. This block may be called multiple times, and will execute on the main thread.
- */
-- (void) setTaskDidSendBodyDataBlock: (void(^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend)) block;
-
-
-///-----------------------------------
-/// @name Search
-///-----------------------------------
-
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth lteDateLastModified:(NSString *)lteDateLastModified gteDateLastModified:(NSString *)gteDateLastModified contentType:(NSArray *)contentType withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
-
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName dateLastModified:(NSString *)dateLastModified numberOfItem:(NSInteger)numberOfItem withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
-
-///-----------------------------------
-/// @name Setting favorite
-///-----------------------------------
-
-- (void)settingFavoriteServer:(NSString *)path andFileOrFolderPath:(NSString *)filePath favorite:(BOOL)favorite withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
-
-///-----------------------------------
-/// @name Listing favorites
-///-----------------------------------
-
-- (void)listingFavorites:(NSString *)path folder:(NSString *)folder withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
-
-
-#pragma mark - OC API Calls
-
-///-----------------------------------
-/// @name getCurrentServerVersion
-///-----------------------------------
-
-/**
- * Method to get the current version without request if this feature has been checked by other request as: getServerVersionWithPath,
- * hasServerShareSupport, hasServerCookiesSupport and hasServerForbiddenCharactersSupport methods
- *
- * @return serverVersion as NSString.
- */
-
-- (NSString *) getCurrentServerVersion;
-
-///-----------------------------------
-/// @name getServerVersionWithPath
-///-----------------------------------
-
-/**
- * Method to get the current version of a server. This method update the currentServerVersion property of the class
- *
- *
- * @param path -> NSString server path
- *
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return serverVersion as NSString.
- */
-
-- (void) getServerVersionWithPath:(NSString*) path onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *serverVersion, NSString *redirectedServer)) success
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failure;
-
-///-----------------------------------
-/// @name requestForUserNameByCookie
-///-----------------------------------
-
-/**
- * Method to get the User name by the cookie of the session. Used with SAML servers.
- *
- * @param cookieString -> NSString The cookie of the session
- *
- * @param path -> NSString server path
- *
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- */
-
-
-- (void) getUserNameByCookie:(NSString *) cookieString ofServerPath:(NSString *)path onCommunication:
-(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *response, NSData *responseData, NSString *redirectedServer))success
- failure:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failure;
-
-///-----------------------------------
-/// @name Get Features Supported By Server
-///-----------------------------------
-
-/**
- * Method get the features supported by the path server using the version string.
- *
- * Right now support:
- * - Share API
- * - Sharee API
- * - Cookies
- * - Forbidden character manage by the server side
- * - Capabilities
- *
- * @param path -> NSString server path
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return BOOL in the success about the support of Share (hasShareSupport) ,Sharee (hasShareeSupport) APIs,
- * Cookies (hasCookiesSupport), Forbidden character (hasForbiddenCharactersSupport) and Capabilities (hasCapabilitiesSupport)
- *
- */
-
-- (void) getFeaturesSupportedByServer:(NSString*) path onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, BOOL hasShareSupport, BOOL hasShareeSupport, BOOL hasCookiesSupport, BOOL hasForbiddenCharactersSupport, BOOL hasCapabilitiesSupport, BOOL hasFedSharesOptionShareSupport, NSString *redirectedServer)) success
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failure;
-
-
-
-///-----------------------------------
-/// @name readSharedByServer
-///-----------------------------------
-
-/**
- * Method to return all the files and folders shareds on the server by the current user
- *
- * @param path -> NSString server path
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return NSArray with all the OCSharedDto of shareds files
- *
- */
-- (void) readSharedByServer: (NSString *) path
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfShared, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-///-----------------------------------
-/// @name readSharedByServer
-///-----------------------------------
-
-/**
- * Method to return the files and folders shareds on a concrete path by the current user
- *
- * @param serverPath -> NSString server path
- * @param path -> Path of the folder that we want to know that shareds that contain
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return NSArray with all the OCSharedDto of shareds files
- *
- */
-- (void) readSharedByServer: (NSString *) serverPath andPath: (NSString *) path
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfShared, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-///-----------------------------------
-/// @name shareFileOrFolderByServer
-///-----------------------------------
-
-/**
- * Method to share a file or folder with password
- *
- * @param serverPath -> NSString server path
- * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
- * @param password -> password
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return shareLink or token of the file that we shared. URL or Ex:572d48de3814c90117fbca6442f2f3b2
- *
- * @warning to create the full URL to share the file on a link we have to atatch the token to: http://www.myowncloudserver.com/public.php?service=files&t=572d48de3814c90117fbca6442f2f3b2
- */
-- (void) shareFileOrFolderByServer: (NSString *) serverPath andFileOrFolderPath: (NSString *) filePath andPassword:(NSString *)password andPermission:(NSInteger)permission andHideDownload:(BOOL)hideDownload
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-
-
-///-----------------------------------
-/// @name shareFileOrFolderByServer
-///-----------------------------------
-
-/**
- * Method to share a file or folder
- *
- * @param serverPath -> NSString server path
- * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return shareLink or token of the file that we shared. URL or Ex:572d48de3814c90117fbca6442f2f3b2
- *
- * @warning to create the full URL to share the file on a link we have to atatch the token to: http://www.myowncloudserver.com/public.php?service=files&t=572d48de3814c90117fbca6442f2f3b2
- */
-- (void) shareFileOrFolderByServer: (NSString *) serverPath andFileOrFolderPath: (NSString *) filePath
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *shareLink, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest ;
-
-
-
-///-----------------------------------
-/// @name shareWith
-///-----------------------------------
-
-/**
- * Method to share a file or folder with user or group
- *
- * @param userOrGroup -> NSString user or group name
- * @param shareeType -> NSInteger: to set the type of sharee (user/group/federated)
- * @param serverPath -> NSString server path
- * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return request response, error if exists and redirected server if exist.
- *
- * @warning to create the full URL to share the file on a link we have to atatch the token to: http://www.myowncloudserver.com/public.php?service=files&t=572d48de3814c90117fbca6442f2f3b2
- */
-- (void)shareWith:(NSString *)userOrGroup shareeType:(NSInteger)shareeType inServer:(NSString *) serverPath andFileOrFolderPath:(NSString *)filePath andPermissions:(NSInteger)permissions onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failureRequest;
-
-///-----------------------------------
-/// @name unShareFileOrFolderByServer
-///-----------------------------------
-
-/**
- * Method to share a file or folder
- *
- * @param path -> NSString server path
- * @param idRemoteShared -> id number of the shared. Value obtained on the idRemoteSHared of OCSharedDto
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- */
-- (void) unShareFileOrFolderByServer: (NSString *) path andIdRemoteShared: (NSInteger) idRemoteShared
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-///-----------------------------------
-/// @name isShareFileOrFolderByServer
-///-----------------------------------
-
-/**
- * Method to know if a share item still shared
- *
- * @param path -> NSString server path
- * @param idRemoteShared -> id number of the shared. Value obtained on the idRemoteSHared of OCSharedDto
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- */
-- (void) isShareFileOrFolderByServer: (NSString *) path andIdRemoteShared: (NSInteger) idRemoteShared
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer, BOOL isShared, id shareDto)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-///-----------------------------------
-/// @name UpdteShared
-///-----------------------------------
-
-/**
- * Method to update a shared file with password and expiration time
- *
- * @param shareID -> NSInteger share id, you can get this data of these calls (readSharedByServer...)
- * @param serverPath -> NSString server path
- * @param filePath -> path of the file that we want to share. Ex: /file.pdf <- If the file is on the root folder
- * @param password -> password
- * @param permissions -> NSInteger 1 = read; 2 = update; 4 = create; 8 = delete; 16 = share; 31 = all (default: 31, for public shares: 1)
- * @param expirationTime -> expirationTime in format "YYYY-MM-dd"
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return token of the file that we shared. Ex:572d48de3814c90117fbca6442f2f3b2
- *
- * @warning it only can be updated one parameter for each request so if you want to update the password the date must be nil and the permission 0
- * @warning to create the full URL to share the file on a link we have to atatch the token to: http://www.myowncloudserver.com/public.php?service=files&t=572d48de3814c90117fbca6442f2f3b2
- */
-- (void) updateShare:(NSInteger)shareId ofServerPath:(NSString *)serverPath withPasswordProtect:(NSString*)password andNote:(NSString *)note andExpirationTime:(NSString*)expirationTime andPermissions:(NSInteger)permissions andHideDownload:(BOOL)hideDownload
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-
-///-----------------------------------
-/// @name Search Users And Groups
-///-----------------------------------
-
-/**
- * Method to get users and groups using a search string
- *
- * @param searchString -> NSString search string
- * @param page -> NInsteger: Number of page (pagination support)
- * @param resultsPerPage -> NSInteger: Number of results per page (pagination support)
- * @param serverPath -> NSString server path
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return itemList -> list of OCShareUser objects and default -> request response, error if exists and redirected server if exist
- *
- * @warning to create the full URL to share the file on a link we have to atatch the token to: http://www.myowncloudserver.com/public.php?service=files&t=572d48de3814c90117fbca6442f2f3b2
- */
-- (void) searchUsersAndGroupsWith:(NSString *)searchString forPage:(NSInteger)page with:(NSInteger)resultsPerPage ofServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *itemList, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-///-----------------------------------
-/// @name Get the server capabilities
-///-----------------------------------
-
-/**
- * Method read the capabilities of the server
- *
- * @param serverPath -> NSString server
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return capabilities -> OCCapabilities
- *
- */
-- (void) getCapabilitiesOfServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, OCCapabilities *capabilities, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-
-#pragma mark - Remote thumbnails
-
-///-----------------------------------
-/// @name Get the thumbnail for a file
-///-----------------------------------
-
-/**
- * Method to get the remote thumbnail for a file
- *
- * In order to support thumbnails for videos it is necessary to install video package on the server
- * and add the following lines in the config.php files
- *the following types on the config.php file
- * 'enabledPreviewProviders' => array(
- * 'OC\Preview\Movie'
- * )
- *
- * @param serverPath -> NSString server, without encoding
- * @param filePath -> NSString file path, without encoding
- * @param fileWidth -> NSInteger with the width size
- * @param fileHeight -> NSInteger with the height size
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return nsData -> thumbnail of the file with the size requested
- * @return NSURLSessionTask -> You can cancel the download using this object
- *
- */
-
-- (NSURLSessionTask *) getRemotePreviewByServer:(NSString*)serverPath ofFilePath:(NSString *)filePath withWidth:(NSInteger)fileWidth andHeight:(NSInteger)fileHeight andA:(NSInteger)a andMode:(NSString *)mode path:(NSString *)path onCommunication:(OCCommunication *)sharedOCComunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (NSURLSessionTask *) getRemotePreviewTrashByServer:(NSString*)serverPath ofFileId:(NSString *)fileId size:(NSString *)size onCommunication:(OCCommunication *)sharedOCComunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (NSURLSessionTask *) getRemoteThumbnailByServer:(NSString*)serverPath ofFilePath:(NSString *)filePath withWidth:(NSInteger)fileWidth andHeight:(NSInteger)fileHeight onCommunication:(OCCommunication *)sharedOCComunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSData *thumbnail, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-#pragma mark - Server Notification
-
-///-----------------------------------
-/// @name Get the server Notification
-///-----------------------------------
-
-/**
- * Method read the notification of the server
- *
- * @param serverPath -> NSString server
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return listOfNotifications -> OCNotification
- *
- */
-
-- (void) getNotificationServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfNotifications, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-
-///-----------------------------------
-/// @name Set the server Notification
-///-----------------------------------
-
-/**
- * Method read the notification of the server
- *
- * @param serverPath -> NSString server
- * @param type -> NSString "POST" "DELETE"
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- */
-
-- (void) setNotificationServer:(NSString*)serverPath type:(NSString *)type onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-///-----------------------------------
-/// @name Subscribing at the Nextcloud server
-///-----------------------------------
-
-/**
- * Method subscribing at the Nextcloud server for the push
- *
- * @param serverPath -> NSString server
- * @param pushTokenHash -> NSString sha512 hash of the PushToken for Apple Push Notification Service
- * @param devicePublicKey -> NSString devicePublicKey
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- */
-
-- (void)subscribingNextcloudServerPush:(NSString *)serverPath pushTokenHash:(NSString *)pushTokenHash devicePublicKey:(NSString *)devicePublicKey proxyServerPath:(NSString *)proxyServerPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *response, NSString *publicKey, NSString *deviceIdentifier, NSString *signature, NSString *redirectedServer))successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest;
-
-- (void)unsubscribingNextcloudServerPush:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest;
-
-- (void)subscribingPushProxy:(NSString *)serverPath pushToken:(NSString *)pushToken deviceIdentifier:(NSString *)deviceIdentifier deviceIdentifierSignature:(NSString *)deviceIdentifierSignature publicKey:(NSString *)publicKey onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest;
-
-- (void)unsubscribingPushProxy:(NSString *)serverPath deviceIdentifier:(NSString *)deviceIdentifier deviceIdentifierSignature:(NSString *)deviceIdentifierSignature publicKey:(NSString *)publicKey onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest;
-
-#pragma mark - Server Activity
-
-///-----------------------------------
-/// @name Get the server Activity
-///-----------------------------------
-
-/**
- * Method read the notification of the server
- *
- * @param serverPath -> NSString server
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return listOfActivity -> OCActivity
- *
- */
-
-- (void) getActivityServer:(NSString*)serverPath since:(NSInteger)since limit:(NSInteger)limit objectId:(NSString *)objectId objectType:(NSString *)objectType previews:(BOOL)previews link:(NSString *)link onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfActivity, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-#pragma mark - External Sites
-
-///-----------------------------------
-/// @name Get the list of External sites
-///-----------------------------------
-
-/**
- * Method read the notification of the server
- *
- * @param serverPath -> NSString server
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return listOfExternalSites -> OCExternalSites
- *
- */
-
-- (void) getExternalSitesServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfExternalSites, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-#pragma mark - User Profile
-
-///-----------------------------------
-/// @name Get User Profile
-///-----------------------------------
-
-/**
- * Method read the notification of the server
- *
- * @param serverPath -> NSString server
- * @param type -> NSString "GET"
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- */
-
-- (void) getUserProfileServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, OCUserProfile *userProfile, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-#pragma mark - End-to-End Encryption
-
-- (void)getEndToEndPublicKeys:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)getEndToEndPrivateKeyCipher:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *privateKeyChiper, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)getEndToEndServerPublicKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-
-- (void)signEndToEndPublicKey:(NSString*)serverPath publicKey:(NSString *)publicKey onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *publicKey,NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)storeEndToEndPrivateKeyCipher:(NSString*)serverPath privateKeyChiper:(NSString *)privateKeyChiper onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *privateKey, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-
-- (void)deleteEndToEndPublicKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)deleteEndToEndPrivateKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-
-- (void)markEndToEndFolderEncrypted:(NSString*)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)deletemarkEndToEndFolderEncrypted:(NSString*)serverPath fileId:(NSString *)fileId e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-
-- (void)lockEndToEndFolderEncrypted:(NSString*)serverPath fileId:(NSString *)fileId e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *e2eToken, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)unlockEndToEndFolderEncrypted:(NSString*)serverPath fileId:(NSString *)fileId e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-
-- (void)getEndToEndMetadata:(NSString*)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)storeEndToEndMetadata:(NSString*)serverPath fileId:(NSString *)fileId e2eToken:(NSString *)e2eToken encryptedMetadata:(NSString *)encryptedMetadata onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)updateEndToEndMetadata:(NSString*)serverPath fileId:(NSString *)fileId encryptedMetadata:(NSString *)encryptedMetadata e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)deleteEndToEndMetadata:(NSString*)serverPath fileId:(NSString *)fileId e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-#pragma mark - Manage Mobile Editor OCS API
-
-- (void)createLinkRichdocuments:(NSString *)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *link, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)getTemplatesRichdocuments:(NSString *)serverPath typeTemplate:(NSString *)typeTemplate onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfTemplate, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)createNewRichdocuments:(NSString *)serverPath path:(NSString *)path templateID:(NSString *)templateID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)createAssetRichdocuments:(NSString *)serverPath path:(NSString *)path onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-#pragma mark - Fulltextsearch
-
-- (void)fullTextSearch:(NSString *)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-#pragma mark - Remore wipe
-
-- (void)getRemoteWipeStatus:(NSString *)serverPath token:(NSString *)token onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, BOOL wipe, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)setRemoteWipeCompletition:(NSString *)serverPath token:(NSString *)token onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-#pragma mark - Trash
-
-- (void)listingTrash:(NSString *)path depth:(NSString *)depth onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)emptyTrash:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-#pragma mark - Comments
-
-- (void)getComments:(NSString *)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *list, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)putComments:(NSString*)serverPath fileId:(NSString *)fileId message:(NSString *)message onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)updateComments:(NSString*)serverPath fileId:(NSString *)fileId messageID:(NSString *)messageID message:(NSString *)message onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)readMarkComments:(NSString*)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)deleteComments:(NSString*)serverPath fileId:(NSString *)fileId messageID:(NSString *)messageID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest ;
-
-#pragma mark - Third Parts
-
-- (void)getHCUserProfile:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, OCUserProfile *userProfile, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)putHCUserProfile:(NSString*)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-- (void)getHCFeatures:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, HCFeatures *features, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
-
-@end
-
-
-
diff --git a/Libraries external/OCCommunicationLib/OCCommunication.m b/Libraries external/OCCommunicationLib/OCCommunication.m
deleted file mode 100644
index afeb2aaa1..000000000
--- a/Libraries external/OCCommunicationLib/OCCommunication.m
+++ /dev/null
@@ -1,3565 +0,0 @@
-//
-// OCCommunication.m
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-// Add : getNotificationServer & setNotificationServer
-// Add : getUserProfileServer
-// Add : Support for Favorite
-// Add : getActivityServer
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-// Copyright (c) 2017 Marino Faggiana. All rights reserved.
-//
-
-
-#import "OCCommunication.h"
-#import "OCHTTPRequestOperation.h"
-#import "UtilsFramework.h"
-#import "OCXMLSharedParser.h"
-#import "OCXMLServerErrorsParser.h"
-#import "NSString+Encode.h"
-#import "OCFrameworkConstants.h"
-#import "OCWebDAVClient.h"
-#import "OCXMLShareByLinkParser.h"
-#import "OCErrorMsg.h"
-#import "OCShareUser.h"
-#import "OCActivity.h"
-#import "OCExternalSites.h"
-#import "OCCapabilities.h"
-#import "OCNotifications.h"
-#import "OCNotificationsAction.h"
-#import "OCRichObjectStrings.h"
-#import "OCUserProfile.h"
-#import "NCRichDocumentTemplate.h"
-#import "HCFeatures.h"
-#import "NCXMLCommentsParser.h"
-#import "NCXMLListParser.h"
-
-@interface OCCommunication ()
-
-@property (nonatomic, strong) NSString *currentServerVersion;
-
-@end
-
-@implementation OCCommunication
-
-
--(id) init {
-
- self = [super init];
-
- if (self) {
-
- //Init the Donwload queue array
- self.downloadTaskNetworkQueueArray = [NSMutableArray new];
-
- //Credentials not set yet
- self.kindOfCredential = credentialNotSet;
-
- [self setSecurityPolicyManagers:[self createSecurityPolicy]];
-
- self.isCookiesAvailable = YES;
- self.isForbiddenCharactersAvailable = NO;
-
-#ifdef UNIT_TEST
-
- self.uploadSessionManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
- self.downloadSessionManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
- self.networkSessionManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
- self.networkSessionManager.responseSerializer = [AFHTTPResponseSerializer serializer];
-#else
- //Network Upload queue for NSURLSession (iOS 7)
- NSURLSessionConfiguration *uploadConfiguration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:k_session_name];
- uploadConfiguration.HTTPShouldUsePipelining = YES;
- uploadConfiguration.HTTPMaximumConnectionsPerHost = 1;
- uploadConfiguration.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
- self.uploadSessionManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:uploadConfiguration];
- [self.uploadSessionManager.operationQueue setMaxConcurrentOperationCount:1];
-
- //Network Download queue for NSURLSession (iOS 7)
- NSURLSessionConfiguration *downConfiguration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:k_download_session_name];
- downConfiguration.HTTPShouldUsePipelining = YES;
- downConfiguration.HTTPMaximumConnectionsPerHost = 1;
- downConfiguration.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
- self.downloadSessionManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:downConfiguration];
- [self.downloadSessionManager.operationQueue setMaxConcurrentOperationCount:1];
-
- //Network Download queue for NSURLSession (iOS 7)
- NSURLSessionConfiguration *networkConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration];
- networkConfiguration.HTTPShouldUsePipelining = YES;
- networkConfiguration.HTTPMaximumConnectionsPerHost = 1;
- networkConfiguration.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
- self.networkSessionManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:networkConfiguration];
- [self.networkSessionManager.operationQueue setMaxConcurrentOperationCount:1];
- self.networkSessionManager.responseSerializer = [AFHTTPResponseSerializer serializer];
-#endif
-
- }
-
- return self;
-}
-
--(id) initWithUploadSessionManager:(AFURLSessionManager *) uploadSessionManager {
-
- self = [super init];
-
- if (self) {
-
- //Init the Donwload queue array
- self.downloadTaskNetworkQueueArray = [NSMutableArray new];
-
- self.isCookiesAvailable = YES;
- self.isForbiddenCharactersAvailable = NO;
-
- //Credentials not set yet
- self.kindOfCredential = credentialNotSet;
-
- [self setSecurityPolicyManagers:[self createSecurityPolicy]];
-
- self.uploadSessionManager = uploadSessionManager;
- }
-
- return self;
-}
-
--(id) initWithUploadSessionManager:(AFURLSessionManager *) uploadSessionManager andDownloadSessionManager:(AFURLSessionManager *) downloadSessionManager andNetworkSessionManager:(AFURLSessionManager *) networkSessionManager {
-
- self = [super init];
-
- if (self) {
-
- //Init the Donwload queue array
- self.downloadTaskNetworkQueueArray = [NSMutableArray new];
-
- //Credentials not set yet
- self.kindOfCredential = credentialNotSet;
-
- [self setSecurityPolicyManagers:[self createSecurityPolicy]];
-
- self.uploadSessionManager = uploadSessionManager;
- self.downloadSessionManager = downloadSessionManager;
- self.networkSessionManager = networkSessionManager;
- }
-
- return self;
-}
-
-- (AFSecurityPolicy *) createSecurityPolicy {
- return [AFSecurityPolicy defaultPolicy];
-}
-
-- (void)setSecurityPolicyManagers:(AFSecurityPolicy *)securityPolicy {
- self.securityPolicy = securityPolicy;
- self.uploadSessionManager.securityPolicy = securityPolicy;
- self.downloadSessionManager.securityPolicy = securityPolicy;
-}
-
-#pragma mark - Setting Credentials
-
-- (void) setCredentialsWithUser:(NSString*) user andUserID:(NSString *) userID andPassword:(NSString*) password {
- self.kindOfCredential = credentialNormal;
- self.user = user;
- self.userID = userID;
- self.password = password;
-}
-
-- (void) setCredentialsWithCookie:(NSString*) cookie {
- self.kindOfCredential = credentialCookie;
- self.password = cookie;
-}
-
-- (void) setCredentialsOauthWithToken:(NSString*) token {
- self.kindOfCredential = credentialOauth;
- self.password = token;
-}
-
-- (void) setupNextcloudVersion:(NSInteger) version
-{
- self.nextcloudVersion = version;
-}
-
-
-///-----------------------------------
-/// @name getRequestWithCredentials
-///-----------------------------------
-
-/**
- * Method to return the request with the right credential
- *
- * @param OCWebDAVClient like a dinamic typed
- *
- * @return OCWebDAVClient like a dinamic typed
- *
- */
-- (id) getRequestWithCredentials:(id) request {
-
- if ([request isKindOfClass:[NSMutableURLRequest class]]) {
- NSMutableURLRequest *myRequest = (NSMutableURLRequest *)request;
-
- switch (self.kindOfCredential) {
- case credentialNotSet:
- //Without credentials
- break;
- case credentialNormal:
- {
- NSString *basicAuthCredentials = [NSString stringWithFormat:@"%@:%@", self.user, self.password];
- [myRequest addValue:[NSString stringWithFormat:@"Basic %@", [UtilsFramework AFBase64EncodedStringFromString:basicAuthCredentials]] forHTTPHeaderField:@"Authorization"];
- break;
- }
- case credentialCookie:
- NSLog(@"Cookie: %@", self.password);
- [myRequest addValue:self.password forHTTPHeaderField:@"Cookie"];
- break;
- case credentialOauth:
- [myRequest addValue:[NSString stringWithFormat:@"Bearer %@", self.password] forHTTPHeaderField:@"Authorization"];
- break;
- default:
- break;
- }
-
- if (self.userAgent) {
- [myRequest addValue:self.userAgent forHTTPHeaderField:@"User-Agent"];
- }
-
- return myRequest;
-
- } else if([request isKindOfClass:[OCWebDAVClient class]]) {
- OCWebDAVClient *myRequest = (OCWebDAVClient *)request;
-
- switch (self.kindOfCredential) {
- case credentialNotSet:
- //Without credentials
- break;
- case credentialNormal:
- [myRequest setAuthorizationHeaderWithUsername:self.user password:self.password];
- break;
- case credentialCookie:
- [myRequest setAuthorizationHeaderWithCookie:self.password];
- break;
- case credentialOauth:
- [myRequest setAuthorizationHeaderWithToken:[NSString stringWithFormat:@"Bearer %@", self.password]];
- break;
- default:
- break;
- }
-
- if (self.userAgent) {
- [myRequest setUserAgent:self.userAgent];
- }
-
- return request;
-
- } else {
- NSLog(@"We do not know witch kind of object is");
- return request;
- }
-}
-
-
-#pragma mark - WebDav network Operations
-
-///-----------------------------------
-/// @name Check Server
-///-----------------------------------
-- (void) checkServer: (NSString *) path
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- if (self.userAgent) {
- [request setUserAgent:self.userAgent];
- }
-
- path = [path encodeString:NSUTF8StringEncoding];
-
- [request checkServer:path onCommunication:sharedOCCommunication
- success:^(NSHTTPURLResponse *response, id responseObject) {
- if (successRequest) {
- successRequest(response, request.redirectedServer);
- }
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-///-----------------------------------
-/// @name Create a folder
-///-----------------------------------
-- (void) createFolder: (NSString *) path
- onCommunication:(OCCommunication *)sharedOCCommunication withForbiddenCharactersSupported:(BOOL)isFCSupported
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest
- errorBeforeRequest:(void(^)(NSError *error)) errorBeforeRequest {
-
-
- if ([UtilsFramework isForbiddenCharactersInFileName:[UtilsFramework getFileNameOrFolderByPath:path] withForbiddenCharactersSupported:isFCSupported]) {
- NSError *error = [UtilsFramework getErrorByCodeId:OCErrorForbidenCharacters];
- errorBeforeRequest(error);
- } else {
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
-
- path = [path encodeString:NSUTF8StringEncoding];
-
- [request makeCollection:path onCommunication:sharedOCCommunication
- success:^(NSHTTPURLResponse *response, id responseObject) {
- if (successRequest) {
- successRequest(response, request.redirectedServer);
- }
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- OCXMLServerErrorsParser *serverErrorParser = [OCXMLServerErrorsParser new];
-
- [serverErrorParser startToParseWithData:responseData withCompleteBlock:^(NSError *err) {
-
- if (err) {
- failureRequest(response, err, request.redirectedServer);
- }else{
- failureRequest(response, error, request.redirectedServer);
- }
-
-
- }];
-
- }];
- }
-}
-
-///-----------------------------------
-/// @name Move a file or a folder
-///-----------------------------------
-- (void) moveFileOrFolder:(NSString *)sourcePath
- toDestiny:(NSString *)destinyPath
- onCommunication:(OCCommunication *)sharedOCCommunication withForbiddenCharactersSupported:(BOOL)isFCSupported
- successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectServer))successRequest
- failureRequest:(void (^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failureRequest
- errorBeforeRequest:(void (^)(NSError *error))errorBeforeRequest {
-
- if ([UtilsFramework isTheSameFileOrFolderByNewURLString:destinyPath andOriginURLString:sourcePath]) {
- //We check that we are not trying to move the file to the same place
- NSError *error = [UtilsFramework getErrorByCodeId:OCErrorMovingTheDestinyAndOriginAreTheSame];
- errorBeforeRequest(error);
- } else if ([UtilsFramework isAFolderUnderItByNewURLString:destinyPath andOriginURLString:sourcePath]) {
- //We check we are not trying to move a folder inside himself
- NSError *error = [UtilsFramework getErrorByCodeId:OCErrorMovingFolderInsideHimself];
- errorBeforeRequest(error);
- } else if ([UtilsFramework isForbiddenCharactersInFileName:[UtilsFramework getFileNameOrFolderByPath:destinyPath] withForbiddenCharactersSupported:isFCSupported]) {
- //We check that we are making a move not a rename to prevent special characters problems
- NSError *error = [UtilsFramework getErrorByCodeId:OCErrorMovingDestinyNameHaveForbiddenCharacters];
- errorBeforeRequest(error);
- } else {
-
- sourcePath = [sourcePath encodeString:NSUTF8StringEncoding];
- destinyPath = [destinyPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
-
- [request movePath:sourcePath toPath:destinyPath onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
- if (successRequest) {
- successRequest(response, request.redirectedServer);
- }
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- OCXMLServerErrorsParser *serverErrorParser = [OCXMLServerErrorsParser new];
-
- [serverErrorParser startToParseWithData:responseData withCompleteBlock:^(NSError *err) {
-
- if (err) {
- failureRequest(response, err, request.redirectedServer);
- }else{
- failureRequest(response, error, request.redirectedServer);
- }
-
- }];
-
- }];
- }
-}
-
-
-///-----------------------------------
-/// @name Delete a file or a folder
-///-----------------------------------
-- (void) deleteFileOrFolder:(NSString *)path
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void (^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest
- failureRquest:(void (^)(NSHTTPURLResponse *resposne, NSError *error, NSString *redirectedServer))failureRequest {
-
- path = [path encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
-
- [request deletePath:path onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
- if (successRequest) {
- successRequest(response, request.redirectedServer);
- }
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-
-///-----------------------------------
-/// @name Read folder
-///-----------------------------------
-- (void) readFolder: (NSString *) path depth:(NSString *)depth withUserSessionToken:(NSString *)token
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest{
-
- if (!token){
- token = @"no token";
- }
-
- path = [path encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request listPath:path depth:depth onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
- if (successRequest) {
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- NSData *responseData = (NSData*) responseObject;
-
- // NSString* newStr = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
- // NSLog(@"newStrReadFolder: %@", newStr);
-
- NCXMLListParser *parser = [NCXMLListParser new];
- [parser initParserWithData:responseData controlFirstFileOfList:true];
- NSMutableArray *list = [parser.list mutableCopy];
-
- dispatch_async(dispatch_get_main_queue(), ^{
- successRequest(response, list, request.redirectedServer, token);
- });
- });
- }
- } failure:^(NSHTTPURLResponse *response, id responseData, NSError *error, NSString *token) {
- NSLog(@"Failure");
- failureRequest(response, error, token, request.redirectedServer);
- }];
-}
-
-///-----------------------------------
-/// @name Read File
-///-----------------------------------
-- (void) readFile: (NSString *) path
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- path = [path encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request propertiesOfPath:path onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
- if (successRequest) {
- if (successRequest) {
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- NSData *responseData = (NSData*) responseObject;
-
- // NSString* newStr = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
- // NSLog(@"newStrReadFolder: %@", newStr);
-
- NCXMLListParser *parser = [NCXMLListParser new];
- [parser initParserWithData:responseData controlFirstFileOfList:true];
- NSMutableArray *list = [parser.list mutableCopy];
-
- dispatch_async(dispatch_get_main_queue(), ^{
- successRequest(response, list, request.redirectedServer);
- });
- });
- }
- }
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
-
- }];
-
-}
-
-///-----------------------------------
-/// @name search
-///-----------------------------------
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth lteDateLastModified:(NSString *)lteDateLastModified gteDateLastModified:(NSString *)gteDateLastModified contentType:(NSArray *)contentType withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest{
-
- if (!token){
- token = @"no token";
- }
-
- path = [path encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request search:path folder:folder fileName:fileName depth:depth lteDateLastModified:lteDateLastModified gteDateLastModified:gteDateLastModified contentType:contentType user:_user userID:_userID onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
- if (successRequest) {
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
- NSData *responseData = (NSData*) responseObject;
-
- NCXMLListParser *parser = [NCXMLListParser new];
- [parser initParserWithData:responseData controlFirstFileOfList:false];
- NSMutableArray *list = [parser.list mutableCopy];
-
- dispatch_async(dispatch_get_main_queue(), ^{
- successRequest(response, list, request.redirectedServer, token);
- });
- });
- }
- } failure:^(NSHTTPURLResponse *response, id responseData, NSError *error, NSString *token) {
-
- failureRequest(response, error, token, request.redirectedServer);
- }];
-}
-
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName dateLastModified:(NSString *)dateLastModified numberOfItem:(NSInteger)numberOfItem withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest {
-
- if (!token){
- token = @"no token";
- }
-
- path = [path encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request search:path folder:folder fileName:fileName dateLastModified:dateLastModified numberOfItem:numberOfItem userID:_userID onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
- if (successRequest) {
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
- NSData *responseData = (NSData*) responseObject;
-
- NCXMLListParser *parser = [NCXMLListParser new];
- [parser initParserWithData:responseData controlFirstFileOfList:false];
- NSMutableArray *list = [parser.list mutableCopy];
-
- dispatch_async(dispatch_get_main_queue(), ^{
- successRequest(response, list, request.redirectedServer, token);
- });
- });
- }
- } failure:^(NSHTTPURLResponse *response, id responseData, NSError *error, NSString *token) {
- failureRequest(response, error, token, request.redirectedServer);
- }];
-}
-
-///-----------------------------------
-/// @name Setting favorite
-///-----------------------------------
-- (void)settingFavoriteServer:(NSString *)path andFileOrFolderPath:(NSString *)filePath favorite:(BOOL)favorite withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest {
-
- if (!token){
- token = @"no token";
- }
-
- path = [NSString stringWithFormat:@"%@/files/%@/%@", path, _userID, filePath];
- path = [path encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request settingFavorite:path favorite:favorite onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
-
- if (successRequest) {
- //Return success
- successRequest(response, request.redirectedServer, token);
- }
-
- } failure:^(NSHTTPURLResponse *response, id responseData, NSError *error, NSString *token) {
-
- NSLog(@"Failure");
- failureRequest(response, error, token, request.redirectedServer);
- }];
-}
-
-///-----------------------------------
-/// @name Listing favorites
-///-----------------------------------
-- (void)listingFavorites:(NSString *)path folder:(NSString *)folder withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest{
-
- if (!token){
- token = @"no token";
- }
-
- path = [path encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request listingFavorites:path folder:folder user:_user userID:_userID onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
- if (successRequest) {
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
- NSData *responseData = (NSData*) responseObject;
-
- NCXMLListParser *parser = [NCXMLListParser new];
- [parser initParserWithData:responseData controlFirstFileOfList:false];
- NSMutableArray *list = [parser.list mutableCopy];
-
- dispatch_async(dispatch_get_main_queue(), ^{
- successRequest(response, list, request.redirectedServer, token);
- });
- });
- }
- } failure:^(NSHTTPURLResponse *response, id responseData, NSError *error, NSString *token) {
- failureRequest(response, error, token, request.redirectedServer);
- }];
-}
-
-///-----------------------------------
-/// @name Download File Session
-///-----------------------------------
-
-
-
-- (NSURLSessionDownloadTask *) downloadFileSession:(NSString *)remotePath toDestiny:(NSString *)localPath defaultPriority:(BOOL)defaultPriority encode:(BOOL)encode onCommunication:(OCCommunication *)sharedOCCommunication progress:(void(^)(NSProgress *progress))downloadProgress successRequest:(void(^)(NSURLResponse *response, NSURL *filePath)) successRequest failureRequest:(void(^)(NSURLResponse *response, NSError *error)) failureRequest {
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
- if (encode) remotePath = [remotePath encodeString:NSUTF8StringEncoding];
-
- NSURLSessionDownloadTask *downloadTask = [request downloadWithSessionPath:remotePath toPath:localPath defaultPriority:defaultPriority onCommunication:sharedOCCommunication progress:^(NSProgress *progress) {
- downloadProgress(progress);
- } success:^(NSURLResponse *response, NSURL *filePath) {
-
- [UtilsFramework addCookiesToStorageFromResponse:(NSURLResponse *) response andPath:[NSURL URLWithString:remotePath]];
- successRequest(response,filePath);
-
- } failure:^(NSURLResponse *response, NSError *error) {
- [UtilsFramework addCookiesToStorageFromResponse:(NSURLResponse *) response andPath:[NSURL URLWithString:remotePath]];
- failureRequest(response,error);
- }];
-
- return downloadTask;
-}
-
-
-///-----------------------------------
-/// @name Set Download Task Complete Block
-///-----------------------------------
-
-
-- (void)setDownloadTaskComleteBlock: (NSURL * (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block{
-
- [self.downloadSessionManager setDownloadTaskDidFinishDownloadingBlock:block];
-
-
-}
-
-
-///-----------------------------------
-/// @name Set Download Task Did Get Body Data Block
-///-----------------------------------
-
-
-- (void) setDownloadTaskDidGetBodyDataBlock: (void(^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite)) block{
-
- [self.downloadSessionManager setDownloadTaskDidWriteDataBlock:^(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) {
- block(session,downloadTask,bytesWritten,totalBytesWritten,totalBytesExpectedToWrite);
- }];
-
-}
-
-///-----------------------------------
-/// @name Upload File Session
-///-----------------------------------
-
-- (NSURLSessionUploadTask *) uploadFileSession:(NSString *) localPath toDestiny:(NSString *) remotePath encode:(BOOL)encode onCommunication:(OCCommunication *)sharedOCCommunication progress:(void(^)(NSProgress *progress))uploadProgress successRequest:(void(^)(NSURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSURLResponse *response, NSString *redirectedServer, NSError *error)) failureRequest failureBeforeRequest:(void(^)(NSError *error)) failureBeforeRequest {
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
- if (encode) remotePath = [remotePath encodeString:NSUTF8StringEncoding];
-
- NSURLSessionUploadTask *uploadTask = [request putWithSessionLocalPath:localPath atRemotePath:remotePath onCommunication:sharedOCCommunication progress:^(NSProgress *progress) {
- uploadProgress(progress);
- } success:^(NSURLResponse *response, id responseObjec){
- [UtilsFramework addCookiesToStorageFromResponse:(NSURLResponse *) response andPath:[NSURL URLWithString:remotePath]];
- //TODO: The second parameter is the redirected server
- successRequest(response, @"");
- } failure:^(NSURLResponse *response, id responseObject, NSError *error) {
- [UtilsFramework addCookiesToStorageFromResponse:(NSURLResponse *) response andPath:[NSURL URLWithString:remotePath]];
- //TODO: The second parameter is the redirected server
-
- NSData *responseData = (NSData*) responseObject;
-
- OCXMLServerErrorsParser *serverErrorParser = [OCXMLServerErrorsParser new];
-
- [serverErrorParser startToParseWithData:responseData withCompleteBlock:^(NSError *err) {
-
- if (err) {
- failureRequest(response, @"", err);
- }else{
- failureRequest(response, @"", error);
- }
-
- }];
-
- } failureBeforeRequest:^(NSError *error) {
- failureBeforeRequest(error);
- }];
-
- return uploadTask;
-}
-
-///-----------------------------------
-/// @name Set Task Did Complete Block
-///-----------------------------------
-
-- (void) setTaskDidCompleteBlock: (void(^)(NSURLSession *session, NSURLSessionTask *task, NSError *error)) block{
-
- [self.uploadSessionManager setTaskDidCompleteBlock:^(NSURLSession *session, NSURLSessionTask *task, NSError *error) {
-
- block(session, task, error);
- }];
-
-}
-
-
-///-----------------------------------
-/// @name Set Task Did Send Body Data Block
-///-----------------------------------
-
-
-- (void) setTaskDidSendBodyDataBlock: (void(^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend)) block{
-
- [self.uploadSessionManager setTaskDidSendBodyDataBlock:^(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
- block(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend);
- }];
-}
-
-#pragma mark - OC/NC API Calls
-
-- (NSString *) getCurrentServerVersion {
- return self.currentServerVersion;
-}
-
-- (void) getServerVersionWithPath:(NSString*) path onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *serverVersion, NSString *redirectedServer)) success
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failure{
-
- OCWebDAVClient *request = [OCWebDAVClient new];
-
- if (self.userAgent) {
- [request setUserAgent:self.userAgent];
- }
-
- [request getStatusOfTheServer:path onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *data = (NSData*) responseObject;
- NSString *versionString = [NSString new];
- NSError* error=nil;
-
- if (data) {
- NSMutableDictionary *jsonArray = [NSJSONSerialization JSONObjectWithData: data options: NSJSONReadingMutableContainers error: &error];
- if(error) {
- NSLog(@"Error parsing JSON: %@", error);
- } else {
- //Obtain the server version from the version field
- versionString = [jsonArray valueForKey:@"version"];
- self.currentServerVersion = versionString;
- }
- } else {
- NSLog(@"Error parsing JSON: data is null");
- }
- success(response, versionString, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failure(response, error, request.redirectedServer);
- }];
-
-}
-
-///-----------------------------------
-/// @name Get UserName by cookie
-///-----------------------------------
-
-- (void) getUserNameByCookie:(NSString *) cookieString ofServerPath:(NSString *)path onCommunication:
-(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *response, NSData *responseData, NSString *redirectedServer))success
- failure:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failure{
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
-
- [request requestUserNameOfServer: path byCookie:cookieString onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
- success(response, responseObject, request.redirectedServer);
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failure(response, error, request.redirectedServer);
- }];
-}
-
-- (void) getFeaturesSupportedByServer:(NSString*) path onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, BOOL hasShareSupport, BOOL hasShareeSupport, BOOL hasCookiesSupport, BOOL hasForbiddenCharactersSupport, BOOL hasCapabilitiesSupport, BOOL hasFedSharesOptionShareSupport, NSString *redirectedServer)) success
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failure{
-
- OCWebDAVClient *request = [OCWebDAVClient new];
-
- if (self.userAgent) {
- [request setUserAgent:self.userAgent];
- }
-
- [request getStatusOfTheServer:path onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- if (responseObject) {
-
- NSError* error = nil;
- NSMutableDictionary *jsonArray = [NSJSONSerialization JSONObjectWithData: (NSData*) responseObject options: NSJSONReadingMutableContainers error: &error];
-
- if(error) {
- // NSLog(@"Error parsing JSON: %@", error);
- failure(response, error, request.redirectedServer);
- }else{
-
- self.currentServerVersion = [jsonArray valueForKey:@"version"];
-
- BOOL hasShareSupport = [UtilsFramework isServerVersion:self.currentServerVersion higherThanLimitVersion:k_version_support_shared];
- BOOL hasShareeSupport = [UtilsFramework isServerVersion:self.currentServerVersion higherThanLimitVersion:k_version_support_sharee_api];
- BOOL hasCookiesSupport = [UtilsFramework isServerVersion:self.currentServerVersion higherThanLimitVersion:k_version_support_cookies];
- BOOL hasForbiddenCharactersSupport = [UtilsFramework isServerVersion:self.currentServerVersion higherThanLimitVersion:k_version_support_forbidden_characters];
- BOOL hasCapabilitiesSupport = [UtilsFramework isServerVersion:self.currentServerVersion higherThanLimitVersion:k_version_support_capabilities];
- BOOL hasFedSharesOptionShareSupport = [UtilsFramework isServerVersion:self.currentServerVersion higherThanLimitVersion:k_version_support_share_option_fed_share];
-
- success(response, hasShareSupport, hasShareeSupport, hasCookiesSupport, hasForbiddenCharactersSupport, hasCapabilitiesSupport, hasFedSharesOptionShareSupport, request.redirectedServer);
- }
-
- } else {
- // NSLog(@"Error parsing JSON: data is null");
- failure(response, nil, request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failure(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - Share
-
-- (void) readSharedByServer: (NSString *) path
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfShared, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- path = [path encodeString:NSUTF8StringEncoding];
- path = [path stringByAppendingString:k_url_acces_shared_api];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request listSharedByServer:path onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
- if (successRequest) {
- NSData *responseData = (NSData*) responseObject;
- OCXMLSharedParser *parser = [[OCXMLSharedParser alloc]init];
-
- //NSLog(@"response: %@", [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]);
-
- [parser initParserWithData:responseData];
- NSMutableArray *sharedList = [parser.shareList mutableCopy];
-
- //Return success
- successRequest(response, sharedList, request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void) readSharedByServer: (NSString *) serverPath andPath: (NSString *) path
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfShared, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:k_url_acces_shared_api];
-
- path = [path encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request listSharedByServer:serverPath andPath:path onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
- if (successRequest) {
- NSData *responseData = (NSData*) responseObject;
- OCXMLSharedParser *parser = [[OCXMLSharedParser alloc]init];
-
-// NSString *str = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
-// NSLog(@"responseDataReadSharedByServer:andPath: %@", str);
-// NSLog(@"pathFolders: %@", path);
-// NSLog(@"serverPath: %@", serverPath);
-
- [parser initParserWithData:responseData];
- NSMutableArray *sharedList = [parser.shareList mutableCopy];
-
- //Return success
- successRequest(response, sharedList, request.redirectedServer);
- }
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void) shareFileOrFolderByServer: (NSString *) serverPath andFileOrFolderPath: (NSString *) filePath andPassword:(NSString *)password andPermission:(NSInteger)permission andHideDownload:(BOOL)hideDownload
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:k_url_acces_shared_api];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request shareByLinkFileOrFolderByServer:serverPath andPath:filePath andPassword:password andPermission:permission andHideDownload:hideDownload onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
-
- OCXMLShareByLinkParser *parser = [[OCXMLShareByLinkParser alloc]init];
-
- // NSLog(@"response: %@", [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]);
-
- [parser initParserWithData:responseData];
-
- if (parser.statusCode == kOCSharedAPISuccessful || parser.statusCode == kOCShareeAPISuccessful) {
-
- NSString *url = parser.url;
- NSString *token = parser.token;
-
- if (url != nil) {
-
- successRequest(response, url, request.redirectedServer);
-
- } else if (token != nil) {
-
- //We remove the \n and the empty spaces " "
- token = [token stringByReplacingOccurrencesOfString:@"\n" withString:@""];
- token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];
-
- successRequest(response, token, request.redirectedServer);
-
- } else {
-
- NSError *error = [UtilsFramework getErrorWithCode:parser.statusCode andCustomMessageFromTheServer:parser.message];
- failureRequest(response, error, request.redirectedServer);
- }
-
- } else {
-
- NSError *error = [UtilsFramework getErrorWithCode:parser.statusCode andCustomMessageFromTheServer:parser.message];
- failureRequest(response, error, request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void) shareFileOrFolderByServer: (NSString *) serverPath andFileOrFolderPath: (NSString *) filePath
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *shareLink, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:k_url_acces_shared_api];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request shareByLinkFileOrFolderByServer:serverPath andPath:filePath onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
-
- OCXMLShareByLinkParser *parser = [[OCXMLShareByLinkParser alloc]init];
-
- // NSLog(@"response: %@", [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]);
-
- [parser initParserWithData:responseData];
-
- if (parser.statusCode == kOCSharedAPISuccessful || parser.statusCode == kOCShareeAPISuccessful) {
-
- NSString *url = parser.url;
- NSString *token = parser.token;
-
- if (url != nil) {
-
- successRequest(response, url, request.redirectedServer);
-
- } else if (token != nil) {
- //We remove the \n and the empty spaces " "
- token = [token stringByReplacingOccurrencesOfString:@"\n" withString:@""];
- token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];
-
- successRequest(response, token, request.redirectedServer);
-
- } else {
-
- NSError *error = [UtilsFramework getErrorWithCode:parser.statusCode andCustomMessageFromTheServer:parser.message];
- failureRequest(response, error, request.redirectedServer);
- }
-
- } else {
-
- NSError *error = [UtilsFramework getErrorWithCode:parser.statusCode andCustomMessageFromTheServer:parser.message];
- failureRequest(response, error, request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)shareWith:(NSString *)userOrGroup shareeType:(NSInteger)shareeType inServer:(NSString *) serverPath andFileOrFolderPath:(NSString *) filePath andPermissions:(NSInteger) permissions onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer))failureRequest{
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:k_url_acces_shared_api];
- userOrGroup = [userOrGroup encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request shareWith:userOrGroup shareeType:shareeType inServer:serverPath andPath:filePath andPermissions:permissions onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
- NSData *responseData = (NSData*) responseObject;
-
- OCXMLShareByLinkParser *parser = [[OCXMLShareByLinkParser alloc]init];
-
- // NSLog(@"response: %@", [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]);
-
- [parser initParserWithData:responseData];
-
- if (parser.statusCode == kOCSharedAPISuccessful || parser.statusCode == kOCShareeAPISuccessful) {
- successRequest(response, request.redirectedServer);
- } else {
- NSError *error = [UtilsFramework getErrorWithCode:parser.statusCode andCustomMessageFromTheServer:parser.message];
- failureRequest(response, error, request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-
-}
-
-- (void) unShareFileOrFolderByServer: (NSString *) path andIdRemoteShared: (NSInteger) idRemoteShared
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest{
-
- path = [path encodeString:NSUTF8StringEncoding];
- path = [path stringByAppendingString:k_url_acces_shared_api];
- path = [path stringByAppendingString:[NSString stringWithFormat:@"/%ld",(long)idRemoteShared]];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request unShareFileOrFolderByServer:path onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
- if (successRequest) {
- //Return success
- successRequest(response, request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void) isShareFileOrFolderByServer: (NSString *) path andIdRemoteShared: (NSInteger) idRemoteShared
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer, BOOL isShared, id shareDto)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- path = [path encodeString:NSUTF8StringEncoding];
- path = [path stringByAppendingString:k_url_acces_shared_api];
- path = [path stringByAppendingString:[NSString stringWithFormat:@"/%ld",(long)idRemoteShared]];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request isShareFileOrFolderByServer:path onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
- if (successRequest) {
-
- NSData *responseData = (NSData*) responseObject;
- OCXMLSharedParser *parser = [[OCXMLSharedParser alloc]init];
-
- // NSLog(@"response: %@", [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]);
-
- [parser initParserWithData:responseData];
-
- BOOL isShared = NO;
-
- OCSharedDto *shareDto = nil;
-
- if (parser.shareList) {
-
- NSMutableArray *sharedList = [parser.shareList mutableCopy];
-
- if ([sharedList count] > 0) {
- isShared = YES;
- shareDto = [sharedList objectAtIndex:0];
- }
-
- }
-
- //Return success
- successRequest(response, request.redirectedServer, isShared, shareDto);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void) updateShare:(NSInteger)shareId ofServerPath:(NSString *)serverPath withPasswordProtect:(NSString*)password andNote:(NSString *)note andExpirationTime:(NSString*)expirationTime andPermissions:(NSInteger)permissions andHideDownload:(BOOL)hideDownload
- onCommunication:(OCCommunication *)sharedOCCommunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest{
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:k_url_acces_shared_api];
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"/%ld",(long)shareId]];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request updateShareItem:shareId ofServerPath:serverPath withPasswordProtect:password andNote:note andExpirationTime:expirationTime andPermissions:permissions andHideDownload:hideDownload onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
-
- OCXMLShareByLinkParser *parser = [[OCXMLShareByLinkParser alloc]init];
-
- // NSLog(@"response: %@", [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]);
-
- [parser initParserWithData:responseData];
-
- if (parser.statusCode == kOCSharedAPISuccessful || parser.statusCode == kOCShareeAPISuccessful) {
- successRequest(response, request.redirectedServer);
- } else {
- NSError *error = [UtilsFramework getErrorWithCode:parser.statusCode andCustomMessageFromTheServer:parser.message];
- failureRequest(response, error, request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-
-}
-
-- (void) searchUsersAndGroupsWith:(NSString *)searchString forPage:(NSInteger)page with:(NSInteger)resultsPerPage ofServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *itemList, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest{
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:k_url_access_sharee_api];
-
- searchString = [searchString encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request searchUsersAndGroupsWith:searchString forPage:page with:resultsPerPage ofServer:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
-
- NSMutableArray *itemList = [NSMutableArray new];
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
-
- if (error == nil) {
-
- NSDictionary *ocsDict = [jsongParsed valueForKey:@"ocs"];
-
- NSDictionary *metaDict = [ocsDict valueForKey:@"meta"];
- NSInteger statusCode = [[metaDict valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCShareeAPISuccessful || statusCode == kOCSharedAPISuccessful) {
-
- NSDictionary *dataDict = [ocsDict valueForKey:@"data"];
- NSArray *exactDict = [dataDict valueForKey:@"exact"];
- NSArray *usersFounded = [dataDict valueForKey:@"users"];
- NSArray *groupsFounded = [dataDict valueForKey:@"groups"];
- NSArray *usersRemote = [dataDict valueForKey:@"remotes"];
- NSArray *usersExact = [exactDict valueForKey:@"users"];
- NSArray *groupsExact = [exactDict valueForKey:@"groups"];
- NSArray *remotesExact = [exactDict valueForKey:@"remotes"];
-
- [self addUserItemOfType:shareTypeUser fromArray:usersFounded ToList:itemList];
- [self addUserItemOfType:shareTypeUser fromArray:usersExact ToList:itemList];
- [self addUserItemOfType:shareTypeRemote fromArray:usersRemote ToList:itemList];
- [self addUserItemOfType:shareTypeRemote fromArray:remotesExact ToList:itemList];
- [self addGroupItemFromArray:groupsFounded ToList:itemList];
- [self addGroupItemFromArray:groupsExact ToList:itemList];
-
- }else{
-
- NSString *message = (NSString*)[metaDict objectForKey:@"message"];
-
- if ([message isKindOfClass:[NSNull class]]) {
- message = @"";
- }
-
- NSError *error = [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message];
- failureRequest(response, error, request.redirectedServer);
-
- }
-
- //Return success
- successRequest(response, itemList, request.redirectedServer);
-
- }
-
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - Capabilities
-
-- (void) getCapabilitiesOfServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, OCCapabilities *capabilities, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest{
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:k_url_capabilities];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request getCapabilitiesOfServer:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- OCCapabilities *capabilities = [OCCapabilities new];
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"dic: %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *data = [ocs valueForKey:@"data"];
- NSDictionary *version = [data valueForKey:@"version"];
-
- if (ocs.count > 0 && data.count > 0 && version.count > 0) {
-
- //VERSION
-
- NSNumber *versionMajorNumber = (NSNumber*) [version valueForKey:@"major"];
- NSNumber *versionMinorNumber = (NSNumber*) [version valueForKey:@"minor"];
- NSNumber *versionMicroNumber = (NSNumber*) [version valueForKey:@"micro"];
-
- capabilities.versionMajor = versionMajorNumber.integerValue;
- capabilities.versionMinor = versionMinorNumber.integerValue;
- capabilities.versionMicro = versionMicroNumber.integerValue;
-
- capabilities.versionString = (NSString*)[version valueForKey:@"string"];
- capabilities.versionEdition = (NSString*)[version valueForKey:@"edition"];
-
- NSDictionary *capabilitiesDict = [data valueForKey:@"capabilities"];
-
- //CORE
-
- NSDictionary *core = [capabilitiesDict valueForKey:@"core"];
-
- NSNumber *corePollIntervalNumber = (NSNumber*)[core valueForKey:@"pollinterval"];
- capabilities.corePollInterval = corePollIntervalNumber.integerValue;
- capabilities.coreWebDavRoot = [core valueForKey:@"webdav-root"];
-
- //FILE SHARING
-
- NSDictionary *fileSharing = [capabilitiesDict valueForKey:@"files_sharing"];
-
- NSNumber *fileSharingAPIEnabled = (NSNumber*)[fileSharing valueForKey:@"api_enabled"];
- NSNumber *filesSharingDefaultPermissions = (NSNumber*)[fileSharing valueForKey:@"default_permissions"];
- NSNumber *fileSharingGroupSharing = (NSNumber*)[fileSharing valueForKey:@"group_sharing"];
- NSNumber *filesSharingReSharing = (NSNumber*)[fileSharing valueForKey:@"resharing"];
-
- capabilities.isFilesSharingAPIEnabled = fileSharingAPIEnabled.boolValue;
- capabilities.filesSharingDefaulPermissions = filesSharingDefaultPermissions.integerValue;
- capabilities.isFilesSharingGroupSharing = fileSharingGroupSharing.boolValue;
- capabilities.isFilesSharingReSharing = filesSharingReSharing.boolValue;
-
- //FILE SHARING - PUBLIC
-
- NSDictionary *fileSharingPublic = [fileSharing valueForKey:@"public"];
-
- NSNumber *filesSharingPublicShareLinkEnabledNumber = (NSNumber*)[fileSharingPublic valueForKey:@"enabled"];
- NSNumber *filesSharingAllowPublicUploadsEnabledNumber = (NSNumber*)[fileSharingPublic valueForKey:@"upload"];
- NSNumber *isFilesSharingAllowPublicUserSendMailNumber = (NSNumber*)[fileSharingPublic valueForKey:@"send_mail"];
- NSNumber *filesSharingAllowPublicUploadFilesDrop = (NSNumber*)[fileSharingPublic valueForKey:@"upload_files_drop"];
- NSNumber *filesSharingAllowPublicMultipleLinks = (NSNumber*)[fileSharingPublic valueForKey:@"multiple_links"];
-
- capabilities.isFilesSharingPublicShareLinkEnabled = filesSharingPublicShareLinkEnabledNumber.boolValue;
- capabilities.isFilesSharingAllowPublicUploadsEnabled = filesSharingAllowPublicUploadsEnabledNumber.boolValue;
- capabilities.isFilesSharingAllowPublicUserSendMail = isFilesSharingAllowPublicUserSendMailNumber.boolValue;
- capabilities.isFilesSharingAllowPublicUploadFilesDrop = filesSharingAllowPublicUploadFilesDrop.boolValue;
- capabilities.isFilesSharingAllowPublicMultipleLinks = filesSharingAllowPublicMultipleLinks.boolValue;
-
- NSDictionary *fileSharingPublicExpireDate = [fileSharingPublic valueForKey:@"expire_date"];
-
- NSNumber *filesSharingPublicExpireDateByDefaultEnabledNumber = (NSNumber*)[fileSharingPublicExpireDate valueForKey:@"enabled"];
- NSNumber *filesSharingPublicExpireDateEnforceEnabledNumber = (NSNumber*)[fileSharingPublicExpireDate valueForKey:@"enforced"];
- NSNumber *filesSharingPublicExpireDateDaysNumber = (NSNumber*)[fileSharingPublicExpireDate valueForKey:@"days"];
-
- capabilities.isFilesSharingPublicExpireDateByDefaultEnabled = filesSharingPublicExpireDateByDefaultEnabledNumber.boolValue;
- capabilities.isFilesSharingPublicExpireDateEnforceEnabled = filesSharingPublicExpireDateEnforceEnabledNumber.boolValue;
- capabilities.filesSharingPublicExpireDateDays = filesSharingPublicExpireDateDaysNumber.integerValue;
-
- NSDictionary *fileSharingPublicPassword = [fileSharingPublic valueForKey:@"password"];
-
- NSNumber *fileSharingPublicPasswordEnforcedEnabled = (NSNumber*)[fileSharingPublicPassword valueForKey:@"enforced"];
-
- capabilities.isFilesSharingPublicPasswordEnforced = fileSharingPublicPasswordEnforcedEnabled.boolValue;
-
- //FILE SHARING - USER
-
- NSDictionary *fileSharingUser = [fileSharing valueForKey:@"user"];
-
- NSNumber *isFilesSharingAllowUserSendMailNumber = (NSNumber*)[fileSharingUser valueForKey:@"send_mail"];
-
- capabilities.isFilesSharingAllowUserSendMail = isFilesSharingAllowUserSendMailNumber.boolValue;
-
- NSDictionary *fileSharingUserExpireDate = [fileSharingUser valueForKey:@"expire_date"];
-
- NSNumber *filesSharingUserExpireDateNumber = (NSNumber*)[fileSharingUserExpireDate valueForKey:@"enabled"];
-
- capabilities.isFilesSharingUserExpireDate = filesSharingUserExpireDateNumber.boolValue;
-
- //FILE SHARING - GROUP
-
- NSDictionary *fileSharingGroup = [fileSharing valueForKey:@"group"];
-
- NSNumber *filesSharingGroupEnabled = (NSNumber*)[fileSharingGroup valueForKey:@"enabled"];
-
- capabilities.isFilesSharingGroupEnabled = filesSharingGroupEnabled.boolValue;
-
- NSDictionary *fileSharingGroupExpireDate = [fileSharingGroup valueForKey:@"expire_date"];
-
- NSNumber *filesSharingGroupExpireDateNumber = (NSNumber*)[fileSharingGroupExpireDate valueForKey:@"enabled"];
-
- capabilities.isFilesSharingGroupExpireDate = filesSharingGroupExpireDateNumber.boolValue;
-
- //FILE SHARING - FEDERATION
-
- NSDictionary *fileSharingFederation = [fileSharing valueForKey:@"federation"];
- NSDictionary *fileSharingFederationExpireDate = [fileSharingFederation valueForKey:@"expire_date"];
-
- NSNumber *filesSharingFederationAllowUserSendSharesNumber = (NSNumber*)[fileSharingFederation valueForKey:@"outgoing"];
- NSNumber *filesSharingFederationAllowUserReceiveSharesNumber = (NSNumber*)[fileSharingFederation valueForKey:@"incoming"];
- NSNumber *filesSharingFederationExpireDateNumber = (NSNumber*)[fileSharingFederationExpireDate valueForKey:@"enabled"];
-
- capabilities.isFilesSharingFederationAllowUserSendShares = filesSharingFederationAllowUserSendSharesNumber.boolValue;
- capabilities.isFilesSharingFederationAllowUserReceiveShares = filesSharingFederationAllowUserReceiveSharesNumber.boolValue;
- capabilities.isFilesSharingFederationExpireDate = filesSharingFederationExpireDateNumber.boolValue;
-
- //FILE SHARING - SHAREBYMAIL
-
- NSDictionary *fileSharingShareByMail = [fileSharing valueForKey:@"sharebymail"];
-
- NSNumber *fileSharingShareByMailEnabled = (NSNumber*)[fileSharingShareByMail valueForKey:@"enabled"];
-
- capabilities.isFileSharingShareByMailEnabled = fileSharingShareByMailEnabled.boolValue;
-
- NSDictionary *fileSharingShareByMailExpireDate = [fileSharingShareByMail valueForKey:@"expire_date"];
-
- NSNumber *fileSharingShareByMailExpireDateNumber = (NSNumber*)[fileSharingShareByMailExpireDate valueForKey:@"enabled"];
-
- capabilities.isFileSharingShareByMailExpireDate = fileSharingShareByMailExpireDateNumber.boolValue;
-
- NSDictionary *fileSharingShareByMailPassword = [fileSharingShareByMail valueForKey:@"password"];
-
- NSNumber *fileSharingShareByMailPasswordNumber = (NSNumber*)[fileSharingShareByMailPassword valueForKey:@"enabled"];
-
- capabilities.isFileSharingShareByMailPassword = fileSharingShareByMailPasswordNumber.boolValue;
-
- NSDictionary *fileSharingShareByMailUploadFilesDrop = [fileSharingShareByMail valueForKey:@"upload_files_drop"];
-
- NSNumber *fileSharingShareByMailUploadFilesDropNumber = (NSNumber*)[fileSharingShareByMailUploadFilesDrop valueForKey:@"enabled"];
-
- capabilities.isFileSharingShareByMailUploadFilesDrop = fileSharingShareByMailUploadFilesDropNumber.boolValue;
-
- // EXTERNAL SITES
-
- NSDictionary *externalSitesDic = [capabilitiesDict valueForKey:@"external"];
- if (externalSitesDic) {
- capabilities.isExternalSitesServerEnabled = YES;
- NSArray *externalSitesArray = [externalSitesDic valueForKey:@"v1"];
- capabilities.externalSiteV1 = [externalSitesArray componentsJoinedByString:@","];
- }
-
- // ACTIVITY
-
- NSDictionary *activityDic = [capabilitiesDict valueForKey:@"activity"];
- if (activityDic) {
- NSArray *activityArray = [activityDic valueForKey:@"apiv2"];
- if (activityArray) {
- capabilities.isActivityV2Enabled = YES;
- capabilities.activityV2 = [activityArray componentsJoinedByString:@","];
- }
- }
-
- // NOTIFICATION
-
- NSDictionary *notificationDic = [capabilitiesDict valueForKey:@"notifications"];
- if (notificationDic) {
- capabilities.isNotificationServerEnabled = YES;
- NSArray *ocsendpointsArray = [notificationDic valueForKey:@"ocs-endpoints"];
- capabilities.notificationOcsEndpoints = [ocsendpointsArray componentsJoinedByString:@","];
- NSArray *pushArray = [notificationDic valueForKey:@"push"];
- capabilities.notificationPush = [pushArray componentsJoinedByString:@","];
- }
-
- // SPREED
-
- NSDictionary *spreedDic = [capabilitiesDict valueForKey:@"spreed"];
- if (spreedDic) {
- capabilities.isSpreedServerEnabled = YES;
- NSArray *featuresArray = [capabilitiesDict valueForKey:@"features"];
- capabilities.spreedFeatures = [featuresArray componentsJoinedByString:@","];
- }
-
- //FILES
-
- NSDictionary *files = [capabilitiesDict valueForKey:@"files"];
-
- NSNumber *fileBigFileChunkingEnabledNumber = (NSNumber*)[files valueForKey:@"bigfilechunking"];
- NSNumber *fileUndeleteEnabledNumber = (NSNumber*)[files valueForKey:@"undelete"];
- NSNumber *fileVersioningEnabledNumber = (NSNumber*)[files valueForKey:@"versioning"];
-
- capabilities.isFileBigFileChunkingEnabled = fileBigFileChunkingEnabledNumber.boolValue;
- capabilities.isFileUndeleteEnabled = fileUndeleteEnabledNumber.boolValue;
- capabilities.isFileVersioningEnabled = fileVersioningEnabledNumber.boolValue;
-
- NSDictionary *pagination = [files valueForKey:@"pagination"];
- if (pagination) {
- capabilities.isPaginationEnabled = true;
- capabilities.paginationEndponit = [pagination valueForKey:@"endpoint"];
- }
-
- //THEMING
-
- NSDictionary *theming = [capabilitiesDict valueForKey:@"theming"];
-
- if ([theming count] > 0) {
-
- if ([theming valueForKey:@"background"] && ![[theming valueForKey:@"background"] isEqual:[NSNull null]])
- capabilities.themingBackground = [theming valueForKey:@"background"];
-
- if ([theming valueForKey:@"background-default"] && ![[theming valueForKey:@"background-default"] isEqual:[NSNull null]]) {
- NSNumber *result = (NSNumber*)[theming valueForKey:@"background-default"];
- capabilities.themingBackgroundDefault = result.boolValue;
- }
-
- if ([theming valueForKey:@"background-plain"] && ![[theming valueForKey:@"background-plain"] isEqual:[NSNull null]]) {
- NSNumber *result = (NSNumber*)[theming valueForKey:@"background-plain"];
- capabilities.themingBackgroundPlain = result.boolValue;
- }
-
- if ([theming valueForKey:@"color"] && ![[theming valueForKey:@"color"] isEqual:[NSNull null]])
- capabilities.themingColor = [theming valueForKey:@"color"];
-
- if ([theming valueForKey:@"color-element"] && ![[theming valueForKey:@"color-element"] isEqual:[NSNull null]])
- capabilities.themingColorElement = [theming valueForKey:@"color-element"];
-
- if ([theming valueForKey:@"color-text"] && ![[theming valueForKey:@"color-text"] isEqual:[NSNull null]])
- capabilities.themingColorText = [theming valueForKey:@"color-text"];
-
- if ([theming valueForKey:@"logo"] && ![[theming valueForKey:@"logo"] isEqual:[NSNull null]])
- capabilities.themingLogo = [theming valueForKey:@"logo"];
-
- if ([theming valueForKey:@"name"] && ![[theming valueForKey:@"name"] isEqual:[NSNull null]])
- capabilities.themingName = [theming valueForKey:@"name"];
-
- if ([theming valueForKey:@"slogan"] && ![[theming valueForKey:@"slogan"] isEqual:[NSNull null]])
- capabilities.themingSlogan = [theming valueForKey:@"slogan"];
-
- if ([theming valueForKey:@"url"] && ![[theming valueForKey:@"url"] isEqual:[NSNull null]])
- capabilities.themingUrl = [theming valueForKey:@"url"];
- }
-
- //END TO END Encryption
-
- NSDictionary *endToEndEncryption = [capabilitiesDict valueForKey:@"end-to-end-encryption"];
-
- if ([endToEndEncryption count] > 0) {
-
- NSNumber *endToEndEncryptionEnabled = (NSNumber*)[endToEndEncryption valueForKey:@"enabled"];
- capabilities.isEndToEndEncryptionEnabled = endToEndEncryptionEnabled.boolValue;
-
- if ([endToEndEncryption valueForKey:@"api-version"] && ![[endToEndEncryption valueForKey:@"api-version"] isEqual:[NSNull null]])
- capabilities.endToEndEncryptionVersion = [endToEndEncryption valueForKey:@"api-version"];
- }
-
- //Richdocuments
-
- NSDictionary *richdocuments = [capabilitiesDict valueForKey:@"richdocuments"];
-
- if (richdocuments!= nil && [richdocuments count] > 0) {
- capabilities.richdocumentsDirectEditing = [[richdocuments valueForKey:@"direct_editing"] boolValue];
- capabilities.richdocumentsMimetypes = [richdocuments valueForKey:@"mimetypes"];
- }
-
- //Handwerkcloud
-
- NSDictionary *handwerkcloudDic = [capabilitiesDict valueForKey:@"handwerkcloud"];
- if (handwerkcloudDic) {
- NSNumber *isHandwerkcloudEnabledNumber = (NSNumber*)[handwerkcloudDic valueForKey:@"enabled"];
- capabilities.isHandwerkcloudEnabled = isHandwerkcloudEnabledNumber.boolValue;
-
- if ([handwerkcloudDic valueForKey:@"shop_url"] && ![[handwerkcloudDic valueForKey:@"shop_url"] isEqual:[NSNull null]])
- capabilities.HCShopUrl = [handwerkcloudDic valueForKey:@"shop_url"];
- }
-
- //Imagemeter
-
- NSDictionary *imagemeterDic = [capabilitiesDict valueForKey:@"imagemeter"];
- if (imagemeterDic) {
- NSNumber *isImagemeterEnabledNumber = (NSNumber*)[imagemeterDic valueForKey:@"enabled"];
- capabilities.isImagemeterEnabled = isImagemeterEnabledNumber.boolValue;
- }
-
- //Fulltextsearch
- NSDictionary *fulltextsearchDic = [capabilitiesDict valueForKey:@"fulltextsearch"];
- if (fulltextsearchDic) {
- NSNumber *isFulltextsearchEnabledNumber = (NSNumber*)[fulltextsearchDic valueForKey:@"remote"];
- capabilities.isFulltextsearchEnabled = isFulltextsearchEnabledNumber.boolValue;
- }
-
- //extendedSupport
- NSDictionary *extendedSupportDic = [capabilitiesDict valueForKey:@"extendedSupport"];
- if (extendedSupportDic) {
- NSNumber *isExtendedSupportEnabled = (NSNumber*)[extendedSupportDic valueForKey:@"enabled"];
- capabilities.isExtendedSupportEnabled = isExtendedSupportEnabled.boolValue;
- }
- }
-
- successRequest(response, capabilities, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - Thumbnail
-
-- (NSURLSessionTask *) getRemoteThumbnailByServer:(NSString*)serverPath ofFilePath:(NSString *)filePath withWidth:(NSInteger)fileWidth andHeight:(NSInteger)fileHeight onCommunication:(OCCommunication *)sharedOCComunication
- successRequest:(void(^)(NSHTTPURLResponse *response, NSData *thumbnail, NSString *redirectedServer)) successRequest
- failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- filePath = [filePath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
-
- OCHTTPRequestOperation *operation = [request getRemoteThumbnailByServer:serverPath ofFilePath:filePath withWidth:fileWidth andHeight:fileHeight onCommunication:sharedOCComunication
- success:^(NSHTTPURLResponse *response, id responseObject) {
- NSData *responseData = (NSData*) responseObject;
-
- successRequest(response, responseData, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, id _Nullable responseObject, NSError * _Nonnull error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-
- [operation resume];
-
- return operation;
-}
-
-- (NSURLSessionTask *) getRemotePreviewByServer:(NSString*)serverPath ofFilePath:(NSString *)filePath withWidth:(NSInteger)fileWidth andHeight:(NSInteger)fileHeight andA:(NSInteger)a andMode:(NSString * _Nonnull)mode path:(NSString * _Nonnull)path onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- filePath = [filePath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- OCHTTPRequestOperation *operation = [request getRemotePreviewByServer:serverPath ofFilePath:filePath withWidth:fileWidth andHeight:fileHeight andA:a andMode:mode path:path onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
-
- successRequest(response, responseData, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, id _Nullable responseObject, NSError * _Nonnull error) {
-
- failureRequest(response, error, request.redirectedServer);
-
- }];
-
- [operation resume];
-
- return operation;
-}
-
-- (NSURLSessionTask *) getRemotePreviewTrashByServer:(NSString*)serverPath ofFileId:(NSString *)fileId size:(NSString *)size onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- OCHTTPRequestOperation *operation = [request getRemotePreviewTrashByServer:serverPath ofFileId:fileId size:size onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
-
- successRequest(response, responseData, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, id _Nullable responseObject, NSError * _Nonnull error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-
- [operation resume];
-
- return operation;
-}
-
-#pragma mark - Notification
-
-- (void)getNotificationServer:(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];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request getNotificationServer:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- NSData *responseData = (NSData*) responseObject;
- NSMutableArray *listOfNotifications = [NSMutableArray new];
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] Notifications : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *datas = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCNotificationAPINoContent || statusCode == kOCNotificationAPISuccessful) {
-
- for (NSDictionary *data in datas) {
-
- OCNotifications *notification = [OCNotifications new];
-
- if ([data valueForKey:@"notification_id"] && ![[data valueForKey:@"notification_id"] isEqual:[NSNull null]])
- notification.idNotification = [[data valueForKey:@"notification_id"] integerValue];
-
- if ([data valueForKey:@"app"] && ![[data valueForKey:@"app"] isEqual:[NSNull null]])
- notification.application = [data valueForKey:@"app"];
-
- if ([data valueForKey:@"user"] && ![[data valueForKey:@"user"] isEqual:[NSNull null]])
- notification.user = [data valueForKey:@"user"];
-
- if ([data valueForKey:@"datetime"] && ![[data valueForKey:@"datetime"] isEqual:[NSNull null]]) {
-
- NSString *dateString = [data valueForKey:@"datetime"];
-
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
- NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
- [dateFormatter setLocale:enUSPOSIXLocale];
- [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];
-
- notification.date = [dateFormatter dateFromString:dateString];
- }
-
- if ([data valueForKey:@"object_type"] && ![[data valueForKey:@"object_type"] isEqual:[NSNull null]])
- notification.typeObject = [data valueForKey:@"object_type"];
-
- if ([data valueForKey:@"object_id"] && ![[data valueForKey:@"object_id"] isEqual:[NSNull null]])
- notification.idObject = [data valueForKey:@"object_id"];
-
- if ([data valueForKey:@"subject"] && ![[data valueForKey:@"subject"] isEqual:[NSNull null]])
- notification.subject = [data valueForKey:@"subject"];
-
- if ([data valueForKey:@"subjectRich"] && ![[data valueForKey:@"subjectRich"] isEqual:[NSNull null]])
- notification.subjectRich = [data valueForKey:@"subjectRich"];
-
- if ([data valueForKey:@"subjectRichParameters"] && ![[data valueForKey:@"subjectRichParameters"] isEqual:[NSNull null]] && [[data valueForKey:@"subjectRichParameters"] count] > 0)
- notification.subjectRichParameters = [data valueForKey:@"subjectRichParameters"];
-
- if ([data valueForKey:@"message"] && ![[data valueForKey:@"message"] isEqual:[NSNull null]])
- notification.message = [data valueForKey:@"message"];
-
- if ([data valueForKey:@"messageRich"] && ![[data valueForKey:@"messageRich"] isEqual:[NSNull null]])
- notification.messageRich = [data valueForKey:@"messageRich"];
-
- if ([data valueForKey:@"messageRichParameters"] && ![[data valueForKey:@"messageRichParameters"] isEqual:[NSNull null]] && [[data valueForKey:@"messageRichParameters"] count] > 0)
- notification.messageRichParameters = [data valueForKey:@"messageRichParameters"];
-
- if ([data valueForKey:@"link"] && ![[data valueForKey:@"link"] isEqual:[NSNull null]])
- notification.link = [data valueForKey:@"link"];
-
- if ([data valueForKey:@"icon"] && ![[data valueForKey:@"icon"] isEqual:[NSNull null]])
- notification.icon = [data valueForKey:@"icon"];
-
- /* ACTION */
-
- NSMutableArray *actionsArr = [NSMutableArray new];
- NSDictionary *actions = [data valueForKey:@"actions"];
-
- for (NSDictionary *action in actions) {
-
- OCNotificationsAction *notificationAction = [OCNotificationsAction new];
-
- if ([action valueForKey:@"label"] && ![[action valueForKey:@"label"] isEqual:[NSNull null]])
- notificationAction.label = [action valueForKey:@"label"];
-
- if ([action valueForKey:@"link"] && ![[action valueForKey:@"link"] isEqual:[NSNull null]])
- notificationAction.link = [action valueForKey:@"link"];
-
- if ([action valueForKey:@"primary"] && ![[action valueForKey:@"primary"] isEqual:[NSNull null]])
- notificationAction.primary = [[action valueForKey:@"primary"] boolValue];
-
- if ([action valueForKey:@"type"] && ![[action valueForKey:@"type"] isEqual:[NSNull null]])
- notificationAction.type = [action valueForKey:@"type"];
-
- [actionsArr addObject:notificationAction];
- }
-
- notification.actions = [[NSArray alloc] initWithArray:actionsArr];
- [listOfNotifications addObject:notification];
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- successRequest(response, listOfNotifications, request.redirectedServer);
- });
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- });
- }
- } else {
- dispatch_async(dispatch_get_main_queue(), ^{
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- });
- }
- });
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)setNotificationServer:(NSString*)serverPath type:(NSString *)type onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *, NSString *))successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- __weak OCWebDAVClient *wrequest = request;
-
- [request setNotificationServer:serverPath type:type onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- successRequest(response, wrequest.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- failureRequest(response, error, wrequest.redirectedServer);
- }];
-}
-
-#pragma mark - Push Notification
-
-- (void)subscribingNextcloudServerPush:(NSString *)serverPath pushTokenHash:(NSString *)pushTokenHash devicePublicKey:(NSString *)devicePublicKey proxyServerPath:(NSString *)proxyServerPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *publicKey, NSString *deviceIdentifier, NSString *signature, NSString *redirectedServer)) successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:k_url_acces_remote_subscribing_nextcloud_server_api];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request subscribingNextcloudServerPush:serverPath pushTokenHash:pushTokenHash devicePublicKey:devicePublicKey proxyServerPath:proxyServerPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*)responseObject;
-
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *datas = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCPushNotificationAPISuccessful || statusCode == kOCPushNotificationAPINeedSendProxy) {
-
- NSString *publicKey = [datas objectForKey:@"publicKey"];
- NSString *deviceIdentifier = [datas objectForKey:@"deviceIdentifier"];
- NSString *signature = [datas objectForKey:@"signature"];
-
- successRequest(response, publicKey, deviceIdentifier, signature, request.redirectedServer);
-
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)unsubscribingNextcloudServerPush:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:k_url_acces_remote_subscribing_nextcloud_server_api];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request unsubscribingNextcloudServerPush:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
- successRequest(response, request.redirectedServer);
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)subscribingPushProxy:(NSString *)serverPath pushToken:(NSString *)pushToken deviceIdentifier:(NSString *)deviceIdentifier deviceIdentifierSignature:(NSString *)deviceIdentifierSignature publicKey:(NSString *)publicKey onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *, NSString *redirectedServer))successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:@"/devices"];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- [request.defaultHeaders setObject:self.userAgent forKey:@"User-Agent"];
-
- [request subscribingPushProxy:serverPath pushToken:pushToken deviceIdentifier:deviceIdentifier deviceIdentifierSignature:deviceIdentifierSignature publicKey:publicKey onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- if (successRequest) {
- //Return success
- successRequest(response, request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)unsubscribingPushProxy:(NSString *)serverPath deviceIdentifier:(NSString *)deviceIdentifier deviceIdentifierSignature:(NSString *)deviceIdentifierSignature publicKey:(NSString *)publicKey onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void (^)(NSHTTPURLResponse *, NSString *redirectedServer))successRequest failureRequest:(void (^)(NSHTTPURLResponse *, NSError *, NSString *))failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:@"/devices"];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- [request.defaultHeaders setObject:self.userAgent forKey:@"User-Agent"];
-
- [request unsubscribingPushProxy:serverPath deviceIdentifier:deviceIdentifier deviceIdentifierSignature:deviceIdentifierSignature publicKey:publicKey onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- if (successRequest) {
- //Return success
- successRequest(response, request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - Activity
-
-- (void) getActivityServer:(NSString*)serverPath since:(NSInteger)since limit:(NSInteger)limit objectId:(NSString *)objectId objectType:(NSString *)objectType previews:(BOOL)previews link:(NSString *)link onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfActivity, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:k_url_acces_remote_activity_api];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request getActivityServer:serverPath since:since limit:limit objectId:objectId objectType:objectType previews:previews link:link onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- NSMutableArray *listOfActivity = [NSMutableArray new];
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] Activity : %@",jsongParsed);
-
- if (jsongParsed && [jsongParsed isKindOfClass:[NSDictionary class]] && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *datas = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCNotificationAPINoContent || statusCode == kOCNotificationAPISuccessful) {
-
- for (NSDictionary *data in datas) {
-
- OCActivity *activity = [OCActivity new];
-
- if ([data valueForKey:@"activity_id"] && ![[data valueForKey:@"activity_id"] isEqual:[NSNull null]])
- activity.idActivity = [[data valueForKey:@"activity_id"] integerValue];
-
- if ([data valueForKey:@"datetime"] && ![[data valueForKey:@"datetime"] isEqual:[NSNull null]]) {
-
- NSString *dateString = [data valueForKey:@"datetime"];
-
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
- NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
- [dateFormatter setLocale:enUSPOSIXLocale];
- [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];
-
- activity.date = [dateFormatter dateFromString:dateString];
- }
-
- if ([data valueForKey:@"app"] && ![[data valueForKey:@"app"] isEqual:[NSNull null]])
- activity.app = [data valueForKey:@"app"];
-
- if ([data valueForKey:@"type"] && ![[data valueForKey:@"type"] isEqual:[NSNull null]])
- activity.type = [data valueForKey:@"type"];
-
- if ([data valueForKey:@"user"] && ![[data valueForKey:@"user"] isEqual:[NSNull null]])
- activity.user = [data valueForKey:@"user"];
-
- if ([data valueForKey:@"subject"] && ![[data valueForKey:@"subject"] isEqual:[NSNull null]])
- activity.subject = [data valueForKey:@"subject"];
-
- if ([data valueForKey:@"subject_rich"] && ![[data valueForKey:@"subject_rich"] isEqual:[NSNull null]])
- activity.subject_rich = [data valueForKey:@"subject_rich"];
-
- if ([data valueForKey:@"message"] && ![[data valueForKey:@"message"] isEqual:[NSNull null]])
- activity.message = [data valueForKey:@"message"];
-
- if ([data valueForKey:@"message_rich"] && ![[data valueForKey:@"message_rich"] isEqual:[NSNull null]])
- activity.message_rich = [data valueForKey:@"message_rich"];
-
- if ([data valueForKey:@"icon"] && ![[data valueForKey:@"icon"] isEqual:[NSNull null]])
- activity.icon = [data valueForKey:@"icon"];
-
- if ([data valueForKey:@"link"] && ![[data valueForKey:@"link"] isEqual:[NSNull null]])
- activity.link = [data valueForKey:@"link"];
-
- if ([data valueForKey:@"object_type"] && ![[data valueForKey:@"object_type"] isEqual:[NSNull null]])
- activity.object_type = [data valueForKey:@"object_type"];
-
- if ([data valueForKey:@"object_id"] && ![[data valueForKey:@"object_id"] isEqual:[NSNull null]])
- activity.object_id = [[data valueForKey:@"object_id"] integerValue];
-
- if ([data valueForKey:@"object_name"] && ![[data valueForKey:@"object_name"] isEqual:[NSNull null]])
- activity.object_name = [data valueForKey:@"object_name"];
-
- if ([data valueForKey:@"previews"] && ![[data valueForKey:@"previews"] isEqual:[NSNull null]])
- activity.previews = [data valueForKey:@"previews"];
-
- [listOfActivity addObject:activity];
- }
- successRequest(response, listOfActivity, request.redirectedServer);
-
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - External Sites
-
-- (void) getExternalSitesServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfExternalSites, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
- serverPath = [serverPath stringByAppendingString:k_url_acces_external_sites_api];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request getExternalSitesServer:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- NSMutableArray *listOfExternalSites = [NSMutableArray new];
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] External Sites : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *datas = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCNotificationAPINoContent || statusCode == kOCNotificationAPISuccessful) {
-
- for (NSDictionary *data in datas) {
-
- OCExternalSites *externalSites = [OCExternalSites new];
-
- externalSites.idExternalSite = [[data valueForKey:@"id"] integerValue];
-
- if ([data valueForKey:@"icon"] && ![[data valueForKey:@"icon"] isEqual:[NSNull null]])
- externalSites.icon = [data valueForKey:@"icon"];
-
- if ([data valueForKey:@"lang"] && ![[data valueForKey:@"lang"] isEqual:[NSNull null]])
- externalSites.lang = [data valueForKey:@"lang"];
-
- if ([data valueForKey:@"name"] && ![[data valueForKey:@"name"] isEqual:[NSNull null]])
- externalSites.name = [data valueForKey:@"name"];
-
- if ([data valueForKey:@"url"] && ![[data valueForKey:@"url"] isEqual:[NSNull null]])
- externalSites.url = [data valueForKey:@"url"];
-
- if ([data valueForKey:@"type"] && ![[data valueForKey:@"type"] isEqual:[NSNull null]])
- externalSites.type = [data valueForKey:@"type"];
-
- [listOfExternalSites addObject:externalSites];
- }
-
- successRequest(response, listOfExternalSites, request.redirectedServer);
-
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - User Profile
-
-- (void) getUserProfileServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, OCUserProfile *userProfile, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_acces_remote_userprofile_api];
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request getUserProfileServer:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- OCUserProfile *userProfile = [OCUserProfile new];
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] User Profile : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"address"] && ![[data valueForKey:@"address"] isKindOfClass:[NSNull class]])
- userProfile.address = [data valueForKey:@"address"];
-
- if ([data valueForKey:@"display-name"] && ![[data valueForKey:@"display-name"] isKindOfClass:[NSNull class]])
- userProfile.displayName = [data valueForKey:@"display-name"];
-
- if ([data valueForKey:@"email"] && ![[data valueForKey:@"email"] isKindOfClass:[NSNull class]])
- userProfile.email = [data valueForKey:@"email"];
-
- if ([data valueForKey:@"enabled"] && ![[data valueForKey:@"enabled"] isKindOfClass:[NSNull class]])
- userProfile.enabled = [[data valueForKey:@"enabled"] boolValue];
-
- if ([data valueForKey:@"id"] && ![[data valueForKey:@"id"] isKindOfClass:[NSNull class]])
- userProfile.id = [data valueForKey:@"id"];
-
- if ([data valueForKey:@"phone"] && ![[data valueForKey:@"phone"] isKindOfClass:[NSNull class]])
- userProfile.phone = [data valueForKey:@"phone"];
-
- if ([data valueForKey:@"twitter"] && ![[data valueForKey:@"twitter"] isKindOfClass:[NSNull class]])
- userProfile.twitter = [data valueForKey:@"twitter"];
-
- if ([data valueForKey:@"webpage"] && ![[data valueForKey:@"webpage"] isKindOfClass:[NSNull class]])
- userProfile.webpage = [data valueForKey:@"webpage"];
-
- /* QUOTA */
-
- NSDictionary *quota = [data valueForKey:@"quota"];
-
- if ([quota count] > 0) {
-
- if ([quota valueForKey:@"free"] && ![[quota valueForKey:@"free"] isKindOfClass:[NSNull class]])
- userProfile.quotaFree = [[quota valueForKey:@"free"] doubleValue];
-
- if ([quota valueForKey:@"quota"] && ![[quota valueForKey:@"quota"] isKindOfClass:[NSNull class]])
- userProfile.quota = [[quota valueForKey:@"quota"] doubleValue];
-
- if ([quota valueForKey:@"relative"] && ![[quota valueForKey:@"relative"] isKindOfClass:[NSNull class]])
- userProfile.quotaRelative = [[quota valueForKey:@"relative"] doubleValue];
-
- if ([quota valueForKey:@"total"] && ![[quota valueForKey:@"total"] isKindOfClass:[NSNull class]])
- userProfile.quotaTotal = [[quota valueForKey:@"total"] doubleValue];
-
- if ([quota valueForKey:@"used"] && ![[quota valueForKey:@"used"] isKindOfClass:[NSNull class]])
- userProfile.quotaUsed = [[quota valueForKey:@"used"] doubleValue];
- }
-
- successRequest(response, userProfile, request.redirectedServer);
-
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - End-to-End Encryption
-
-- (void)getEndToEndPublicKeys:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [serverPath stringByAppendingString:@"/public-key"];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request getEndToEndPublicKeys:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- NSString *publicKey = @"";
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] E2E Get PublicKey : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"public-keys"] && ![[data valueForKey:@"public-keys"] isKindOfClass:[NSNull class]]) {
-
- NSDictionary *publickeys = [data valueForKey:@"public-keys"];
- publicKey = [publickeys valueForKey:self.userID];
-
- successRequest(response, publicKey, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)getEndToEndPrivateKeyCipher:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *privateKeyChiper, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [serverPath stringByAppendingString:@"/private-key"];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request getEndToEndPrivateKeyCipher:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- NSString *privateKeyChiper = @"";
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] E2E Get PrivateKey : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"private-key"] && ![[data valueForKey:@"private-key"] isKindOfClass:[NSNull class]]) {
-
- privateKeyChiper = [data valueForKey:@"private-key"];
- successRequest(response, privateKeyChiper, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)getEndToEndServerPublicKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *publicKey, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [serverPath stringByAppendingString:@"/server-key"];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request getEndToEndServerPublicKey:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- NSString *publicKey = @"";
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] E2E Get Server PublicKey : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"public-key"] && ![[data valueForKey:@"public-key"] isKindOfClass:[NSNull class]]) {
-
- publicKey = [data valueForKey:@"public-key"];
- successRequest(response, publicKey, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- //Return success
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)signEndToEndPublicKey:(NSString*)serverPath publicKey:(NSString *)publicKey onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *publicKey,NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [serverPath stringByAppendingString:@"/public-key"];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request signEndToEndPublicKey:serverPath key:publicKey onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- NSString *publicKey = @"";
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] E2E Sign PublicKey : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"public-key"] && ![[data valueForKey:@"public-key"] isKindOfClass:[NSNull class]]) {
-
- publicKey = [data valueForKey:@"public-key"];
- successRequest(response, publicKey, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)storeEndToEndPrivateKeyCipher:(NSString*)serverPath privateKeyChiper:(NSString *)privateKeyChiper onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *privateKey, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [serverPath stringByAppendingString:@"/private-key"];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request storeEndToEndPrivateKeyCipher:serverPath key:privateKeyChiper onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- NSString *privateKey = @"";
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] E2E Store PrivateKey : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"private-key"] && ![[data valueForKey:@"private-key"] isKindOfClass:[NSNull class]]) {
-
- privateKey = [data valueForKey:@"private-key"];
- successRequest(response, privateKey, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)deleteEndToEndPublicKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [serverPath stringByAppendingString:@"/public-key"];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request deleteEndToEndPublicKey:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- //Return success
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)deleteEndToEndPrivateKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [serverPath stringByAppendingString:@"/private-key"];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request deleteEndToEndPrivateKey:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- //Return success
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)markEndToEndFolderEncrypted:(NSString*)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [NSString stringWithFormat:@"%@/encrypted/%@", serverPath, fileId];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request markEndToEndFolderEncrypted:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- //Return success
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)deletemarkEndToEndFolderEncrypted:(NSString*)serverPath fileId:(NSString *)fileId e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [NSString stringWithFormat:@"%@/encrypted/%@", serverPath, fileId];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request deletemarkEndToEndFolderEncrypted:serverPath e2eToken:e2eToken onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- //Return success
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)lockEndToEndFolderEncrypted:(NSString*)serverPath fileId:(NSString *)fileId e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *e2eToken, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [NSString stringWithFormat:@"%@/lock/%@", serverPath, fileId];
- if (e2eToken) {
- serverPath = [NSString stringWithFormat:@"%@?e2e-token=%@", serverPath, e2eToken];
- serverPath = [serverPath stringByAppendingString:@"&format=json"];
- } else {
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
- }
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request lockEndToEndFolderEncrypted:serverPath e2eToken:e2eToken onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- NSString *token = @"";
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] E2E Lock File : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"e2e-token"] && ![[data valueForKey:@"e2e-token"] isKindOfClass:[NSNull class]]) {
-
- token = [data valueForKey:@"e2e-token"];
- successRequest(response, token, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)unlockEndToEndFolderEncrypted:(NSString*)serverPath fileId:(NSString *)fileId e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [NSString stringWithFormat:@"%@/lock/%@", serverPath, fileId];
- serverPath = [serverPath stringByAppendingString:@"&format=json"];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request unlockEndToEndFolderEncrypted:serverPath e2eToken:e2eToken onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- //Return success
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)getEndToEndMetadata:(NSString*)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [NSString stringWithFormat:@"%@/meta-data/%@", serverPath, fileId];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request getEndToEndMetadata:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- NSString *encryptedMetadata = @"";
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] E2E Get Metadata : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"meta-data"] && ![[data valueForKey:@"meta-data"] isKindOfClass:[NSNull class]]) {
-
- encryptedMetadata = [data valueForKey:@"meta-data"];
- successRequest(response, encryptedMetadata, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
- } else {
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)storeEndToEndMetadata:(NSString*)serverPath fileId:(NSString *)fileId e2eToken:(NSString *)e2eToken encryptedMetadata:(NSString *)encryptedMetadata onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- encryptedMetadata = [encryptedMetadata encodeString:NSUTF8StringEncoding];
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [NSString stringWithFormat:@"%@/meta-data/%@", serverPath, fileId];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request storeEndToEndMetadata:serverPath metadata:encryptedMetadata e2eToken:e2eToken onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- NSString *encryptedMetadata = @"";
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] E2E Store Metadata : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"meta-data"] && ![[data valueForKey:@"meta-data"] isKindOfClass:[NSNull class]]) {
-
- encryptedMetadata = [data valueForKey:@"meta-data"];
- successRequest(response, encryptedMetadata, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)updateEndToEndMetadata:(NSString*)serverPath fileId:(NSString *)fileId encryptedMetadata:(NSString *)encryptedMetadata e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- encryptedMetadata = [encryptedMetadata encodeString:NSUTF8StringEncoding];
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [NSString stringWithFormat:@"%@/meta-data/%@", serverPath, fileId];
- serverPath = [NSString stringWithFormat:@"%@?e2e-token=%@", serverPath, e2eToken];
- serverPath = [serverPath stringByAppendingString:@"&format=json"];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request updateEndToEndMetadata:serverPath metadata:encryptedMetadata e2eToken:e2eToken onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData*) responseObject;
- NSString *encryptedMetadata = @"";
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] E2E Update Metadata : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"meta-data"] && ![[data valueForKey:@"meta-data"] isKindOfClass:[NSNull class]]) {
-
- encryptedMetadata = [data valueForKey:@"meta-data"];
- successRequest(response, encryptedMetadata, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)deleteEndToEndMetadata:(NSString*)serverPath fileId:(NSString *)fileId e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
- serverPath = [NSString stringWithFormat:@"%@/meta-data/%@", serverPath, fileId];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request deleteEndToEndMetadata:serverPath e2eToken:e2eToken onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- //Return success
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - Manage Mobile Editor OCS API
-
-- (void)createLinkRichdocuments:(NSString *)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *link, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_create_link_mobile_richdocuments];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request createLinkRichdocuments:serverPath fileId:fileId onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *operation, id response) {
-
- NSData *responseData = (NSData*) response;
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] Link richdocuments : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"url"] && ![[data valueForKey:@"url"] isKindOfClass:[NSNull class]]) {
-
- NSString *link = [data valueForKey:@"url"];
- successRequest(response, link, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)getTemplatesRichdocuments:(NSString *)serverPath typeTemplate:(NSString *)typeTemplate onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfTemplate, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_get_template_mobile_richdocuments];
- serverPath = [serverPath stringByAppendingString:typeTemplate];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request getTemplatesRichdocuments:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *operation, id response) {
-
- NSData *responseData = (NSData*) response;
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] Link richdocuments : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSMutableArray *list = [NSMutableArray new];
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- for (NSDictionary *dicDatas in data) {
-
- NCRichDocumentTemplate *template = [NCRichDocumentTemplate new];
-
- if ([dicDatas valueForKey:@"id"] && ![[dicDatas valueForKey:@"id"] isEqual:[NSNull null]])
- template.templateID = [[dicDatas valueForKey:@"id"] integerValue];
-
- if ([dicDatas valueForKey:@"delete"] && ![[dicDatas valueForKey:@"delete"] isKindOfClass:[NSNull class]])
- template.delete = [dicDatas valueForKey:@"delete"];
-
- if ([dicDatas valueForKey:@"extension"] && ![[dicDatas valueForKey:@"extension"] isKindOfClass:[NSNull class]])
- template.extension = [dicDatas valueForKey:@"extension"];
-
- if ([dicDatas valueForKey:@"name"] && ![[dicDatas valueForKey:@"name"] isKindOfClass:[NSNull class]])
- template.name = [dicDatas valueForKey:@"name"];
-
- if ([dicDatas valueForKey:@"preview"] && ![[dicDatas valueForKey:@"preview"] isKindOfClass:[NSNull class]])
- template.preview = [dicDatas valueForKey:@"preview"];
-
- if ([dicDatas valueForKey:@"type"] && ![[dicDatas valueForKey:@"type"] isKindOfClass:[NSNull class]])
- template.type = [dicDatas valueForKey:@"type"];
-
- [list addObject:template];
- }
-
- successRequest(response, list, request.redirectedServer);
-
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)createNewRichdocuments:(NSString *)serverPath path:(NSString *)path templateID:(NSString *)templateID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_create_new_mobile_richdocuments];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request createNewRichdocuments:serverPath path:path templateID:templateID onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *operation, id response) {
-
- NSData *responseData = (NSData*) response;
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] URL Asset : %@",jsongParsed);
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
-
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
- if ([data valueForKey:@"url"] && ![[data valueForKey:@"url"] isKindOfClass:[NSNull class]])
- successRequest(response, [data valueForKey:@"url"], request.redirectedServer);
- else
- successRequest(response, nil, request.redirectedServer);
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)createAssetRichdocuments:(NSString *)serverPath path:(NSString *)path onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_insert_assets_to_richdocuments];
- serverPath = [serverPath stringByAppendingString:@"?format=json"];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request createAssetRichdocuments:serverPath path:path onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *operation, id response) {
-
- NSData *responseData = (NSData*) response;
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] URL Asset : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- if ([jsongParsed valueForKey:@"url"] && ![[jsongParsed valueForKey:@"url"] isKindOfClass:[NSNull class]]) {
-
- NSString *url = [jsongParsed valueForKey:@"url"];
- successRequest(response, url, request.redirectedServer);
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - Trash
-
-- (void)listingTrash:(NSString *)path depth:(NSString *)depth onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest
-{
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- path = [path encodeString:NSUTF8StringEncoding];
-
- [request listTrash:path depth:depth onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
- NCXMLListParser *parser = [NCXMLListParser new];
- [parser initParserWithData:responseObject controlFirstFileOfList:true];
- NSMutableArray *list = [parser.list mutableCopy];
-
- dispatch_async(dispatch_get_main_queue(), ^{
- successRequest(response, list, request.redirectedServer);
- });
- });
- } failure:^(NSHTTPURLResponse *response, id responseData, NSError *error) {
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)emptyTrash:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest
-{
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request emptyTrash:path onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, id responseData, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - Fulltextsearch
-
-- (void)fullTextSearch:(NSString *)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath stringByAppendingString:k_url_fulltextsearch];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request fullTextSearch:serverPath data:data onCommunication:sharedOCComunication success:^(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response) {
-
- NSData *responseData = (NSData*) response;
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] Link richdocuments : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- successRequest(response, nil, request.redirectedServer);
-
- } else {
-
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - Remore wipe
-
-- (void)getRemoteWipeStatus:(NSString *)serverPath token:(NSString *)token onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, BOOL wipe, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [NSString stringWithFormat:@"%@/%@/check", serverPath, k_url_get_wipe];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request getSetRemoteWipe:serverPath token:token onCommunication:sharedOCComunication success:^(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response) {
-
- NSData *responseData = (NSData*) response;
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- BOOL wipe = (BOOL)[jsongParsed valueForKey:@"wipe"];
- successRequest(response, wipe, request.redirectedServer);
-
- } else {
-
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- //Return error
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)setRemoteWipeCompletition:(NSString *)serverPath token:(NSString *)token onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [NSString stringWithFormat:@"%@/%@/success", serverPath, k_url_get_wipe];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request getSetRemoteWipe:serverPath token:token onCommunication:sharedOCComunication success:^(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response) {
-
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - Comments
-
-- (void)getComments:(NSString *)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *list, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [NSString stringWithFormat:@"%@/comments/files/%@", serverPath, fileId];
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request getComments:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
-
- NSData *responseData = (NSData *)responseObject;
-
- NCXMLCommentsParser *parser = [NCXMLCommentsParser new];
- [parser initParserWithData:responseData];
- NSMutableArray *list = [parser.list mutableCopy];
-
- successRequest(response, list, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, id responseData, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)putComments:(NSString*)serverPath fileId:(NSString *)fileId message:(NSString *)message onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [NSString stringWithFormat:@"%@/comments/files/%@", serverPath, fileId];
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request putComments:serverPath message:message onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *operation, id response) {
-
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, id responseObject, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)updateComments:(NSString*)serverPath fileId:(NSString *)fileId messageID:(NSString *)messageID message:(NSString *)message onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [NSString stringWithFormat:@"%@/comments/files/%@/%@", serverPath, fileId, messageID];
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request updateComments:serverPath message:message onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *operation, id response) {
-
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, id responseObject, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)readMarkComments:(NSString*)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [NSString stringWithFormat:@"%@/comments/files/%@", serverPath, fileId];
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request readMarkComments:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *operation, id response) {
-
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, id responseObject, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)deleteComments:(NSString*)serverPath fileId:(NSString *)fileId messageID:(NSString *)messageID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [NSString stringWithFormat:@"%@/comments/files/%@/%@", serverPath, fileId, messageID];
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request deleteComments:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *operation, id response) {
-
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, id responseObject, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-#pragma mark - Third Parts
-
-- (void)getHCUserProfile:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, OCUserProfile *userProfile, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest
-{
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request getHCUserProfile:serverPath onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response) {
-
- NSData *responseData = (NSData*) response;
- OCUserProfile *userProfile = [OCUserProfile new];
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] User Profile : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- data = [data valueForKey:@"data"];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"address"] && ![[data valueForKey:@"address"] isKindOfClass:[NSNull class]])
- userProfile.address = [data valueForKey:@"address"];
-
- if ([data valueForKey:@"displayname"] && ![[data valueForKey:@"displayname"] isKindOfClass:[NSNull class]])
- userProfile.displayName = [data valueForKey:@"displayname"];
-
- if ([data valueForKey:@"businesssize"] && ![[data valueForKey:@"businesssize"] isKindOfClass:[NSNull class]]) {
- switch ([[data valueForKey:@"businesssize"] integerValue]) {
- case 1:
- userProfile.businessSize = @"1-4";
- break;
- case 5:
- userProfile.businessSize = @"5-9";
- break;
- case 10:
- userProfile.businessSize = @"10-19";
- break;
- case 20:
- userProfile.businessSize = @"20-49";
- break;
- case 50:
- userProfile.businessSize = @"50-99";
- break;
- case 100:
- userProfile.businessSize = @"100-249";
- break;
- case 250:
- userProfile.businessSize = @"250-499";
- break;
- case 500:
- userProfile.businessSize = @"500-999";
- break;
- case 1000:
- userProfile.businessSize = @"1000+";
- break;
- default:
- break;
- }
- }
-
- if ([data valueForKey:@"businesstype"] && ![[data valueForKey:@"businesstype"] isKindOfClass:[NSNull class]])
- userProfile.businessType = [data valueForKey:@"businesstype"];
-
- if ([data valueForKey:@"city"] && ![[data valueForKey:@"city"] isKindOfClass:[NSNull class]])
- userProfile.city = [data valueForKey:@"city"];
-
- if ([data valueForKey:@"company"] && ![[data valueForKey:@"company"] isKindOfClass:[NSNull class]])
- userProfile.company = [data valueForKey:@"company"];
-
- if ([data valueForKey:@"country"] && ![[data valueForKey:@"country"] isKindOfClass:[NSNull class]])
- userProfile.country = [data valueForKey:@"country"];
-
- if ([data valueForKey:@"email"] && ![[data valueForKey:@"email"] isKindOfClass:[NSNull class]])
- userProfile.email = [data valueForKey:@"email"];
-
- if ([data valueForKey:@"phone"] && ![[data valueForKey:@"phone"] isKindOfClass:[NSNull class]])
- userProfile.phone = [data valueForKey:@"phone"];
-
- if ([data valueForKey:@"role"] && ![[data valueForKey:@"role"] isKindOfClass:[NSNull class]])
- userProfile.role = [data valueForKey:@"role"];
-
- if ([data valueForKey:@"twitter"] && ![[data valueForKey:@"twitter"] isKindOfClass:[NSNull class]])
- userProfile.twitter = [data valueForKey:@"twitter"];
-
- if ([data valueForKey:@"website"] && ![[data valueForKey:@"website"] isKindOfClass:[NSNull class]])
- userProfile.webpage = [data valueForKey:@"website"];
-
- if ([data valueForKey:@"zip"] && ![[data valueForKey:@"zip"] isKindOfClass:[NSNull class]])
- userProfile.zip = [data valueForKey:@"zip"];
-
- successRequest(response, userProfile, request.redirectedServer);
-
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-
-}
-
-- (void)putHCUserProfile:(NSString*)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
-
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
- request = [self getRequestWithCredentials:request];
-
- [request putHCUserProfile:serverPath data:data onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *operation, id response) {
-
- successRequest(response, request.redirectedServer);
-
- } failure:^(NSHTTPURLResponse *response, id responseObject, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-}
-
-- (void)getHCFeatures:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, HCFeatures *features, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest
-{
- serverPath = [serverPath encodeString:NSUTF8StringEncoding];
-
- OCWebDAVClient *request = [OCWebDAVClient new];
- request = [self getRequestWithCredentials:request];
-
- [request getHCUserProfile:serverPath onCommunication:sharedOCCommunication success:^(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response) {
-
- NSData *responseData = (NSData*) response;
- HCFeatures *features = [HCFeatures new];
-
- //Parse
- NSError *error;
- NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
- NSLog(@"[LOG] User Profile Features : %@",jsongParsed);
-
- if (jsongParsed && jsongParsed.allKeys > 0) {
-
- NSDictionary *ocs = [jsongParsed valueForKey:@"ocs"];
- NSDictionary *meta = [ocs valueForKey:@"meta"];
- NSDictionary *data = [ocs valueForKey:@"data"];
- NSInteger statusCode = [[meta valueForKey:@"statuscode"] integerValue];
-
- data = [data valueForKey:@"data"];
-
- if (statusCode == kOCUserProfileAPISuccessful) {
-
- if ([data valueForKey:@"is_trial"] && ![[data valueForKey:@"is_trial"] isKindOfClass:[NSNull class]])
- features.isTrial = [[data valueForKey:@"is_trial"] boolValue];
-
- if ([data valueForKey:@"trial_expired"] && ![[data valueForKey:@"trial_expired"] isKindOfClass:[NSNull class]])
- features.trialExpired = [[data valueForKey:@"trial_expired"] boolValue];
-
- if ([data valueForKey:@"trial_remaining_sec"] && ![[data valueForKey:@"trial_remaining_sec"] isKindOfClass:[NSNull class]])
- features.trialRemainingSec = [[data valueForKey:@"trial_remaining_sec"] integerValue];
-
- if ([data valueForKey:@"trial_end_time"] && ![[data valueForKey:@"trial_end_time"] isKindOfClass:[NSNull class]])
- features.trialEndTime = [[data valueForKey:@"trial_end_time"] integerValue];
-
- if ([data valueForKey:@"trial_end"] && ![[data valueForKey:@"trial_end"] isKindOfClass:[NSNull class]])
- features.trialEnd = [data valueForKey:@"trial_end"];
-
- if ([data valueForKey:@"account_remove_expired"] && ![[data valueForKey:@"account_remove_expired"] isKindOfClass:[NSNull class]])
- features.accountRemoveExpired = [[data valueForKey:@"account_remove_expired"] boolValue];
-
- if ([data valueForKey:@"account_remove_remaining_sec"] && ![[data valueForKey:@"account_remove_remaining_sec"] isKindOfClass:[NSNull class]])
- features.accountRemoveRemainingSec = [[data valueForKey:@"account_remove_remaining_sec"] integerValue];
-
- if ([data valueForKey:@"account_remove_time"] && ![[data valueForKey:@"account_remove_time"] isKindOfClass:[NSNull class]])
- features.accountRemoveTime = [[data valueForKey:@"account_remove_time"] integerValue];
-
- if ([data valueForKey:@"account_remove"] && ![[data valueForKey:@"account_remove"] isKindOfClass:[NSNull class]])
- features.accountRemove = [data valueForKey:@"account_remove"];
-
- NSDictionary *nextGroupExpirationDic = [data valueForKey:@"next_group_expiration"];
- if (nextGroupExpirationDic) {
- if ([nextGroupExpirationDic valueForKey:@"group"] && ![[nextGroupExpirationDic valueForKey:@"group"] isKindOfClass:[NSNull class]])
- features.nextGroupExpirationGroup = [nextGroupExpirationDic valueForKey:@"group"];
-
- if ([nextGroupExpirationDic valueForKey:@"group_expired"] && ![[nextGroupExpirationDic valueForKey:@"group_expired"] isKindOfClass:[NSNull class]])
- features.nextGroupExpirationGroupExpired = [[nextGroupExpirationDic valueForKey:@"group_expired"] boolValue];
-
- if ([nextGroupExpirationDic valueForKey:@"expires_time"] && ![[nextGroupExpirationDic valueForKey:@"expires_time"] isKindOfClass:[NSNull class]])
- features.nextGroupExpirationExpiresTime = [[nextGroupExpirationDic valueForKey:@"expires_time"] integerValue];
-
- if ([nextGroupExpirationDic valueForKey:@"expires"] && ![[nextGroupExpirationDic valueForKey:@"expires"] isKindOfClass:[NSNull class]])
- features.nextGroupExpirationExpires = [nextGroupExpirationDic valueForKey:@"expires"];
- }
-
- successRequest(response, features, request.redirectedServer);
-
- } else {
-
- NSString *message = (NSString *)[meta objectForKey:@"message"];
- if ([message isKindOfClass:[NSNull class]]) {
- message = NSLocalizedString(@"_server_response_error_", nil);
- }
- failureRequest(response, [UtilsFramework getErrorWithCode:statusCode andCustomMessageFromTheServer:message], request.redirectedServer);
- }
-
- } else {
- failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedString(@"_server_response_error_", nil)], request.redirectedServer);
- }
-
- } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
-
- failureRequest(response, error, request.redirectedServer);
- }];
-
-}
-
-#pragma mark - Manage Mobile Editor OCS API
-
-- (void)eraseURLCache
-{
- [[NSURLCache sharedURLCache] setMemoryCapacity:0];
- [[NSURLCache sharedURLCache] setDiskCapacity:0];
-}
-
-#pragma mark - Utils
-
-- (void) addUserItemOfType:(NSInteger) shareeType fromArray:(NSArray*) usersArray ToList: (NSMutableArray *) itemList
-{
-
- for (NSDictionary *userFound in usersArray) {
- OCShareUser *user = [OCShareUser new];
-
- if ([[userFound valueForKey:@"label"] isKindOfClass:[NSNumber class]]) {
- NSNumber *number = [userFound valueForKey:@"label"];
- user.displayName = [NSString stringWithFormat:@"%ld", number.longValue];
- }else{
- user.displayName = [userFound valueForKey:@"label"];
- }
-
- NSDictionary *userValues = [userFound valueForKey:@"value"];
-
- if ([[userValues valueForKey:@"shareWith"] isKindOfClass:[NSNumber class]]) {
- NSNumber *number = [userValues valueForKey:@"shareWith"];
- user.name = [NSString stringWithFormat:@"%ld", number.longValue];
- }else{
- user.name = [userValues valueForKey:@"shareWith"];
- }
- user.shareeType = shareeType;
- user.server = [userValues valueForKey:@"server"];
-
- [itemList addObject:user];
- }
-}
-
-- (void) addGroupItemFromArray:(NSArray*) groupsArray ToList: (NSMutableArray *) itemList
-{
- for (NSDictionary *groupFound in groupsArray) {
-
- OCShareUser *group = [OCShareUser new];
-
- NSDictionary *groupValues = [groupFound valueForKey:@"value"];
- if ([[groupValues valueForKey:@"shareWith"] isKindOfClass:[NSNumber class]]) {
- NSNumber *number = [groupValues valueForKey:@"shareWith"];
- group.name = [NSString stringWithFormat:@"%ld", number.longValue];
- }else{
- group.name = [groupValues valueForKey:@"shareWith"];
- }
- group.shareeType = shareTypeGroup;
-
- [itemList addObject:group];
-
- }
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCErrorMsg.h b/Libraries external/OCCommunicationLib/OCErrorMsg.h
deleted file mode 100755
index eec178e76..000000000
--- a/Libraries external/OCCommunicationLib/OCErrorMsg.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// OCErrorMsg.h
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-#define kOCErrorServerUnauthorized 401
-//In the server we received a 403 also when the server is enforce to set a password.
-#define kOCErrorServerForbidden 403
-#define kOCErrorServerPathNotFound 404
-#define kOCErrorServerMethodNotPermitted 405
-#define kOCErrorProxyAuth 407
-#define kOCErrorServerTimeout 408
-#define kOCErrorServerInternalError 500
-
-#define kOCErrorSharedAPIWrong 400
-#define kOCSharedAPISuccessful 100
-#define kOCShareeAPISuccessful 200
-
-#define kOCNotificationAPINoContent 204
-#define kOCNotificationAPISuccessful 200
-
-#define kOCUserProfileAPISuccessful 200
-
-#define kOCPushNotificationAPISuccessful 200
-#define kOCPushNotificationAPINeedSendProxy 201
-
-typedef enum {
- OCServerErrorForbiddenCharacters = 101,
-} OCServerErrorEnum;
diff --git a/Libraries external/OCCommunicationLib/OCExternalSites.h b/Libraries external/OCCommunicationLib/OCExternalSites.h
deleted file mode 100644
index 21c646630..000000000
--- a/Libraries external/OCCommunicationLib/OCExternalSites.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// OCExternalSites.h
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 22/03/17.
-// Copyright © 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OCExternalSites : NSObject
-
-@property NSInteger idExternalSite;
-@property (nonatomic, strong) NSString *name;
-@property (nonatomic, strong) NSString *url;
-@property (nonatomic, strong) NSString *lang;
-@property (nonatomic, strong) NSString *icon;
-@property (nonatomic, strong) NSString *type;
-
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCExternalSites.m b/Libraries external/OCCommunicationLib/OCExternalSites.m
deleted file mode 100644
index 8db6eb15a..000000000
--- a/Libraries external/OCCommunicationLib/OCExternalSites.m
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// OCExternalSites.m
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 22/03/17.
-// Copyright © 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "OCExternalSites.h"
-
-@implementation OCExternalSites
-
-- (id)init {
-
- self = [super init];
-
- if (self) {
-
- self.idExternalSite = 0;
- self.name = @"";
- self.url = @"";
- self.lang = @"";
- self.icon = @"";
- self.type = @"";
- }
-
- return self;
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCFileDto.h b/Libraries external/OCCommunicationLib/OCFileDto.h
deleted file mode 100755
index b3dd9ccbd..000000000
--- a/Libraries external/OCCommunicationLib/OCFileDto.h
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// OCFileDto.h
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-//
-// Add Support for Quota
-// quotaUsed and quotaAvailable
-//
-// Add Support for Favorite
-// isFavorite
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OCFileDto : NSObject
-
-@property (nonatomic, copy) NSString *filePath;
-@property (nonatomic, copy) NSString *fileName;
-@property BOOL isDirectory;
-@property long size;
-@property long date;
-@property long creationDate;
-@property (nonatomic, copy) NSString *etag;
-@property (nonatomic, copy) NSString *permissions;
-@property (nonatomic, copy) NSString *ocId;
-@property (nonatomic, copy) NSString *fileId;
-@property BOOL isFavorite;
-@property BOOL isEncrypted;
-@property (nonatomic, copy) NSString *trashbinFileName;
-@property (nonatomic, copy) NSString *trashbinOriginalLocation;
-@property long trashbinDeletionTime;
-@property BOOL hasPreview;
-@property (nonatomic, copy) NSString *displayName;
-@property (nonatomic, copy) NSString *contentType;
-@property (nonatomic, copy) NSString *resourceType;
-@property long quotaUsedBytes;
-@property long quotaAvailableBytes;
-@property (nonatomic, copy) NSString *mountType;
-@property (nonatomic, copy) NSString *ownerId;
-@property (nonatomic, copy) NSString *ownerDisplayName;
-@property BOOL commentsUnread;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCFileDto.m b/Libraries external/OCCommunicationLib/OCFileDto.m
deleted file mode 100755
index 46dadf4b1..000000000
--- a/Libraries external/OCCommunicationLib/OCFileDto.m
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// OCFileDto.m
-// OCCommunicationLib
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-#import "OCFileDto.h"
-
-@implementation OCFileDto
-
-- (id)init {
-
- self = [super init];
-
- if (self) {
-
- self.filePath = @"";
- self.fileName = @"";
- self.etag = @"";
- self.permissions = @"";
- self.ocId = @"";
- self.fileId = @"";
- self.trashbinFileName = @"";
- self.trashbinOriginalLocation = @"";
- self.displayName = @"";
- self.contentType = @"";
- self.resourceType = @"";
- self.mountType = @"";
- self.ownerId = @"";
- self.ownerDisplayName = @"";
- }
-
- return self;
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCFrameworkConstants.h b/Libraries external/OCCommunicationLib/OCFrameworkConstants.h
deleted file mode 100755
index 959d6f306..000000000
--- a/Libraries external/OCCommunicationLib/OCFrameworkConstants.h
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-// OCFrameworkConstants.h
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-//Timeout to weddav requests
-#define k_timeout_webdav 30 //seconds
-
-//Timeout to upload
-#define k_timeout_upload 40 //seconds
-
-//Timeout for fast requests
-#define k_timeout_fast 5 //seconds
-
-//Timeout to search
-#define k_timeout_search 60 //seconds
-
-//Chunk length
-#define k_OC_lenght_chunk 1048576
-
-#define k_domain_error_code @"com.owncloud"
-
-//Url to access to Shared API to create
-//#define k_url_acces_shared_api @"ocs/v1.php/apps/files_sharing/api/v1/shares"
-#define k_url_acces_shared_api @"ocs/v2.php/apps/files_sharing/api/v1/shares"
-
-//Url to access to Remote Shared API
-#define k_url_acces_remote_shared_api @"ocs/v1.php/apps/files_sharing/api/v1/remote_shares"
-
-//Url to access to Sharee API
-#define k_url_access_sharee_api @"ocs/v2.php/apps/files_sharing/api/v1/sharees"
-
-//Url to access to Capabilities API
-#define k_url_capabilities @"ocs/v1.php/cloud/capabilities"
-
-//Url to access to Remote Notification API
-#define k_url_acces_remote_notification_api @"ocs/v2.php/apps/notifications/api/v2/notifications"
-
-//Url to access to Remote Subscribing Nextcloud server API
-#define k_url_acces_remote_subscribing_nextcloud_server_api @"/ocs/v2.php/apps/notifications/api/v2/push"
-
-//Url to access to Remote Activity API
-#define k_url_acces_remote_activity_api @"ocs/v2.php/apps/activity/api/v2/activity"
-
-//Url to access to External sites API
-#define k_url_acces_external_sites_api @"ocs/v2.php/apps/external/api/v1"
-
-//Url to access to User Profile API
-#define k_url_acces_remote_userprofile_api @"ocs/v2.php/cloud/user"
-
-//Url to access to End To End Encryption API
-#define k_url_client_side_encryption @"ocs/v2.php/apps/end_to_end_encryption/api/v1"
-
-//Url to access to document Mobile Editor OCS API
-#define k_url_create_link_mobile_richdocuments @"ocs/v2.php/apps/richdocuments/api/v1/document"
-
-//Url to access to templates Mobile Editor OCS API
-#define k_url_get_template_mobile_richdocuments @"ocs/v2.php/apps/richdocuments/api/v1/templates/"
-
-// Url to create a new richdocuments from a Template
-#define k_url_create_new_mobile_richdocuments @"ocs/v2.php/apps/richdocuments/api/v1/templates/new"
-
-//Url to insert files directly from your Nextcloud to a richdocuments
-#define k_url_insert_assets_to_richdocuments @"index.php/apps/richdocuments/assets"
-
-//Url for fulltextsearch
-#define k_url_fulltextsearch @"index.php/apps/fulltextsearch/v1/remote"
-
-//Url for remote wipe
-#define k_url_get_wipe @"index.php/core/wipe"
-
-//Version of the server that have share API
-#define k_version_support_shared [NSArray arrayWithObjects: @"5", @"0", @"27", nil]
-
-//Version of the server that have sharee API
-#define k_version_support_sharee_api [NSArray arrayWithObjects: @"8", @"2", @"0", nil]
-
-//Version of the server that supports cookies
-#define k_version_support_cookies [NSArray arrayWithObjects: @"7", @"0", @"0", nil]
-
-//Version of the server that supports forbidden characters
-#define k_version_support_forbidden_characters [NSArray arrayWithObjects: @"8", @"1", @"0", nil]
-
-//Version of the server that supports Capabilities
-#define k_version_support_capabilities [NSArray arrayWithObjects: @"8", @"2", @"0", nil]
-
-//Version of the server that supports enable/disabled share privilege option for federated shares
-#define k_version_support_share_option_fed_share [NSArray arrayWithObjects: @"9", @"1", @"0", nil]
-
-//Name of the session using for upload files with NSURLSession
-#define k_session_name @"com.owncloud.upload.session"
-
-//Name of the download session using for download files with NSURLSession
-#define k_download_session_name @"com.owncloud.download.session"
-
-//Name of the download session using for download files with NSURLSession in ownCloudExtApp
-#define k_download_session_name_ext_app @"com.owncloud.download.session.extApp.extension"
-
-//Name of the download session using for download files with NSURLSession
-#define k_download_folder_session_name @"com.owncloud.download.folder.session"
-
-//Name of the download session using for download files with NSURLSession
-#define k_network_operation_session_name @"com.owncloud.network.operation.session"
-
-//Name of the container to configure NSURLSessions
-#define k_shared_container_identifier @"group.com.owncloud.iOSmobileapp";
-
-// Quota return value
-#define k_quota_space_not_computed -1
-#define k_quota_space_unknown -2
-#define k_quota_space_unlimited -3
-
-
-
diff --git a/Libraries external/OCCommunicationLib/OCNotifications.h b/Libraries external/OCCommunicationLib/OCNotifications.h
deleted file mode 100644
index fc5bbef92..000000000
--- a/Libraries external/OCCommunicationLib/OCNotifications.h
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// OCNotifications.h
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 23/01/17.
-// Copyright © 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OCNotifications : NSObject
-
-@property NSInteger idNotification;
-@property (nonatomic, strong) NSString *application;
-@property (nonatomic, strong) NSString *user;
-@property (nonatomic, strong) NSDate *date;
-@property (nonatomic, strong) NSString *typeObject;
-@property (nonatomic, strong) NSString *idObject;
-@property (nonatomic, strong) NSString *subject;
-@property (nonatomic, strong) NSString *subjectRich;
-@property (nonatomic, strong) NSDictionary *subjectRichParameters;
-@property (nonatomic, strong) NSString *message;
-@property (nonatomic, strong) NSString *messageRich;
-@property (nonatomic, strong) NSDictionary *messageRichParameters;
-@property (nonatomic, strong) NSString *link;
-@property (nonatomic, strong) NSString *icon;
-@property (nonatomic, strong) NSArray *actions;
-
-@end
-
diff --git a/Libraries external/OCCommunicationLib/OCNotifications.m b/Libraries external/OCCommunicationLib/OCNotifications.m
deleted file mode 100644
index 0d4ecebaf..000000000
--- a/Libraries external/OCCommunicationLib/OCNotifications.m
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// OCNotifications.m
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 23/01/17.
-// Copyright © 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-
-#import "OCNotifications.h"
-
-@implementation OCNotifications
-
-- (id)init {
-
- self = [super init];
-
- if (self) {
-
- self.idNotification = 0;
- self.application = @"";
- self.user = @"";
- self.date = [NSDate date];
- self.typeObject = @"";
- self.idObject = @"";
- self.subject = @"";
- self.subjectRich = @"";
- self.subjectRichParameters = [NSDictionary new];
- self.message = @"";
- self.messageRich = @"";
- self.messageRichParameters = [NSDictionary new];
- self.link = @"";
- self.icon = @"";
- self.actions = [NSArray new];
- }
-
- return self;
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCNotificationsAction.h b/Libraries external/OCCommunicationLib/OCNotificationsAction.h
deleted file mode 100644
index 7c9d0d8e8..000000000
--- a/Libraries external/OCCommunicationLib/OCNotificationsAction.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// OCNotificationsAction.h
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 23/01/17.
-// Copyright © 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OCNotificationsAction : NSObject
-
-@property (nonatomic, strong) NSString *label;
-@property (nonatomic, strong) NSString *link;
-@property BOOL primary;
-@property (nonatomic, strong) NSString *type;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCNotificationsAction.m b/Libraries external/OCCommunicationLib/OCNotificationsAction.m
deleted file mode 100644
index 5829d28c1..000000000
--- a/Libraries external/OCCommunicationLib/OCNotificationsAction.m
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// OCNotificationsAction.m
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 23/01/17.
-// Copyright © 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "OCNotificationsAction.h"
-
-@implementation OCNotificationsAction
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCRichObjectStrings.h b/Libraries external/OCCommunicationLib/OCRichObjectStrings.h
deleted file mode 100644
index b63a193c6..000000000
--- a/Libraries external/OCCommunicationLib/OCRichObjectStrings.h
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// OCRichObjectStrings.h
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 23/01/17.
-// Copyright © 2017 ownCloud. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OCRichObjectStrings : NSObject
-
-@property (nonatomic, strong) NSString *idObject;
-@property (nonatomic, strong) NSString *type;
-@property (nonatomic, strong) NSString *name;
-@property (nonatomic, strong) NSString *path;
-@property (nonatomic, strong) NSString *link;
-@property (nonatomic, strong) NSString *server;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCRichObjectStrings.m b/Libraries external/OCCommunicationLib/OCRichObjectStrings.m
deleted file mode 100644
index fc1197558..000000000
--- a/Libraries external/OCCommunicationLib/OCRichObjectStrings.m
+++ /dev/null
@@ -1,13 +0,0 @@
-//
-// OCRichObjectStrings.m
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 23/01/17.
-// Copyright © 2017 ownCloud. All rights reserved.
-//
-
-#import "OCRichObjectStrings.h"
-
-@implementation OCRichObjectStrings
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCShareUser.h b/Libraries external/OCCommunicationLib/OCShareUser.h
deleted file mode 100755
index 1278e763b..000000000
--- a/Libraries external/OCCommunicationLib/OCShareUser.h
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// OCShareUser.h
-// ownCloud iOS library
-//
-// Created by Gonzalo Gonzalez on 28/9/15.
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-#import <Foundation/Foundation.h>
-#import "OCSharedDto.h"
-
-@interface OCShareUser : NSObject
-
-@property (nonatomic, strong) NSString *name;
-@property (nonatomic, strong) NSString *displayName;
-@property (nonatomic, strong) NSString *server;
-@property BOOL isDisplayNameDuplicated;
-@property NSInteger shareeType;
-
-@property (nonatomic, strong) OCSharedDto * sharedDto;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCShareUser.m b/Libraries external/OCCommunicationLib/OCShareUser.m
deleted file mode 100755
index fa27e0b3d..000000000
--- a/Libraries external/OCCommunicationLib/OCShareUser.m
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// OCShareUser.m
-// ownCloud iOS library
-//
-// Created by Gonzalo Gonzalez on 28/9/15.
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-#import "OCShareUser.h"
-
-@implementation OCShareUser
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCSharedDto.h b/Libraries external/OCCommunicationLib/OCSharedDto.h
deleted file mode 100755
index 85db81333..000000000
--- a/Libraries external/OCCommunicationLib/OCSharedDto.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// OCSharedDto.h
-// OCCommunicationLib
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OCSharedDto : NSObject
-
-typedef enum {
- shareTypeUser = 0,
- shareTypeGroup = 1,
- shareTypeLink = 3,
- shareTypeEmail = 4,
- shareTypeContact = 5,
- shareTypeRemote = 6
-} enumShareType;
-
-@property NSInteger idRemoteShared;
-@property BOOL isDirectory;
-@property NSInteger itemSource;
-@property NSInteger parent;
-@property NSInteger shareType;
-@property (nonatomic, copy) NSString *shareWith;
-@property NSInteger fileSource;
-@property (nonatomic, copy) NSString *path;
-@property NSInteger permissions;
-@property long sharedDate;
-@property long expirationDate;
-@property (nonatomic, copy) NSString *token;
-@property NSInteger storage;
-@property NSInteger mailSend;
-@property (nonatomic, copy) NSString *url;
-@property (nonatomic, copy) NSString *uidOwner;
-@property (nonatomic, copy) NSString *shareWithDisplayName;
-@property (nonatomic, copy) NSString *displayNameOwner;
-@property (nonatomic, copy) NSString *uidFileOwner;
-@property (nonatomic, copy) NSString *fileTarget;
-@property BOOL hideDownload;
-@property (nonatomic, copy) NSString *note;
-@property (nonatomic, copy) NSString *label;
-@property (nonatomic, copy) NSString *displayNameFileOwner;
-@property (nonatomic, copy) NSString *mimeType;
-@property (nonatomic, copy) NSString *storageID;
-@property (nonatomic, copy) NSString *fileParent;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCSharedDto.m b/Libraries external/OCCommunicationLib/OCSharedDto.m
deleted file mode 100755
index e61640947..000000000
--- a/Libraries external/OCCommunicationLib/OCSharedDto.m
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// OCSharedDto.m
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#import "OCSharedDto.h"
-
-@implementation OCSharedDto
-
-- (id)init {
-
- self = [super init];
-
- if (self) {
-
- self.shareWith = @"";
- self.path = @"";
- self.token = @"";
- self.url = @"";
- self.uidOwner = @"";
- self.shareWithDisplayName = @"";
- self.displayNameOwner = @"";
- self.uidFileOwner = @"";
- self.fileTarget = @"";
- self.note = @"";
- self.label = @"";
- self.displayNameFileOwner = @"";
- self.mimeType = @"";
- self.storageID = @"";
- self.fileParent = @"";
- }
-
- return self;
-}
-@end
diff --git a/Libraries external/OCCommunicationLib/OCUserProfile.h b/Libraries external/OCCommunicationLib/OCUserProfile.h
deleted file mode 100644
index 97542628a..000000000
--- a/Libraries external/OCCommunicationLib/OCUserProfile.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// OCUserProfile.h
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 16/02/17.
-// Copyright © 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OCUserProfile : NSObject
-
-@property (nonatomic, strong) NSString *id;
-@property BOOL enabled;
-
-@property (nonatomic, strong) NSString *address;
-@property (nonatomic, strong) NSString *businessSize;
-@property (nonatomic, strong) NSString *businessType;
-@property (nonatomic, strong) NSString *city;
-@property (nonatomic, strong) NSString *company;
-@property (nonatomic, strong) NSString *country;
-@property (nonatomic, strong) NSString *displayName;
-@property (nonatomic, strong) NSString *email;
-@property (nonatomic, strong) NSString *phone;
-@property (nonatomic, strong) NSString *role;
-@property (nonatomic, strong) NSString *twitter;
-@property (nonatomic, strong) NSString *webpage;
-@property (nonatomic, strong) NSString *zip;
-
-@property double quota;
-@property double quotaFree;
-@property double quotaRelative;
-@property double quotaTotal;
-@property double quotaUsed;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCUserProfile.m b/Libraries external/OCCommunicationLib/OCUserProfile.m
deleted file mode 100644
index 34032e9d2..000000000
--- a/Libraries external/OCCommunicationLib/OCUserProfile.m
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// OCUserProfile.m
-// ownCloud iOS library
-//
-// Created by Marino Faggiana on 16/02/17.
-// Copyright © 2017 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "OCUserProfile.h"
-
-@implementation OCUserProfile
-
-- (id)init
-{
- self = [super init];
-
- self.id = @"";
-
- self.address = @"";
- self.businessSize = @"";
- self.businessType = @"";
- self.city = @"";
- self.company = @"";
- self.country = @"";
- self.displayName = @"";
- self.email = @"";
- self.phone = @"";
- self.role = @"";
- self.twitter = @"";
- self.webpage = @"";
- self.zip = @"";
-
- return self;
-}
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+ISO8601.h b/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+ISO8601.h
deleted file mode 100755
index 904f2a72d..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+ISO8601.h
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// NSDate+ISO8601.h
-// OCWebDAVClient.h
-//
-// This class is based in https://github.com/zwaldowski/DZWebDAVClient. Copyright (c) 2012 Zachary Waldowski, Troy Brant, Marcus Rohrmoser, and Sam Soffes.
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-
-#import <Foundation/Foundation.h>
-
-/**
- Provides extensions to `NSDate` for representing ISO8601-formatted strings.
- */
-@interface NSDate (ISO8601)
-
-/**
- Returns a new date represented by an ISO8601 string.
-
- @param iso8601String An ISO8601 string
-
- @return Date represented by the ISO8601 string
-
- @bug [Issue #56](https://github.com/samsoffes/sstoolkit/issues/56): Currently this method doesn't work with
- strings that include a timezone as anything other than "Z" like this one
- "2011-02-01T10:57:55-08:00".
- */
-+ (NSDate *)dateFromISO8601String:(NSString *)iso8601String;
-
-/**
- Returns a string representation of the receiver in ISO8601 format.
-
- @return A string representation of the receiver in ISO8601 format.
- */
-- (NSString *)ISO8601String;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+ISO8601.m b/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+ISO8601.m
deleted file mode 100755
index 8c7b75e25..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+ISO8601.m
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// NSDate+ISO8601.m
-// OCWebDAVClient
-//
-// This class is based in https://github.com/zwaldowski/DZWebDAVClient. Copyright (c) 2012 Zachary Waldowski, Troy Brant, Marcus Rohrmoser, and Sam Soffes.
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-#import "NSDate+ISO8601.h"
-#include <time.h>
-
-@implementation NSDate (ISO8601)
-
-+ (NSDate *)dateFromISO8601String:(NSString *)value {
- if (!value.length)
- return nil;
-
- struct tm tm;
- strptime(value.UTF8String, "%Y-%m-%dT%H:%M:%S%z", &tm);
- time_t t = mktime(&tm);
-
- return [NSDate dateWithTimeIntervalSince1970:t + [[NSTimeZone localTimeZone] secondsFromGMT]];
-}
-
-
-- (NSString *)ISO8601String {
- struct tm *timeinfo;
- char buffer[80];
-
- time_t rawtime = (time_t)[self timeIntervalSince1970];
- timeinfo = gmtime(&rawtime);
-
- strftime(buffer, 80, "%Y-%m-%dT%H:%M:%SZ", timeinfo);
-
- return [NSString stringWithCString:buffer encoding:NSUTF8StringEncoding];
-}
-
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+RFC1123.h b/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+RFC1123.h
deleted file mode 100755
index 417a40680..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+RFC1123.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// NSDate+RFC1123.h
-// OCWebDAVClient.h
-//
-// This class is based in https://github.com/zwaldowski/DZWebDAVClient. Copyright (c) 2012 Zachary Waldowski, Troy Brant, Marcus Rohrmoser, and Sam Soffes.
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-#import <Foundation/Foundation.h>
-
-/**
- * Provides extensions to `NSDate` for representing RFC1123-formatted strings.
- *
- * Based on the [W3 specification](http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1) and ["NSDateFormatter & HTTP Header"](http://blog.mro.name/2009/08/nsdateformatter-http-header/).
- */
-@interface NSDate (RFC1123)
-
-/**
- Convert a RFC1123 'Full-Date' string (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1) into NSDate.
- @param value something like either @"Fri, 14 Aug 2009 14:45:31 GMT" or @"Sunday, 06-Nov-94 08:49:37 GMT" or @"Sun Nov 6 08:49:37 1994"
- @return nil if not parseable.
- */
-+ (NSDate *)dateFromRFC1123String:(NSString *)value;
-
-/**
- Convert NSDate into a RFC1123 'Full-Date' string (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1).
- @return something like @"Fri, 14 Aug 2009 14:45:31 GMT"
- */
-- (NSString *)RFC1123String;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+RFC1123.m b/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+RFC1123.m
deleted file mode 100755
index 0d863da62..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/NSDate+RFC1123.m
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-// NSDate+RFC1123.h
-// OCWebDAVClient
-//
-// This class is based in https://github.com/zwaldowski/DZWebDAVClient. Copyright (c) 2012 Zachary Waldowski, Troy Brant, Marcus Rohrmoser, and Sam Soffes.
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-#import "NSDate+RFC1123.h"
-
-static NSDateFormatter *RFC1123Formatter(void) {
- static NSDateFormatter *formatter = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- formatter = [NSDateFormatter new];
- formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
- formatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
- formatter.dateFormat = @"EEE',' dd MMM yyyy HH':'mm':'ss z";
- });
- return formatter;
-}
-
-static NSDateFormatter *RFC850Formatter(void) {
- static NSDateFormatter *formatter = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- formatter = [NSDateFormatter new];
- formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
- formatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
- formatter.dateFormat = @"EEEE',' dd'-'MMM'-'yy HH':'mm':'ss z";
- });
- return formatter;
-}
-
-static NSDateFormatter *ASCTimeFormatter(void) {
- static NSDateFormatter *formatter = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- formatter = [NSDateFormatter new];
- formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
- formatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
- formatter.dateFormat = @"EEE MMM d HH':'mm':'ss yyyy";
- });
- return formatter;
-}
-
-@implementation NSDate (RFC1123)
-
-+ (NSDate *)dateFromRFC1123String:(NSString *)value {
- if (!value.length)
- return nil;
-
- return [RFC1123Formatter() dateFromString: value] ?: [RFC850Formatter() dateFromString: value] ?: [ASCTimeFormatter() dateFromString: value];
-}
-
-- (NSString *)RFC1123String {
- return [RFC1123Formatter() stringFromDate: self];
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/OCHTTPRequestOperation.h b/Libraries external/OCCommunicationLib/OCWebDavClient/OCHTTPRequestOperation.h
deleted file mode 100755
index 986f14087..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/OCHTTPRequestOperation.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// OCHTTPRequestOperation.h
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-@interface OCHTTPRequestOperation : NSURLSessionDataTask
-
-@property (nonatomic, strong) NSString *localSource;
-
-
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/OCHTTPRequestOperation.m b/Libraries external/OCCommunicationLib/OCWebDavClient/OCHTTPRequestOperation.m
deleted file mode 100755
index 5287739f6..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/OCHTTPRequestOperation.m
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// OCHTTPRequestOperation.m
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-#import "OCHTTPRequestOperation.h"
-
-@interface OCHTTPRequestOperation ()
-@property (readwrite, nonatomic, strong) NSMutableURLRequest *request;
-@end
-
-
-@implementation OCHTTPRequestOperation
-
-@synthesize request;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h b/Libraries external/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h
deleted file mode 100755
index b2e52f07b..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h
+++ /dev/null
@@ -1,713 +0,0 @@
-//
-// OCWebDAVClient.h
-// OCWebDAVClient
-//
-// This class is based in https://github.com/zwaldowski/DZWebDAVClient. Copyright (c) 2012 Zachary Waldowski, Troy Brant, Marcus Rohrmoser, and Sam Soffes.
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-// Add : getNotificationServer & setNotificationServer
-// Add : getUserProfileServer
-// Add : Support for Favorite
-// Add : getActivityServer
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-// Copyright (c) 2017 Marino Faggiana. All rights reserved.
-//
-
-
-#import "OCHTTPRequestOperation.h"
-@import AFNetworking;
-
-@class OCCommunication;
-@class OCChunkDto;
-
-/** The key for a uniform (MIME) type identifier returned from the property request methods. */
-extern NSString * _Nullable OCWebDAVContentTypeKey;
-
-/** The key for a unique entity identifier returned from the property request methods. */
-extern NSString * _Nullable OCWebDAVETagKey;
-
-/** The key for a content identifier tag returned from the property request methods. This is only supported on some servers, and usually defines whether the contents of a collection (folder) have changed. */
-extern NSString * _Nullable OCWebDAVCTagKey;
-
-/** The key for the creation date of an entity. */
-extern NSString * _Nullable OCWebDAVCreationDateKey;
-
-/** The key for last modification date of an entity. */
-extern NSString * _Nullable OCWebDAVModificationDateKey;
-
-@interface OCWebDAVClient : NSObject
-
-@property (readwrite, nonatomic, strong) NSMutableDictionary * _Nullable defaultHeaders;
-//On redirections AFNetworking lose the request method on iOS6 and set a GET, we use this as workarround
-@property (nonatomic, strong) NSString * _Nullable requestMethod;
-//We use this variable to return the url of a redirected server to detect if we receive any sesion expired on SSO server
-@property (nonatomic, strong) NSString * _Nullable redirectedServer;
-//We use this variable to get the Cookies from the storage provider
-@property (nonatomic, strong) NSString * _Nullable originalUrlServer;
-
-@property (nonatomic, strong) NSString * _Nullable postStringForShare;
-// E2EE Metadata
-@property (nonatomic, strong) NSString * _Nullable postStringMetadata;
-// E2EE privateKey, publicKey
-@property (nonatomic, strong) NSString * _Nullable postStringKey;
-
-/**
- Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header.
-
- @param username The HTTP basic auth username
- @param password The HTTP basic auth password
- */
-- (void)setAuthorizationHeaderWithUsername:(NSString * _Nonnull)username
- password:(NSString * _Nonnull)password;
-
-/**
- Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header.
-
- @param cookieString The HTTP token to login on SSO Servers
- */
-- (void)setAuthorizationHeaderWithCookie:(NSString * _Nonnull) cookieString;
-
-/**
- Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a token-based authentication value, such as an OAuth access token. This overwrites any existing value for this header.
-
- @param token The authentication token
- */
-- (void)setAuthorizationHeaderWithToken:(NSString * _Nonnull)token;
-
-
-/**
- Sets the "User-Agent" HTTP header
-
- @param userAgent -> String that indentifies the client app. Ex: "iOS-ownCloud"
- */
-- (void)setUserAgent:(NSString * _Nonnull)userAgent;
-
-
-/**
- Add Header
-*/
-- (void)setDefaultHeader:(NSString * _Nonnull)header value:(NSString *_Nullable)value;
-
-/**
- Enqueues an operation to move the object at a path to another path using a `MOVE` request.
-
- @param source The path to move.
- @param destination The path to move the item to.
- @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- @param success A block callback, to be fired upon successful completion, with no arguments.
- @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and the network error that occurred.
- */
-- (void)movePath:(NSString * _Nonnull)source toPath:(NSString * _Nonnull)destination
- onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-/**
- Enqueues an operation to delete the object at a path using a `DELETE` request.
-
- @param path The path for which to create a directory.
- @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- @param success A block callback, to be fired upon successful completion, with no arguments.
- @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and the network error that occurred.
- */
-- (void)deletePath:(NSString * _Nonnull)path
- onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-
-
-/**
- Enqueues a request to list the properties of a single entity using a `PROPFIND` request for the specified path.
-
- @param path The path for which to list the properties.
- @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a dictionary with the properties of the entity.
- @param failure A block callback, to be fired upon the failure of either the request or the parsing of the request's data, with two arguments: the request operation and the network or parsing error that occurred.
-
- @see listPath:success:failure:
- @see recursiveListPath:success:failure:
- */
-- (void)propertiesOfPath:(NSString * _Nonnull)path
- onCommunication: (OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-/**
- Enqueues a request to list the contents of a single collection and
- the properties of each object, including the properties of the
- collection itself, using a `PROPFIND` request.
-
- @param path The directory for which to list the contents.
- @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a dictionary with the properties of the directory and its contents.
- @param failure A block callback, to be fired upon the failure of either the request or the parsing of the request's data, with two arguments: the request operation and the network or parsing error that occurred.
-
- @see propertiesOfPath:success:failure:
- @see recursiveListPath:success:failure:
- */
-- (void)listPath:(NSString * _Nonnull)path depth:(NSString * _Nonnull)depth
- onCommunication: (OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nullable responseObject))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nullable responseObject, NSError * _Nonnull error))failure;
-
-
-/**
- Enqueues a request to list the contents of a single collection and
- the properties of each object, including the properties of the
- collection itself, using a `PROPFIND` request.
-
- @param path The directory for which to list the contents.
- @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- @param token User Session token
- @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a dictionary with the properties of the directory and its contents.
- @param failure A block callback, to be fired upon the failure of either the request or the parsing of the request's data, with two arguments: the request operation and the network or parsing error that occurred.
-
- @see propertiesOfPath:success:failure:
- @see recursiveListPath:success:failure:
- */
-- (void)listPath:(NSString * _Nonnull)path depth:(NSString * _Nonnull)depth
- onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication withUserSessionToken:(NSString * _Nonnull)token
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull, NSString * _Nonnull token))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull, NSString * _Nonnull token))failure;
-
-/**
-
-*/
-
-NS_ASSUME_NONNULL_BEGIN
-
-- (void)search:(NSString * _Nonnull)path folder:(NSString * _Nonnull)folder fileName:(NSString * _Nonnull)fileName depth:(NSString * _Nonnull)depth lteDateLastModified:(NSString *)lteDateLastModified gteDateLastModified:(NSString *)gteDateLastModified contentType:(NSArray * _Nonnull)contentType user:(NSString * _Nonnull)user userID:(NSString * _Nonnull)userID onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication withUserSessionToken:(NSString * _Nonnull)token success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull, NSString * _Nonnull token))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull, NSString * _Nonnull token))failure;
-
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName dateLastModified:(NSString *)dateLastModified numberOfItem:(NSInteger)numberOfItem userID:(NSString *)userID onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *, NSString *token))failure;
-
-NS_ASSUME_NONNULL_END
-
-/**
-
- */
-
-- (void)settingFavorite:(NSString * _Nonnull)path favorite:(BOOL)favorite onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication withUserSessionToken:(NSString * _Nonnull)token success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull, NSString * _Nonnull token))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull, NSString * _Nonnull token))failure;
-
-/**
-
- */
-
-- (void)listingFavorites:(NSString * _Nonnull)path folder:(NSString * _Nonnull)folder user:(NSString * _Nonnull)user userID:(NSString * _Nonnull)userID onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication withUserSessionToken:(NSString * _Nonnull)token success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull, NSString * _Nonnull token))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull, NSString * _Nonnull token))failure;
-
-
-
-/**
- Creates an `NSURLSessionDownloadTask` with the specified request for a local file.
-
- @param remoteSource is a string with the path of the file in the server
- @param localDestination is a string with the local device path for store the file
- @param defaultPriority is a bool with a flag to indicate if the download must be download inmediately of not.
- @param progress A progress object monitoring the current upload progress.
- @param success A block callback, to be fired upon successful completion, with NSURLResponse and string of URL of the filePath
- @param failure A block callback, to be fired upon the failure of either the request or the parsing of the request's data, with two arguments: the request operation and the network or parsing error that occurred.
- *
- @warning NSURLSession and NSRULSessionUploadTask only can be supported in iOS 7.
- */
-- (NSURLSessionDownloadTask * _Nonnull)downloadWithSessionPath:(NSString * _Nonnull)remoteSource toPath:(NSString * _Nonnull)localDestination defaultPriority:(BOOL)defaultPriority onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication progress:(void(^ _Nonnull)(NSProgress * _Nonnull progress))downloadProgress success:(void(^ _Nonnull)(NSURLResponse * _Nonnull response, NSURL * _Nonnull filePath))success failure:(void(^ _Nonnull)(NSURLResponse * _Nonnull response, NSError * _Nonnull error))failure;
-
-/**
- Enqueues a request to check the server to know the kind of authentication needed.
-
- @param path The path of the server.
- @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- @param success A block callback, to be fired upon successful completion, with no arguments.
- @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and the network error that occurred.
- */
-- (void)checkServer:(NSString * _Nonnull)path onCommunication:
-(OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-/**
- Enqueues a request to creates a directory using a `MKCOL` request for the specified path.
-
- @param path The path for which to create a directory.
- @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- @param success A block callback, to be fired upon successful completion, with no arguments.
- @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and the network error that occurred.
- */
-- (void)makeCollection:(NSString * _Nonnull)path
- onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-/**
- Creates an `NSURLSessionUploadTask` with the specified request for a local file.
-
- @param localSource is a string with the path of the file to upload
- @param remoteDestination A remote path, relative to the HTTP client's base URL, to write the data to.
- @param progress A progress object monitoring the current upload progress.
- @param success A block callback, to be fired upon successful completion, with NSURLResponse and string of redirected server.
- @param failure A block callback, to be fired upon the failure of either the request or the parsing of the request's data, with two arguments: the request operation and the network or parsing error that occurred.
- *
- @warning NSURLSession and NSRULSessionUploadTask only can be supported in iOS 7.
- */
-- (NSURLSessionUploadTask * _Nonnull)putWithSessionLocalPath:(NSString * _Nonnull)localSource atRemotePath:(NSString * _Nonnull)remoteDestination onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication progress:(void(^ _Nonnull)(NSProgress * _Nonnull progress))uploadProgress success:(void(^ _Nonnull)(NSURLResponse * _Nonnull, NSString * _Nonnull))success failure:(void(^ _Nonnull)(NSURLResponse * _Nonnull, id _Nonnull, NSError * _Nonnull))failure failureBeforeRequest:(void(^ _Nonnull)(NSError * _Nonnull)) failureBeforeRequest;
-
-///-----------------------------------
-/// @name requestForUserNameByCookie
-///-----------------------------------
-
-/**
- * Method to obtain the User name by the cookie of the session
- *
- * @param NSString the cookie of the session
- *
- */
-- (void) requestUserNameOfServer:(NSString * _Nonnull) path byCookie:(NSString * _Nonnull) cookieString onCommunication:
-(OCCommunication * _Nonnull)sharedOCCommunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-
-///-----------------------------------
-/// @name Get status of the server
-///-----------------------------------
-
-/**
- * Method to get the json of the status.php common in the ownCloud servers
- *
- * @param serverPath -> url of the server
- * @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- * @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a data with the json file.
- * @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and error.
- *
- */
-- (void) getStatusOfTheServer:(NSString * _Nonnull)serverPath onCommunication:
-(OCCommunication * _Nonnull)sharedOCCommunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nonnull responseObject))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nullable responseObject, NSError * _Nonnull error))failure;
-
-///-----------------------------------
-/// @name Get All the shared files and folders of a server
-///-----------------------------------
-
-/**
- Method to get all the shared files fo an account by the server path and api
-
- @param serverPath -> The url of the server including the path of the Share API.
- @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a dictionary with the properties of the directory and its contents.
- @param failure A block callback, to be fired upon the failure of either the request or the parsing of the request's data, with two arguments: the request operation and the network or parsing error that occurred.
- */
-- (void)listSharedByServer:(NSString * _Nonnull)serverPath
- onCommunication: (OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nonnull responseObject))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nullable responseObject, NSError * _Nonnull error))failure;
-
-
-///-----------------------------------
-/// @name Get All the shared files and folders of concrete folder
-///-----------------------------------
-
-/**
- Method to get all the shared files fo an account by the server path and api
-
- @param serverPath -> The url of the server including the path of the Share API.
- @param path -> The path of the folder that we want to know the shared
- @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a dictionary with the properties of the directory and its contents.
- @param failure A block callback, to be fired upon the failure of either the request or the parsing of the request's data, with two arguments: the request operation and the network or parsing error that occurred.
- */
-- (void)listSharedByServer:(NSString * _Nonnull)serverPath andPath:(NSString * _Nonnull) path
- onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-///-----------------------------------
-/// @name shareFileOrFolderByServer
-///-----------------------------------
-
-/**
- * Method to share a file or folder with password
- *
- * @param serverPath -> NSString: Server path where we want to share a file or folder. Ex: http://10.40.40.20/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares
- * @param filePath -> NSString: Path of the server where is the file. Ex: /File.pdf
- * @param password -> NSString: Password
- * @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- * @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a data with the json file.
- * @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and error.
- *
- */
-- (void)shareByLinkFileOrFolderByServer:(NSString * _Nonnull)serverPath andPath:(NSString * _Nonnull) filePath andPassword:(NSString * _Nonnull)password andPermission:(NSInteger)permission andHideDownload:(BOOL)hideDownload
- onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-///-----------------------------------
-/// @name shareFileOrFolderByServer
-///-----------------------------------
-
-/**
- * Method to share a file or folder
- *
- * @param serverPath -> NSString: Server path where we want to share a file or folder. Ex: http://10.40.40.20/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares
- * @param filePath -> NSString: Path of the server where is the file. Ex: /File.pdf
- * @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- * @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a data with the json file.
- * @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and error.
- *
- */
-- (void)shareByLinkFileOrFolderByServer:(NSString * _Nonnull)serverPath andPath:(NSString * _Nonnull) filePath
- onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-
-///-----------------------------------
-/// @name shareWith
-///-----------------------------------
-
-/**
- * Method to share a file or folder with user and group
- *
- * @param userOrGroup -> NSString: user or group (You can get the shares id in the calls searchUsersAndGroupsWith....)
- * @param shareeType -> NSInteger: to set the type of sharee (user/group/federated)
- * @param serverPath -> NSString: Server path where we want to share a file or folder. Ex: http://10.40.40.20/owncloud/ocs/v2.php/apps/files_sharing/api/v1/sharees?format=json
- * @param filePath -> NSString: Path of the server where is the file. Ex: /File.pdf
- * @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- * @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a data with the json file.
- * @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and error.
- *
- */
-- (void)shareWith:(NSString * _Nonnull)userOrGroup shareeType:(NSInteger)shareeType inServer:(NSString * _Nonnull) serverPath andPath:(NSString * _Nonnull) filePath andPermissions:(NSInteger) permissions onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-///-----------------------------------
-/// @name unShareFileOrFolderByServer
-///-----------------------------------
-
-/**
- * Method to unshare a file or folder
- *
- * @param serverPath -> NSString: Server path with the id of the file or folder that we want to unshare Ex: http://10.40.40.20/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares/44
- * @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- * @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a data with the json file.
- * @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and error.
- */
-- (void)unShareFileOrFolderByServer:(NSString * _Nonnull)serverPath
- onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-///-----------------------------------
-/// @name isShareFileOrFolderByServer
-///-----------------------------------
-
-/**
- * Method to know if a share item still shared
- *
- * @param serverPath -> NSString: Server path with the id of the file or folder that we want know if is shared Ex: http://10.40.40.20/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares/44
- * @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- * @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a data with the json file.
- * @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and error.
- */
-- (void)isShareFileOrFolderByServer:(NSString * _Nonnull)serverPath
- onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-///-----------------------------------
-/// @name updateShareItem
-///-----------------------------------
-
-/**
- * Method to update a share link
- *
- * @param shareId -> NSInterger: Share id (You can get the shares id in the calls listSharedByServer....)
- * @param serverPath -> NSString: Server path with the id of the file or folder that we want know if is shared Ex: http://10.40.40.20/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares/44
- * @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- * @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a data with the json file.
- * @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and error.
- */
-- (void) updateShareItem:(NSInteger)shareId ofServerPath:(NSString * _Nonnull)serverPath withPasswordProtect:(NSString * _Nonnull)password andNote:(NSString * _Nonnull)note andExpirationTime:(NSString * _Nonnull)expirationTime andPermissions:(NSInteger)permissions andHideDownload:(BOOL)hideDownload
- onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication
- success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nullable responseObject, NSError * _Nonnull error))failure;
-
-///-----------------------------------
-/// @name searchUsersAndGroupsWith
-///-----------------------------------
-
-/**
- * Method to search users or groups
- *
- * @param searchString -> NSString: Search string
- * @param serverPath -> NSString: Server path with the id of the file or folder that we want know if is shared Ex: http://10.40.40.20/owncloud/ocs/v2.php/apps/files_sharing/api/v1/sharees?format=json
- * @param page -> NSInteger: Number of page of the results (pagination support)
- * @param resultsPerPage -> NSInteger: Number of results per page (pagination support)
- * @param sharedOCCommunication Singleton of communication to add the operation on the queue.
- * @param success A block callback, to be fired upon successful completion, with two arguments: the request operation and a data with the json file.
- * @param failure A block callback, to be fired upon the failure of the request, with two arguments: the request operation and error.
- */
-- (void) searchUsersAndGroupsWith:(NSString * _Nonnull)searchString forPage:(NSInteger)page with:(NSInteger)resultsPerPage ofServer:(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;
-
-///-----------------------------------
-/// @name Get the server capabilities
-///-----------------------------------
-
-/**
- * Method read the capabilities of the server
- *
- * @param serverPath -> NSString server
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return capabilities -> OCCapabilities
- *
- */
-- (void) getCapabilitiesOfServer:(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;
-
-
-#pragma mark - Remote thumbnails
-
-///-----------------------------------
-/// @name Get the thumbnail for a file
-///-----------------------------------
-
-/**
- * Method to get the remote thumbnail for a file
- *
- * @param serverPath -> NSString server
- * @param filePath -> NSString file path
- * @param fileWidth -> NSInteger with the width size
- * @param fileHeight -> NSInteger with the height size
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return nsData -> thumbnail of the file with the size requested
- *
- */
-- (OCHTTPRequestOperation * _Nonnull) getRemoteThumbnailByServer:(NSString * _Nonnull)serverPath ofFilePath:(NSString * _Nonnull)filePath withWidth:(NSInteger)fileWidth andHeight:(NSInteger)fileHeight 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;
-
-NS_ASSUME_NONNULL_BEGIN
-
-- (OCHTTPRequestOperation *) getRemotePreviewByServer:(NSString * _Nonnull)serverPath ofFilePath:(NSString *_Nonnull)filePath withWidth:(NSInteger)fileWidth andHeight:(NSInteger)fileHeight andA:(NSInteger)a andMode:(NSString * _Nonnull)mode path:(NSString * _Nonnull)path onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure;
-
-- (OCHTTPRequestOperation *) getRemotePreviewTrashByServer:(NSString * _Nonnull)serverPath ofFileId:(NSString *_Nonnull)fileId size:(NSString *)size onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure;
-
-NS_ASSUME_NONNULL_END
-
-#pragma mark - Notification
-
-///-----------------------------------
-/// @name Get the server Notification
-///-----------------------------------
-
-/**
- * Method read the notification of the server
- *
- * @param serverPath -> NSString server
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return listOfNotifications -> OCNotification
- *
- */
-
-- (void) getNotificationServer:(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;
-
-///-----------------------------------
-/// @name set server Notification
-///-----------------------------------
-
-/**
- * Method read the notification of the server
- *
- * @param serverPath -> NSString server
- * @param type -> NSString "POST" "DELETE"
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- */
-
-- (void)setNotificationServer:(NSString * _Nonnull)serverPath type:(NSString * _Nonnull)type onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-///-----------------------------------
-/// @name Subscribing at the Nextcloud server
-///-----------------------------------
-
-/**
- * Method read the notification of the server
- *
- * @param serverPath -> NSString server
- * @param type -> NSString "POST" "DELETE"
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- */
-
-- (void)subscribingNextcloudServerPush:(NSString * _Nonnull)serverPath pushTokenHash:(NSString * _Nonnull)pushTokenHash devicePublicKey:(NSString * _Nonnull)devicePublicKey proxyServerPath:(NSString * _Nonnull)proxyServerPath onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-- (void)unsubscribingNextcloudServerPush:(NSString * _Nonnull)serverPath onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-
-- (void)subscribingPushProxy:(NSString * _Nonnull)serverPath pushToken:(NSString * _Nonnull)pushToken deviceIdentifier:(NSString * _Nonnull)deviceIdentifier deviceIdentifierSignature:(NSString * _Nonnull)deviceIdentifierSignature publicKey:(NSString * _Nonnull)publicKey onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-- (void)unsubscribingPushProxy:(NSString * _Nonnull)serverPath deviceIdentifier:(NSString * _Nonnull)deviceIdentifier deviceIdentifierSignature:(NSString * _Nonnull)deviceIdentifierSignature publicKey:(NSString * _Nonnull)publicKey onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure;
-
-///-----------------------------------
-/// @name Get the server Notification
-///-----------------------------------
-
-/**
- * Method read the notification of the server
- *
- * @param serverPath -> NSString server
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return listOfActivity -> OCActivity
- *
- */
-
-- (void) getActivityServer:(NSString * _Nonnull)serverPath since:(NSInteger)since limit:(NSInteger)limit objectId:(NSString * _Nonnull)objectId objectType:(NSString * _Nonnull)objectType previews:(BOOL)previews link:(NSString * _Nonnull)link 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;
-
-///-----------------------------------
-/// @name Get the list of External sites
-///-----------------------------------
-
-/**
- * Method read the notification of the server
- *
- * @param serverPath -> NSString server
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return listOfExternalSites -> OCExternalSites
- *
- */
-
-- (void) getExternalSitesServer:(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;
-
-///-----------------------------------
-/// @name Get User Profile
-///-----------------------------------
-
-/**
- * Method read the notification of the server
- *
- * @param serverPath -> NSString server
- * @param sharedOCCommunication -> OCCommunication Singleton of communication to add the operation on the queue.
- *
- * @return userProfile -> OCUserProfile
- *
- */
-
-- (void) getUserProfileServer:(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-to-End Encryption
-///-----------------------------------
-
-- (void)getEndToEndPublicKeys:(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)getEndToEndPrivateKeyCipher:(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)getEndToEndServerPublicKey:(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)signEndToEndPublicKey:(NSString * _Nonnull)serverPath key:(NSString * _Nonnull)key 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)storeEndToEndPrivateKeyCipher:(NSString * _Nonnull)serverPath key:(NSString * _Nonnull)key 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)deleteEndToEndPublicKey:(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)deleteEndToEndPrivateKey:(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)markEndToEndFolderEncrypted:(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)deletemarkEndToEndFolderEncrypted:(NSString * _Nonnull)serverPath e2eToken:(NSString * _Nonnull)e2eToken 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)lockEndToEndFolderEncrypted:(NSString * _Nonnull)serverPath e2eToken:(NSString * _Nonnull)e2eToken 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)unlockEndToEndFolderEncrypted:(NSString * _Nonnull)serverPath e2eToken:(NSString * _Nonnull)e2eToken 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)getEndToEndMetadata:(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)storeEndToEndMetadata:(NSString * _Nonnull)serverPath metadata:(NSString * _Nonnull)metadata e2eToken:(NSString * _Nonnull)e2eToken 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)updateEndToEndMetadata:(NSString * _Nonnull)serverPath metadata:(NSString * _Nonnull)metadata e2eToken:(NSString * _Nonnull)e2eToken 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)deleteEndToEndMetadata:(NSString * _Nonnull)serverPath e2eToken:(NSString * _Nonnull)e2eToken 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;
-
-///-----------------------------------
-/// Manage Mobile Editor OCS API
-///-----------------------------------
-
-NS_ASSUME_NONNULL_BEGIN
-
-- (void)createLinkRichdocuments:(NSString *_Nonnull)serverPath fileId:(NSString * _Nonnull)fileId onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure;
-
-- (void)getTemplatesRichdocuments:(NSString *_Nonnull)serverPath onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure;
-
-- (void)createNewRichdocuments:(NSString *_Nonnull)serverPath path:(NSString *_Nonnull)path templateID:(NSString *_Nonnull)templateID onCommunication:(OCCommunication *_Nonnull)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure;
-
-- (void)createAssetRichdocuments:(NSString *_Nonnull)serverPath path:(NSString *_Nonnull)path onCommunication:(OCCommunication *_Nonnull)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure;
-
-#pragma mark - Fulltextsearch
-
-- (void)fullTextSearch:(NSString *)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure;
-
-#pragma mark - Remore wipe
-
-- (void)getSetRemoteWipe:(NSString *)serverPath token:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure;
-
-#pragma mark - Trash
-
-- (void)listTrash:(NSString *)path depth:(NSString *)depth onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *response, id _Nullable responseObject, NSError *error))failure;
-
-- (void)emptyTrash:(NSString*)path onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure;
-
-
-#pragma mark - Messages
-
-- (void)getComments:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure;
-
-- (void)putComments:(NSString*)serverPath message:(NSString *)message onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure;
-
-- (void)updateComments:(NSString*)serverPath message:(NSString *)message onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure;
-
-- (void)readMarkComments:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure;
-
-- (void)deleteComments:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure;
-
-#pragma mark - Third Parts
-
-- (void)getHCUserProfile:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCComunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure;
-
-- (void)putHCUserProfile:(NSString *)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure;
-
-- (void)getHCFeatures:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure;
-
-NS_ASSUME_NONNULL_END
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m b/Libraries external/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m
deleted file mode 100755
index e2814630b..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m
+++ /dev/null
@@ -1,1623 +0,0 @@
-
-//
-// OCWebDAVClient.m
-// OCWebDAVClient
-//
-// This class is based in https://github.com/zwaldowski/DZWebDAVClient. Copyright (c) 2012 Zachary Waldowski, Troy Brant, Marcus Rohrmoser, and Sam Soffes.
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-// Add : getNotificationServer & setNotificationServer
-// Add : getUserProfileServer
-// Add : Support for Favorite
-// Add : getActivityServer
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-// Copyright (c) 2017 Marino Faggiana. All rights reserved.
-//
-
-#import "OCWebDAVClient.h"
-#import "OCFrameworkConstants.h"
-#import "OCCommunication.h"
-#import "UtilsFramework.h"
-#import "NSString+Encode.h"
-#import "OCConstants.h"
-
-#define k_api_user_url_xml @"index.php/ocs/cloud/user"
-#define k_api_user_url_json @"index.php/ocs/cloud/user?format=json"
-#define k_server_information_json @"status.php"
-#define k_api_header_request @"OCS-APIREQUEST"
-#define k_group_sharee_type 1
-
-NSString const *OCWebDAVContentTypeKey = @"getcontenttype";
-NSString const *OCWebDAVETagKey = @"getetag";
-NSString const *OCWebDAVCTagKey = @"getctag";
-NSString const *OCWebDAVCreationDateKey = @"creationdate";
-NSString const *OCWebDAVModificationDateKey = @"modificationdate";
-
-NSString *const NCResource = @"<d:displayname/>"
- "<d:getcontenttype/>"
- "<d:resourcetype/>"
- "<d:getcontentlength/>"
- "<d:getlastmodified/>"
- "<d:creationdate/>"
- "<d:getetag/>"
- "<d:quota-used-bytes/>"
- "<d:quota-available-bytes/>"
- "<permissions xmlns=\"http://owncloud.org/ns\"/>"
- "<id xmlns=\"http://owncloud.org/ns\"/>"
- "<fileid xmlns=\"http://owncloud.org/ns\"/>"
- "<size xmlns=\"http://owncloud.org/ns\"/>"
- "<favorite xmlns=\"http://owncloud.org/ns\"/>"
- "<is-encrypted xmlns=\"http://nextcloud.org/ns\"/>"
- "<mount-type xmlns=\"http://nextcloud.org/ns\"/>"
- "<owner-id xmlns=\"http://owncloud.org/ns\"/>"
- "<owner-display-name xmlns=\"http://owncloud.org/ns\"/>"
- "<comments-unread xmlns=\"http://owncloud.org/ns\"/>"
- "<has-preview xmlns=\"http://nextcloud.org/ns\"/>"
- "<trashbin-filename xmlns=\"http://nextcloud.org/ns\"/>"
- "<trashbin-original-location xmlns=\"http://nextcloud.org/ns\"/>"
- "<trashbin-deletion-time xmlns=\"http://nextcloud.org/ns\"/>";
-
-@interface OCWebDAVClient()
-
-- (void)mr_listPath:(NSString *)path depth:(NSString *)depth onCommunication:
-(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure;
-
-@end
-
-@implementation OCWebDAVClient
-
-- (id) init {
-
- self = [super init];
-
- if (self != nil) {
- self.defaultHeaders = [NSMutableDictionary new];
- }
-
- return self;
-}
-
-- (void)setAuthorizationHeaderWithUsername:(NSString *)username password:(NSString *)password {
- NSString *basicAuthCredentials = [NSString stringWithFormat:@"%@:%@", username, password];
-
- [self.defaultHeaders setObject:[NSString stringWithFormat:@"Basic %@", [UtilsFramework AFBase64EncodedStringFromString: basicAuthCredentials]] forKey:@"Authorization"];
-}
-
-- (void)setAuthorizationHeaderWithCookie:(NSString *) cookieString {
- [self.defaultHeaders setObject:cookieString forKey:@"Cookie"];
-}
-
-- (void)setAuthorizationHeaderWithToken:(NSString *)token {
- [self.defaultHeaders setObject:token forKey:@"Authorization"];
-}
-
-- (void)setDefaultHeader:(NSString *)header value:(NSString *)value {
- [self.defaultHeaders setObject:value forKey:header];
-}
-
-- (void)setUserAgent:(NSString *)userAgent{
- [self.defaultHeaders setObject:userAgent forKey:@"User-Agent"];
-}
-
-- (OCHTTPRequestOperation *)mr_operationWithRequest:(NSMutableURLRequest *)request onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString*)token success:(void(^)(NSHTTPURLResponse *operation, id response, NSString *token))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error, NSString *token))failure {
-
- //If is not nil is a redirection so we keep the original url server
- if (!self.originalUrlServer) {
- self.originalUrlServer = [request.URL absoluteString];
- }
-
- if (sharedOCCommunication.isCookiesAvailable) {
- //We add the cookies of that URL
- request = [UtilsFramework getRequestWithCookiesByRequest:request andOriginalUrlServer:self.originalUrlServer];
- } else {
- [UtilsFramework deleteAllCookies];
- }
-
- OCHTTPRequestOperation *operation = (OCHTTPRequestOperation*) [sharedOCCommunication.networkSessionManager dataTaskWithRequest:request completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
- if (!error) {
- success((NSHTTPURLResponse*)response,responseObject, token);
- } else {
- failure((NSHTTPURLResponse*)response, responseObject, error, token);
- }
- }];
-
- return operation;
-}
-
-- (OCHTTPRequestOperation *)mr_operationWithRequest:(NSMutableURLRequest *)request onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *, id))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
-
- //If is not nil is a redirection so we keep the original url server
- if (!self.originalUrlServer) {
- self.originalUrlServer = [request.URL absoluteString];
- }
-
- if (sharedOCCommunication.isCookiesAvailable) {
- //We add the cookies of that URL
- request = [UtilsFramework getRequestWithCookiesByRequest:request andOriginalUrlServer:self.originalUrlServer];
- } else {
- [UtilsFramework deleteAllCookies];
- }
-
- OCHTTPRequestOperation *operation = (OCHTTPRequestOperation*) [sharedOCCommunication.networkSessionManager dataTaskWithRequest:request completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
- if (!error) {
- success((NSHTTPURLResponse*)response,responseObject);
- } else {
- failure((NSHTTPURLResponse*)response, responseObject, error);
- }
- }];
-
- return operation;
-
-}
-
-- (NSMutableURLRequest *)requestWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters timeout:(NSTimeInterval)timeout {
-
- NSMutableURLRequest *request = [[AFHTTPRequestSerializer new] requestWithMethod:method URLString:path parameters:nil error:nil];
- [request setAllHTTPHeaderFields:self.defaultHeaders];
-
- [request setCachePolicy: NSURLRequestReloadIgnoringLocalCacheData];
- [request setTimeoutInterval: timeout];
-
- return request;
-}
-
-- (NSMutableURLRequest *)sharedRequestWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters timeout:(NSTimeInterval)timeout {
-
- NSMutableURLRequest *request = [[AFHTTPRequestSerializer new] requestWithMethod:method URLString:path parameters:nil error:nil];
-
- [request setAllHTTPHeaderFields:self.defaultHeaders];
-
- //NSMutableURLRequest *request = [super requestWithMethod:method path:path parameters:parameters];
- [request setCachePolicy: NSURLRequestReloadIgnoringLocalCacheData];
- [request setTimeoutInterval: k_timeout_webdav];
- //Header for use the OC API CALL
- NSString *ocs_apiquests = @"true";
- [request setValue:ocs_apiquests forHTTPHeaderField:k_api_header_request];
- [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
- [request addValue:@"gzip, deflate" forHTTPHeaderField:@"Accept-Encoding"];
-
- return request;
-}
-
-
-- (void)movePath:(NSString *)source toPath:(NSString *)destination
- onCommunication:(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
- _requestMethod = @"MOVE";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:source parameters:nil timeout:k_timeout_webdav];
- [request setValue:destination forHTTPHeaderField:@"Destination"];
- [request setValue:@"T" forHTTPHeaderField:@"Overwrite"];
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)deletePath:(NSString *)path
- onCommunication:(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
-
- _requestMethod = @"DELETE";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-
-- (void)mr_listPath:(NSString *)path depth:(NSString *)depth onCommunication:
-(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
- NSParameterAssert(success);
-
- _requestMethod = @"PROPFIND";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
-
- [request setValue: depth forHTTPHeaderField: @"Depth"];
- NSString *body = @"<?xml version=\"1.0\" encoding=\"UTF-8\"?><d:propfind xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\"><d:prop>";
- body = [body stringByAppendingString:NCResource];
- body = [body stringByAppendingString:@"</d:prop></d:propfind>"];
- [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
- [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)mr_listPath:(NSString *)path depth:(NSString *)depth withUserSessionToken:(NSString*)token onCommunication:
-(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *operation, id response, NSString *token))success
- failure:(void(^)(NSHTTPURLResponse *response, id _Nullable responseObject, NSError *, NSString *token))failure {
- NSParameterAssert(success);
-
- _requestMethod = @"PROPFIND";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
-
- [request setValue: depth forHTTPHeaderField: @"Depth"];
- NSString *body = @"<?xml version=\"1.0\" encoding=\"UTF-8\"?><d:propfind xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\"><d:prop>";
- body = [body stringByAppendingString:NCResource];
- body = [body stringByAppendingString:@"</d:prop></d:propfind>"];
- [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
- [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication withUserSessionToken:token success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)propertiesOfPath:(NSString *)path
- onCommunication: (OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id ))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
- [self mr_listPath:path depth:@"0" onCommunication:sharedOCCommunication success:success failure:failure];
-}
-
-- (void)listPath:(NSString *)path depth:(NSString *)depth
- onCommunication:(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
- [self mr_listPath:path depth:depth onCommunication:sharedOCCommunication success:success failure:failure];
-}
-
-- (void)listPath:(NSString *)path depth:(NSString *)depth
- onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token
- success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *, NSString *token))failure {
- [self mr_listPath:path depth:depth withUserSessionToken:token onCommunication:sharedOCCommunication success:success failure:failure];
-}
-
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth lteDateLastModified:(NSString *)lteDateLastModified gteDateLastModified:(NSString *)gteDateLastModified contentType:(NSArray *)contentType user:(NSString *)user userID:(NSString *)userID onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *, NSString *token))failure {
-
- NSString *body = @"";
- NSString *whereType = @"";
- NSString *whereDate = @"";
-
- NSParameterAssert(success);
-
- _requestMethod = @"SEARCH";
-
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_search];
-
- if (contentType && lteDateLastModified && gteDateLastModified) {
-
- body = [NSString stringWithFormat: @""
- "<?xml version=\"1.0\"?>"
- "<d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">"
- "<d:basicsearch>"
- "<d:select>"
- "<d:prop>"
- "%@"
- "</d:prop>"
- "</d:select>"
- "<d:from>"
- "<d:scope>"
- "<d:href>/files/%@%@</d:href>"
- "<d:depth>infinity</d:depth>"
- "</d:scope>"
- "</d:from>"
- "<d:orderby>"
- "<d:order>"
- "<d:prop><d:getlastmodified/></d:prop>"
- "<d:descending/>"
- "</d:order>"
- "<d:order>"
- "<d:prop><d:displayname/></d:prop>"
- "<d:descending/>"
- "</d:order>"
- "</d:orderby>"
- "<d:where><d:and><d:or>", NCResource, userID, folder];
-
- for (NSString *type in contentType) {
- whereType = [NSString stringWithFormat: @"%@<d:like><d:prop><d:getcontenttype/></d:prop><d:literal>%@</d:literal></d:like>", whereType, type];
- }
-
- body = [NSString stringWithFormat: @"%@%@</d:or><d:or>", body, whereType];
-
- whereDate = [NSString stringWithFormat: @"%@<d:and><d:lte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:lte><d:gte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:gte></d:and>", whereDate, lteDateLastModified, gteDateLastModified];
-
- /*
- if (gteDateLastModified != nil && lteDateLastModified == nil) {
- whereDate = [NSString stringWithFormat: @"%@<d:gte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:gte>", whereDate, gteDateLastModified];
- } else if (gteDateLastModified != nil && lteDateLastModified != nil) {
- whereDate = [NSString stringWithFormat: @"%@<d:and><d:lte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:lte><d:gte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:gte></d:and>", whereDate, lteDateLastModified, gteDateLastModified];
- }
- */
-
- body = [NSString stringWithFormat: @"%@%@</d:or></d:and></d:where></d:basicsearch></d:searchrequest>", body, whereDate];
-
- } else {
-
- body = [NSString stringWithFormat: @""
- "<?xml version=\"1.0\"?>"
- "<d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">"
- "<d:basicsearch>"
- "<d:select>"
- "<d:prop>"
- "%@"
- "</d:prop>"
- "</d:select>"
- "<d:from>"
- "<d:scope>"
- "<d:href>/files/%@%@</d:href>"
- "<d:depth>infinity</d:depth>"
- "</d:scope>"
- "</d:from>"
- "<d:where>"
- "<d:like>"
- "<d:prop><d:displayname/></d:prop>"
- "<d:literal>%@</d:literal>"
- "</d:like>"
- "</d:where>"
- "</d:basicsearch>"
- "</d:searchrequest>", NCResource, userID, folder, fileName];
- }
-
- [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
- [request setValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication withUserSessionToken:token success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName dateLastModified:(NSString *)dateLastModified numberOfItem:(NSInteger)numberOfItem userID:(NSString *)userID onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *, NSString *token))failure {
-
- NSString *body = @"";
-
- NSParameterAssert(success);
-
- _requestMethod = @"SEARCH";
-
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_search];
-
- body = [NSString stringWithFormat: @""
- "<?xml version=\"1.0\"?>"
- "<d:searchrequest xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">"
- "<d:basicsearch>"
- "<d:select>"
- "<d:prop>"
- "%@"
- "</d:prop>"
- "</d:select>"
-
- "<d:from>"
- "<d:scope>"
- "<d:href>/files/%@%@</d:href>"
- "<d:depth>1</d:depth>"
- "</d:scope>"
- "</d:from>"
-
- /*
- "<d:orderby>"
- "<d:order>"
- "<d:prop><d:displayname/></d:prop>"
- "<d:descending/>"
- "</d:order>"
- "<d:order>"
- "<d:prop><d:getlastmodified/></d:prop>"
- "<d:descending/>"
- "</d:order>"
- "</d:orderby>"
- */
-
- "<d:where>"
- "<d:like>"
- "<d:prop><d:displayname/></d:prop>"
- "<d:literal>%@</d:literal>"
- "</d:like>"
- "</d:where>"
- /*
- "<d:where><d:and><d:or>"
- "<d:gte>"
- "<d:prop><d:getlastmodified/></d:prop>"
- "<d:literal>%@</d:literal>"
- "</d:gte>"
- "</d:or></d:and></d:where>"
-
- "<d:limit>"
- "<d:nresults>%@</d:nresults>"
- "</d:limit>"
- */
- "</d:basicsearch>"
- "</d:searchrequest>", NCResource, userID, folder, fileName]; //, [@(numberOfItem) stringValue]];
-
- [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
- [request setValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication withUserSessionToken:token success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-- (void)settingFavorite:(NSString * _Nonnull)path favorite:(BOOL)favorite onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *, NSString *token))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"PROPPATCH";
-
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
-
- NSString *body;
- body = [NSString stringWithFormat: @""
- "<?xml version=\"1.0\"?>"
- "<d:propertyupdate xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">"
- "<d:set>"
- "<d:prop>"
- "<oc:favorite>%i</oc:favorite>"
- "</d:prop>"
- "</d:set>"
- "</d:propertyupdate>", (favorite ? 1 : 0)];
-
- [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
-
- [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication withUserSessionToken:token success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)listingFavorites:(NSString *)path folder:(NSString *)folder user:(NSString *)user userID:(NSString *)userID onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *, NSString *token))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"REPORT";
-
- userID = [userID stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:[NSString stringWithFormat:@"%@/files/%@%@", path, userID, folder] parameters:nil timeout:k_timeout_webdav];
-
- NSString *body = @"<?xml version=\"1.0\"?><oc:filter-files xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\"><d:prop>";
- body = [body stringByAppendingString:NCResource];
- body = [body stringByAppendingString:@"</d:prop><oc:filter-rules><oc:favorite>1</oc:favorite></oc:filter-rules></oc:filter-files>"];
- [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
- [request setValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication withUserSessionToken:token success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (NSURLSessionDownloadTask *)downloadWithSessionPath:(NSString *)remoteSource toPath:(NSString *)localDestination defaultPriority:(BOOL)defaultPriority onCommunication:(OCCommunication *)sharedOCCommunication progress:(void(^)(NSProgress *progress))downloadProgress success:(void(^)(NSURLResponse *response, NSURL *filePath))success failure:(void(^)(NSURLResponse *response, NSError *error))failure{
-
- NSMutableURLRequest *request = [self requestWithMethod:@"GET" path:remoteSource parameters:nil timeout:k_timeout_webdav];
-
- //If is not nil is a redirection so we keep the original url server
- if (!self.originalUrlServer) {
- self.originalUrlServer = [request.URL absoluteString];
- }
-
- //We add the cookies of that URL
- request = [UtilsFramework getRequestWithCookiesByRequest:request andOriginalUrlServer:self.originalUrlServer];
-
- NSURLSessionDownloadTask *downloadTask = [sharedOCCommunication.downloadSessionManager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull progress) {
- downloadProgress(progress);
- } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
- [[NSFileManager defaultManager] removeItemAtURL:[NSURL fileURLWithPath:localDestination] error:nil];
- return [NSURL fileURLWithPath:localDestination];
- } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
- if (error) {
- failure(response, error);
- } else {
- success(response,filePath);
- }
- }];
-
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.downloadSessionManager];
-
-
- if (defaultPriority) {
- [downloadTask resume];
- }
-
- return downloadTask;
-}
-
-- (void)checkServer:(NSString *)path onCommunication:
-(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
- _requestMethod = @"HEAD";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
- request.HTTPShouldHandleCookies = false;
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)makeCollection:(NSString *)path onCommunication:
-(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
- _requestMethod = @"MKCOL";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (NSURLSessionUploadTask *)putWithSessionLocalPath:(NSString *)localSource atRemotePath:(NSString *)remoteDestination onCommunication:(OCCommunication *)sharedOCCommunication progress:(void(^)(NSProgress *progress))uploadProgress success:(void(^)(NSURLResponse *, NSString *))success failure:(void(^)(NSURLResponse *, id, NSError *))failure failureBeforeRequest:(void(^)(NSError *)) failureBeforeRequest {
-
- NSFileManager *fileManager = [NSFileManager defaultManager];
-
- if (localSource == nil || ![fileManager fileExistsAtPath:localSource]) {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"You are trying upload a file that does not exist" forKey:NSLocalizedDescriptionKey];
-
- NSError *error = [NSError errorWithDomain:k_domain_error_code code:OCErrorFileToUploadDoesNotExist userInfo:details];
-
- failureBeforeRequest(error);
-
- return nil;
- } else {
-
- NSMutableURLRequest *request = [self requestWithMethod:@"PUT" path:remoteDestination parameters:nil timeout:k_timeout_webdav];
- [request setTimeoutInterval:k_timeout_upload];
- [request setValue:[NSString stringWithFormat:@"%lld", [UtilsFramework getSizeInBytesByPath:localSource]] forHTTPHeaderField:@"Content-Length"];
- [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
-
- //If is not nil is a redirection so we keep the original url server
- if (!self.originalUrlServer) {
- self.originalUrlServer = [request.URL absoluteString];
- }
-
- if (sharedOCCommunication.isCookiesAvailable) {
- //We add the cookies of that URL
- request = [UtilsFramework getRequestWithCookiesByRequest:request andOriginalUrlServer:self.originalUrlServer];
- } else {
- [UtilsFramework deleteAllCookies];
- }
-
- NSURL *file = [NSURL fileURLWithPath:localSource];
-
- sharedOCCommunication.uploadSessionManager.responseSerializer = [AFHTTPResponseSerializer serializer];
-
- NSURLSessionUploadTask *uploadTask = [sharedOCCommunication.uploadSessionManager uploadTaskWithRequest:request fromFile:file progress:^(NSProgress * _Nonnull progress) {
- uploadProgress(progress);
- } completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
- if (error) {
- failure(response, responseObject, error);
- } else {
- success(response,responseObject);
- }
- }];
-
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.uploadSessionManager];
- [uploadTask resume];
- return uploadTask;
- }
-}
-
-- (void) requestUserNameOfServer:(NSString * _Nonnull) path byCookie:(NSString * _Nonnull) cookieString onCommunication:
-(OCCommunication * _Nonnull)sharedOCCommunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nonnull))success
- failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id _Nullable responseObject, NSError * _Nonnull))failure {
-
- NSString *apiUserUrl = nil;
- apiUserUrl = [NSString stringWithFormat:@"%@%@", path, k_api_user_url_json];
-
- NSLog(@"api user name call: %@", apiUserUrl);
-
- _requestMethod = @"GET";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path: apiUserUrl parameters: nil timeout:k_timeout_webdav];
- [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void) getStatusOfTheServer:(NSString *)serverPath onCommunication:
-(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id responseObject))success
- failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- NSString *urlString = [NSString stringWithFormat:@"%@%@", serverPath, k_server_information_json];
-
- _requestMethod = @"GET";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path: urlString parameters: nil timeout:k_timeout_webdav];
-
- request.HTTPShouldHandleCookies = false;
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)listSharedByServer:(NSString *)serverPath
- onCommunication:(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"GET";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)listSharedByServer:(NSString *)serverPath andPath:(NSString *) path
- onCommunication:(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
-
- NSParameterAssert(success);
-
- NSString *postString = [NSString stringWithFormat: @"?path=%@&reshares=true",path];
- serverPath = [serverPath stringByAppendingString:postString];
- _requestMethod = @"GET";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)shareByLinkFileOrFolderByServer:(NSString *)serverPath andPath:(NSString *) filePath andPassword:(NSString *)password andPermission:(NSInteger)permission andHideDownload:(BOOL)hideDownload
- onCommunication:(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- _postStringForShare = [NSString stringWithFormat: @"path=%@&shareType=3&permissions=%ld&password=%@&hidedownload=%i", filePath, (long)permission, password, hideDownload];
- [request setHTTPBody:[_postStringForShare dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)shareByLinkFileOrFolderByServer:(NSString *)serverPath andPath:(NSString *) filePath
- onCommunication:(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- _postStringForShare = [NSString stringWithFormat: @"path=%@&shareType=3",filePath];
- [request setHTTPBody:[_postStringForShare dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)shareWith:(NSString *)userOrGroup shareeType:(NSInteger)shareeType inServer:(NSString *) serverPath andPath:(NSString *) filePath andPermissions:(NSInteger) permissions onCommunication:(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- self.postStringForShare = [NSString stringWithFormat: @"path=%@&shareType=%ld&shareWith=%@&permissions=%ld",filePath, (long)shareeType, userOrGroup, (long)permissions];
- [request setHTTPBody:[_postStringForShare dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-
-- (void)unShareFileOrFolderByServer:(NSString *)serverPath
- onCommunication:(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
- NSParameterAssert(success);
-
- _requestMethod = @"DELETE";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-
-- (void)isShareFileOrFolderByServer:(NSString *)serverPath
- onCommunication:(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
- NSParameterAssert(success);
-
- _requestMethod = @"GET";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void) updateShareItem:(NSInteger)shareId ofServerPath:(NSString*)serverPath withPasswordProtect:(NSString*)password andNote:(NSString *)note andExpirationTime:(NSString*)expirationTime andPermissions:(NSInteger)permissions andHideDownload:(BOOL)hideDownload
- onCommunication:(OCCommunication *)sharedOCCommunication
- success:(void(^)(NSHTTPURLResponse *, id response))success
- failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *error))failure{
-
- NSParameterAssert(success);
-
- _requestMethod = @"PUT";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- if (password) {
- self.postStringForShare = [NSString stringWithFormat:@"password=%@&",password];
- } else if (note) {
- self.postStringForShare = [NSString stringWithFormat:@"note=%@",note];
- } else if (expirationTime) {
- self.postStringForShare = [NSString stringWithFormat:@"expireDate=%@",expirationTime];
- } else if (permissions > 0) {
- self.postStringForShare = [NSString stringWithFormat:@"permissions=%ld",(long)permissions];
- } else {
- if (hideDownload) self.postStringForShare = [NSString stringWithFormat:@"hideDownload=true"];
- else self.postStringForShare = [NSString stringWithFormat:@"hideDownload=false"];
- }
-
- [request setHTTPBody:[_postStringForShare dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void) searchUsersAndGroupsWith:(NSString *)searchString forPage:(NSInteger)page with:(NSInteger)resultsPerPage ofServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
- failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"GET";
-
- NSString *searchQuery = [NSString stringWithFormat: @"&search=%@",searchString];
- NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
- NSString *queryType = [NSString stringWithFormat:@"&itemType=file"];
- NSString *pagination = [NSString stringWithFormat:@"&page=%ld&perPage=%ld", (long)page, (long)resultsPerPage];
- serverPath = [serverPath stringByAppendingString:jsonQuery];
- serverPath = [serverPath stringByAppendingString:queryType];
- serverPath = [serverPath stringByAppendingString:searchQuery];
- serverPath = [serverPath stringByAppendingString:pagination];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void) getCapabilitiesOfServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
- _requestMethod = @"GET";
-
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-
-#pragma mark - Remote thumbnails
-
-- (OCHTTPRequestOperation *) getRemoteThumbnailByServer:(NSString*)serverPath ofFilePath:(NSString*)filePath withWidth:(NSInteger)fileWidth andHeight:(NSInteger)fileHeight onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
- _requestMethod = @"GET";
-
- NSString *query = [NSString stringWithFormat:@"/index.php/apps/files/api/v1/thumbnail/%i/%i/%@", (int)fileWidth, (int)fileHeight, filePath];
- serverPath = [serverPath stringByAppendingString:query];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- return operation;
-}
-
-- (OCHTTPRequestOperation *) getRemotePreviewByServer:(NSString *)serverPath ofFilePath:(NSString *)filePath withWidth:(NSInteger)fileWidth andHeight:(NSInteger)fileHeight andA:(NSInteger)a andMode:(NSString *)mode path:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- _requestMethod = @"GET";
-
- if (path.length > 0) {
- serverPath = path;
- } else {
- NSString *query = [NSString stringWithFormat:@"/index.php/core/preview.png?file=%@&x=%d&y=%d&a=%d&mode=%@", filePath, (int)fileWidth, (int)fileHeight, (int)a, mode];
- serverPath = [serverPath stringByAppendingString:query];
- }
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- return operation;
-}
-
-- (OCHTTPRequestOperation *) getRemotePreviewTrashByServer:(NSString *)serverPath ofFileId:(NSString*)fileId size:(NSString *)size onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- _requestMethod = @"GET";
-
- NSString *query = [NSString stringWithFormat:@"/index.php/apps/files_trashbin/preview?fileId=%@&x=%@&y=%@", fileId, size, size];
- serverPath = [serverPath stringByAppendingString:query];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- return operation;
-}
-
-#pragma mark - Get Notification
-
-- (void)getNotificationServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"GET";
-
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)setNotificationServer:(NSString *)serverPath type:(NSString *)type onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *, id))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = type;
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)subscribingNextcloudServerPush:(NSString *)serverPath pushTokenHash:(NSString *)pushTokenHash devicePublicKey:(NSString *)devicePublicKey proxyServerPath:(NSString *)proxyServerPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *, id))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&pushTokenHash=%@",pushTokenHash]];
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&devicePublicKey=%@",devicePublicKey]];
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&proxyServer=%@",proxyServerPath]];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)unsubscribingNextcloudServerPush:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *, id))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"DELETE";
-
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)subscribingPushProxy:(NSString *)serverPath pushToken:(NSString *)pushToken deviceIdentifier:(NSString *)deviceIdentifier deviceIdentifierSignature:(NSString *)deviceIdentifierSignature publicKey:(NSString *)publicKey onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *, id))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&pushToken=%@",pushToken]];
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&deviceIdentifier=%@",deviceIdentifier]];
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&deviceIdentifierSignature=%@",deviceIdentifierSignature]];
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&userPublicKey=%@",publicKey]];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
- NSString *userAgent = [request valueForHTTPHeaderField:@"User-Agent"];
- //[request setValue:[userAgent stringByAppendingString:@" (SilentPush)"] forHTTPHeaderField:@"User-Agent"];
- [request setValue:[userAgent stringByAppendingString:@" (Strict VoIP)"] forHTTPHeaderField:@"User-Agent"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)unsubscribingPushProxy:(NSString *)serverPath deviceIdentifier:(NSString *)deviceIdentifier deviceIdentifierSignature:(NSString *)deviceIdentifierSignature publicKey:(NSString *)publicKey onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *, id))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"DELETE";
-
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&deviceIdentifier=%@",deviceIdentifier]];
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&deviceIdentifierSignature=%@",deviceIdentifierSignature]];
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&userPublicKey=%@",publicKey]];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-#pragma mark - Get Activity
-
-- (void) getActivityServer:(NSString*)serverPath since:(NSInteger)since limit:(NSInteger)limit objectId:(NSString *)objectId objectType:(NSString *)objectType previews:(BOOL)previews link:(NSString *)link onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"GET";
-
- if (objectId.length == 0) {
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"/all?format=json&since=%ld&limit=%ld", (long)since, (long)limit]];
- } else {
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"/filter?format=json&since=%ld&limit=%ld&object_id=%@&object_type=%@",(long)since, (long)limit, objectId, objectType]];
- }
- if (previews) {
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&previews=true"]];
- }
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-#pragma mark - Get External sites
-
-- (void) getExternalSitesServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"GET";
-
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-#pragma mark - Get User Profile
-
-- (void) getUserProfileServer:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"GET";
-
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-#pragma mark - End-to-End Encryption
-
-- (void)getEndToEndPublicKeys:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"GET";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)getEndToEndPrivateKeyCipher:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"GET";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)getEndToEndServerPublicKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"GET";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)signEndToEndPublicKey:(NSString*)serverPath key:(NSString *)key onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-
- _postStringKey = [NSString stringWithFormat: @"csr=%@",key];
- [request setHTTPBody:[_postStringKey dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)storeEndToEndPrivateKeyCipher:(NSString*)serverPath key:(NSString *)key onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-
- _postStringKey = [NSString stringWithFormat: @"privateKey=%@",key];
- [request setHTTPBody:[_postStringKey dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)deleteEndToEndPublicKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"DELETE";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)deleteEndToEndPrivateKey:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"DELETE";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)markEndToEndFolderEncrypted:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"PUT";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)deletemarkEndToEndFolderEncrypted:(NSString*)serverPath e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"DELETE";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- [request setValue:e2eToken forHTTPHeaderField:@"e2e-token"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)lockEndToEndFolderEncrypted:(NSString*)serverPath e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- [request setValue:e2eToken forHTTPHeaderField:@"e2e-token"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)unlockEndToEndFolderEncrypted:(NSString*)serverPath e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- _requestMethod = @"DELETE";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- [request setValue:e2eToken forHTTPHeaderField:@"e2e-token"];
-
- NSLog(@"%@", [request allHTTPHeaderFields]);
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)getEndToEndMetadata:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- NSParameterAssert(success);
-
- _requestMethod = @"GET";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)storeEndToEndMetadata:(NSString*)serverPath metadata:(NSString *)metadata e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- [request setValue:e2eToken forHTTPHeaderField:@"e2e-token"];
-
- _postStringMetadata = [NSString stringWithFormat: @"metaData=%@",metadata];
- [request setHTTPBody:[_postStringMetadata dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)updateEndToEndMetadata:(NSString*)serverPath metadata:(NSString *)metadata e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure{
-
- NSParameterAssert(success);
-
- _requestMethod = @"PUT";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- [request setValue:e2eToken forHTTPHeaderField:@"e2e-token"];
-
- _postStringMetadata = [NSString stringWithFormat: @"metaData=%@",metadata];
- [request setHTTPBody:[_postStringMetadata dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)deleteEndToEndMetadata:(NSString*)serverPath e2eToken:(NSString *)e2eToken onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"DELETE";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- [request setValue:e2eToken forHTTPHeaderField:@"e2e-token"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-#pragma mark - Manage Mobile Editor OCS API
-
-- (void)createLinkRichdocuments:(NSString *)serverPath fileId:(NSString *)fileId onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- [request setHTTPBody:[[NSString stringWithFormat: @"fileId=%@",fileId] dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)getTemplatesRichdocuments:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"GET";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)createNewRichdocuments:(NSString *)serverPath path:(NSString *)path templateID:(NSString *)templateID onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- [request setHTTPBody:[[NSString stringWithFormat: @"path=%@&template=%@", path, templateID] dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)createAssetRichdocuments:(NSString *)serverPath path:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- [request setHTTPBody:[[NSString stringWithFormat: @"path=%@",path] dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-#pragma mark - Fulltextsearch
-
-- (void)fullTextSearch:(NSString *)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"GET";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- //[request setHTTPBody:[data dataUsingEncoding:NSUTF8StringEncoding]];
- [request setHTTPBody:[[NSString stringWithFormat:@"request=%@",data] dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-#pragma mark - Remore wipe
-
-- (void)getSetRemoteWipe:(NSString *)serverPath token:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- [request setHTTPBody:[[NSString stringWithFormat:@"token=%@",token] dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-#pragma mark - Trash
-
-- (void)listTrash:(NSString *)path depth:(NSString *)depth onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *response, id _Nullable responseObject, NSError *error))failure
-{
- NSParameterAssert(success);
-
- _requestMethod = @"PROPFIND";
-
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
-
- [request setValue: depth forHTTPHeaderField: @"Depth"];
-
- NSString *body = @"<?xml version=\"1.0\" encoding=\"UTF-8\"?><d:propfind xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\"><d:prop>";
- body = [body stringByAppendingString:NCResource];
- body = [body stringByAppendingString:@"</d:prop></d:propfind>"];
- [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
- [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
- [operation resume];
-}
-
-- (void)emptyTrash:(NSString*)path onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"DELETE";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-#pragma mark - Messages
-
-- (void)getComments:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id _Nullable responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"PROPFIND";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- [request setHTTPBody:[@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- "<d:propfind xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">"
- "<d:prop>"
- "<oc:id/>"
- "<oc:verb/>"
- "<oc:actorType/>"
- "<oc:actorId/>"
- "<oc:creationDateTime/>"
- "<oc:objectType/>"
- "<oc:objectId/>"
- "<oc:isUnread/>"
- "<oc:message/>"
- "<oc:actorDisplayName/>"
- "</d:prop>"
- "</d:propfind>" dataUsingEncoding:NSUTF8StringEncoding]];
- [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)putComments:(NSString*)serverPath message:(NSString *)message onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
- [request setHTTPBody:[[NSString stringWithFormat: @"{\"actorType\":\"users\",\"verb\":\"comment\",\"message\":\"%@\"}",message] dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)updateComments:(NSString*)serverPath message:(NSString *)message onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"PROPPATCH";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- NSString *body;
- body = [NSString stringWithFormat: @""
- "<?xml version=\"1.0\"?>"
- "<d:propertyupdate xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">"
- "<d:set>"
- "<d:prop>"
- "<oc:message>%@</oc:message>"
- "</d:prop>"
- "</d:set>"
- "</d:propertyupdate>", message];
-
- [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
- [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)readMarkComments:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"PROPPATCH";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- NSString *body;
- body = [NSString stringWithFormat: @""
- "<?xml version=\"1.0\"?>"
- "<d:propertyupdate xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">"
- "<d:set>"
- "<d:prop>"
- "<readMarker xmlns=\"http://owncloud.org/ns\"/>"
- "</d:prop>"
- "</d:set>"
- "</d:propertyupdate>"];
-
- [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
- [request setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)deleteComments:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"DELETE";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-#pragma mark - Third Parts
-
-- (void)getHCUserProfile:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure {
-
- _requestMethod = @"GET";
-
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)putHCUserProfile:(NSString*)serverPath data:(NSString *)data onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure {
-
- NSParameterAssert(success);
-
- _requestMethod = @"POST";
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
- [request setHTTPBody:[[NSString stringWithFormat: @"data=%@",data] dataUsingEncoding:NSUTF8StringEncoding]];
-
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-- (void)getHCFeatures:(NSString *)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id responseObject, NSError *error))failure {
-
- _requestMethod = @"GET";
-
- serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
-
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
- OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
- [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-
- [operation resume];
-}
-
-#pragma mark - Manage Redirections
-
-- (void)setRedirectionBlockOnDatataskWithOCCommunication: (OCCommunication *) sharedOCCommunication andSessionManager:(AFURLSessionManager *) sessionManager{
-
- [sessionManager setTaskWillPerformHTTPRedirectionBlock:^NSURLRequest * _Nonnull(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSURLResponse * _Nonnull response, NSURLRequest * _Nonnull request) {
-
- if (response == nil) {
- // needed to handle fake redirects to canonical addresses, as explained in https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/URLLoadingSystem/Articles/RequestChanges.html
- return request;
- }
-
- NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
- NSDictionary *dict = [httpResponse allHeaderFields];
- //Server path of redirected server
- NSString *responseURLString = [dict objectForKey:@"Location"];
-
- if (responseURLString) {
-
- if ([UtilsFramework isURLWithSamlFragment:responseURLString] || httpResponse.statusCode == k_redirected_code_1) {
- //We set the redirectedServer in case SAML or is a permanent redirection
- self.redirectedServer = responseURLString;
-
- if ([UtilsFramework isURLWithSamlFragment:responseURLString]) {
- // if SAML request, we don't want to follow it; WebView takes care, not here -> nil to NO FOLLOW
- return nil;
- }
- }
-
- NSMutableURLRequest *requestRedirect = [request mutableCopy];
- [requestRedirect setURL: [NSURL URLWithString:responseURLString]];
-
- requestRedirect = [sharedOCCommunication getRequestWithCredentials:requestRedirect];
- requestRedirect.HTTPMethod = _requestMethod;
-
- if (_postStringForShare) {
- //It is a request to share a file by link
- requestRedirect = [self sharedRequestWithMethod:_requestMethod path:responseURLString parameters:nil timeout:k_timeout_webdav];
- [requestRedirect setHTTPBody:[_postStringForShare dataUsingEncoding:NSUTF8StringEncoding]];
- }
-
- return requestRedirect;
-
- } else {
- // no location to redirect -> nil to NO FOLLOW
- return nil;
- }
- }];
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLCommentsParser.h b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLCommentsParser.h
deleted file mode 100755
index 6904a361b..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLCommentsParser.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// NCXMLCommentsParser.h
-// Nextcloud
-//
-// Created by Marino Faggiana on 08/08/19.
-// Copyright © 2018 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-#import "NCComments.h"
-
-@interface NCXMLCommentsParser : NSObject <NSXMLParserDelegate>
-
-@property (nonatomic, strong) NSMutableArray *list;
-@property (nonatomic, strong) NCComments *currentComment;
-
-@property (nonatomic, strong) NSMutableString *xmlChars;
-@property (nonatomic, strong) NSString *status;
-
-- (void)initParserWithData: (NSData*)data;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLCommentsParser.m b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLCommentsParser.m
deleted file mode 100755
index 8c32a8ed4..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLCommentsParser.m
+++ /dev/null
@@ -1,119 +0,0 @@
-//
-// NCXMLCommentsParser.m
-// Nextcloud
-//
-// Created by Marino Faggiana on 08/08/19.
-// Copyright © 2018 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "NCXMLCommentsParser.h"
-
-@implementation NCXMLCommentsParser
-
-- (void)initParserWithData: (NSData*)data{
-
- self.list = [NSMutableArray new];
-
- NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
- [parser setDelegate:self];
- [parser parse];
-}
-
-#pragma mark - XML Parser Delegate Methods
-
-- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
-
- if (!self.xmlChars) {
- self.xmlChars = [NSMutableString string];
- }
-
- [self.xmlChars setString:@""];
-}
-
-- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
-
- if ([elementName isEqualToString:@"d:href"]) {
-
- self.currentComment = [NCComments new];
-
- } else if ([elementName isEqualToString:@"oc:id"]) {
-
- self.currentComment.messageID = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:verb"]) {
-
- self.currentComment.verb = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:actorType"]) {
-
- self.currentComment.actorType = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:actorId"]) {
-
- self.currentComment.actorId = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:creationDateTime"]) {
-
- if ([self.xmlChars length]) {
- NSDateFormatter *dateFormatter = [NSDateFormatter new];
- [dateFormatter setDateFormat:@"EEE, dd MMM y HH:mm:ss zzz"];
- [dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];
- self.currentComment.creationDateTime = [dateFormatter dateFromString:[NSString stringWithString:self.xmlChars]];
- }
-
- } else if ([elementName isEqualToString:@"oc:objectType"]) {
-
- self.currentComment.objectType = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:objectId"]) {
-
- self.currentComment.objectId = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:isUnread"]) {
-
- self.currentComment.isUnread = [self.xmlChars boolValue];
-
- } else if ([elementName isEqualToString:@"oc:message"]) {
-
- self.currentComment.message = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:actorDisplayName"]) {
-
- self.currentComment.actorDisplayName = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"d:status"]) {
-
- self.status = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"d:response"]) {
-
- if ([self.status containsString:@"200"]) {
- [self.list addObject:self.currentComment];
- }
- }
-}
-
-- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
- [self.xmlChars appendString:string];
-}
-
-- (void)parserDidEndDocument:(NSXMLParser *)parser {
- NSLog(@"Finish xml comments parse");
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLGetAppPasswordParser.h b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLGetAppPasswordParser.h
deleted file mode 100755
index fa4d847a3..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLGetAppPasswordParser.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// NCXMLGetAppPasswordParser.h
-// Nextcloud
-//
-// Created by Marino Faggiana on 18/09/19.
-// Copyright © 2018 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface NCXMLGetAppPasswordParser : NSObject <NSXMLParserDelegate>
-
-@property (nonatomic, strong) NSMutableArray *list;
-
-@property (nonatomic, strong) NSMutableString *xmlChars;
-@property (nonatomic, strong) NSString *status;
-@property (nonatomic, strong) NSString *token;
-
-- (void)initParserWithData: (NSData *)data;
-
-@end
-
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLGetAppPasswordParser.m b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLGetAppPasswordParser.m
deleted file mode 100755
index 10b577582..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLGetAppPasswordParser.m
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// NCXMLGetAppPasswordParser.m
-// Nextcloud
-//
-// Created by Marino Faggiana on 18/09/19.
-// Copyright © 2018 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "NCXMLGetAppPasswordParser.h"
-
-@implementation NCXMLGetAppPasswordParser
-
-- (void)initParserWithData: (NSData*)data{
-
- NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
- [parser setDelegate:self];
- [parser parse];
-}
-
-#pragma mark - XML Parser Delegate Methods
-
-- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
-
- if (!self.xmlChars) {
- self.xmlChars = [NSMutableString string];
- }
-
- [self.xmlChars setString:@""];
-}
-
-- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
-
- if ([elementName isEqualToString:@"apppassword"]) {
- self.token = [NSString stringWithString:self.xmlChars];
- }
-}
-
-- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
- [self.xmlChars appendString:string];
-}
-
-- (void)parserDidEndDocument:(NSXMLParser *)parser {
- NSLog(@"Finish xml comments parse");
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLListParser.h b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLListParser.h
deleted file mode 100755
index 6d8559d90..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLListParser.h
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// NCXMLListParser.h
-// Nextcloud
-//
-// Created by Marino Faggiana on 17/08/19.
-// Copyright © 2018 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import <Foundation/Foundation.h>
-#import "OCFileDto.h"
-
-@interface NCXMLListParser : NSObject <NSXMLParserDelegate> {
-
- BOOL isNotFirstFileOfList;
-}
-
-@property BOOL controlFirstFileOfList;
-
-@property (nonatomic, strong) NSMutableArray *list;
-@property (nonatomic, strong) OCFileDto *currentFile;
-
-@property (nonatomic, strong) NSMutableString *xmlChars;
-@property (nonatomic, strong) NSString *status;
-
-- (void)initParserWithData:(NSData *)data controlFirstFileOfList:(BOOL)controlFirstFileOfList;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLListParser.m b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLListParser.m
deleted file mode 100755
index 9bd91cbfa..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/NCXMLListParser.m
+++ /dev/null
@@ -1,229 +0,0 @@
-//
-// NCXMLListParser.m
-// Nextcloud
-//
-// Created by Marino Faggiana on 17/08/19.
-// Copyright © 2018 Marino Faggiana. All rights reserved.
-//
-// Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#import "NCXMLListParser.h"
-
-@implementation NCXMLListParser
-
-- (void)initParserWithData:(NSData *)data controlFirstFileOfList:(BOOL)controlFirstFileOfList {
-
- self.list = [NSMutableArray new];
- self.controlFirstFileOfList = controlFirstFileOfList;
-
- NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
- [parser setDelegate:self];
- [parser parse];
-}
-
-#pragma mark - XML Parser Delegate Methods
-
-- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
-
- if (!self.xmlChars) {
- self.xmlChars = [NSMutableString string];
- }
-
- [self.xmlChars setString:@""];
-}
-
-- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
-
- if ([elementName isEqualToString:@"d:href"]) {
-
- if ([self.xmlChars hasPrefix:@"http"]) {
- NSURL *junk = [NSURL URLWithString:self.xmlChars];
- BOOL trailingSlash = [_xmlChars hasSuffix:@"/"];
- [self.xmlChars setString:[junk path]];
- if (trailingSlash) {
- [self.xmlChars appendString:@"/"];
- }
- }
-
- if ([self.xmlChars length]) {
-
- self.xmlChars = (NSMutableString *)[_xmlChars stringByReplacingOccurrencesOfString:@"//" withString:@"/"];
-
- //Create FileDto
- self.currentFile = [OCFileDto new];
- self.currentFile.isDirectory = NO;
-
- NSArray *splitedUrl = [self.xmlChars componentsSeparatedByString:@"/"];
- if([self.xmlChars hasSuffix:@"/"]) {
- //It's a folder
- NSInteger fileNameLenght = [((NSString *)[splitedUrl objectAtIndex:[splitedUrl count]-2]) length];
- if ( fileNameLenght > 0) {
- self.currentFile.filePath = [self.xmlChars substringToIndex:[self.xmlChars length] - (fileNameLenght+1)];
- } else {
- self.currentFile.filePath = @"/";
- }
- } else {
- //It's a file
- NSInteger fileNameLenght = [((NSString *)[splitedUrl objectAtIndex:[splitedUrl count]-1]) length];
- if (fileNameLenght > 0) {
- self.currentFile.filePath = [self.xmlChars substringToIndex:[self.xmlChars length] - fileNameLenght];
- }else {
- self.currentFile.filePath = @"/";
- }
- }
-
- NSArray *foo = [self.xmlChars componentsSeparatedByString: @"/"];
- NSString *lastBit;
-
- if([self.xmlChars hasSuffix:@"/"]) {
- lastBit = [foo objectAtIndex: [foo count]-2];
- lastBit = [NSString stringWithFormat:@"%@/",lastBit];
- } else {
- lastBit = [foo objectAtIndex: [foo count]-1];
- }
-
- if (self.controlFirstFileOfList) {
- if (isNotFirstFileOfList) {
- self.currentFile.fileName = lastBit;
- }
- } else {
- self.currentFile.fileName = lastBit;
- }
-
- self.currentFile.fileName = [self.currentFile.fileName stringByRemovingPercentEncoding];
- self.currentFile.filePath = [self.currentFile.filePath stringByRemovingPercentEncoding];
-
- isNotFirstFileOfList = true;
- }
-
- } else if ([elementName isEqualToString:@"d:displayname"] && [self.xmlChars length]) {
-
- self.currentFile.displayName = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"d:getcontenttype"] && [self.xmlChars length]) {
-
- self.currentFile.contentType = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"d:resourcetype"] && [self.xmlChars length]) {
-
- self.currentFile.resourceType = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"d:getcontentlength"] && [self.xmlChars length]) {
-
- self.currentFile.size = (long)[self.xmlChars longLongValue];
-
- } else if ([elementName isEqualToString:@"d:getlastmodified"] && [self.xmlChars length]) {
-
- NSDateFormatter *dateFormatter = [NSDateFormatter new];
- [dateFormatter setDateFormat:@"EEE, dd MMM y HH:mm:ss zzz"];
- [dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];
- NSDate *date = [dateFormatter dateFromString:[NSString stringWithString:self.xmlChars]];
- if (date) {
- self.currentFile.date = [date timeIntervalSince1970];
- }
-
- } else if ([elementName isEqualToString:@"d:creationdate"] && [self.xmlChars length]) {
-
- NSLog(@"Not yet implemented");
-
- } else if ([elementName isEqualToString:@"d:getetag"] && [self.xmlChars length]) {
-
- self.currentFile.etag = [[self.xmlChars stringByReplacingOccurrencesOfString:@"\"" withString:@""] lowercaseString];
-
- } else if ([elementName isEqualToString:@"d:quota-used-bytes"] && [self.xmlChars length]) {
-
- self.currentFile.quotaUsedBytes = (long)[self.xmlChars longLongValue];
-
- } else if ([elementName isEqualToString:@"d:quota-available-bytes"] && [self.xmlChars length]) {
-
- self.currentFile.quotaAvailableBytes = (long)[self.xmlChars longLongValue];
-
- } else if ([elementName isEqualToString:@"oc:permissions"] && [self.xmlChars length]) {
-
- self.currentFile.permissions = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:id"] && [self.xmlChars length]) {
-
- self.currentFile.ocId = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:fileid"] && [self.xmlChars length]) {
-
- self.currentFile.fileId = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:size"] && [self.xmlChars length]) {
-
- self.currentFile.size = (long)[self.xmlChars longLongValue];
-
- } else if ([elementName isEqualToString:@"oc:favorite"] && [self.xmlChars length]) {
-
- self.currentFile.isFavorite = [self.xmlChars boolValue];
-
- } else if ([elementName isEqualToString:@"nc:is-encrypted"] && [self.xmlChars length]) {
-
- self.currentFile.isEncrypted = [self.xmlChars boolValue];
-
- } else if ([elementName isEqualToString:@"nc:mount-type"] && [self.xmlChars length]) {
-
- self.currentFile.mountType = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:owner-id"] && [self.xmlChars length]) {
-
- self.currentFile.ownerId = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:owner-display-name"] && [self.xmlChars length]) {
-
- self.currentFile.ownerDisplayName = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"oc:comments-unread"] && [self.xmlChars length]) {
-
- self.currentFile.commentsUnread = [self.xmlChars boolValue];
-
- } else if ([elementName isEqualToString:@"nc:has-preview"] && [self.xmlChars length]) {
-
- self.currentFile.hasPreview = [self.xmlChars boolValue];
-
- } else if ([elementName isEqualToString:@"nc:trashbin-filename"] && [self.xmlChars length]) {
-
- self.currentFile.trashbinFileName = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"nc:trashbin-original-location"] && [self.xmlChars length]) {
-
- self.currentFile.trashbinOriginalLocation = [NSString stringWithString:self.xmlChars];
-
- } else if ([elementName isEqualToString:@"nc:trashbin-deletion-time"] && [self.xmlChars length]) {
-
- self.currentFile.trashbinDeletionTime = (long)[self.xmlChars longLongValue];
-
- } else if ([elementName isEqualToString:@"d:collection"]) {
-
- self.currentFile.isDirectory = true;
-
- } else if ([elementName isEqualToString:@"d:response"]) {
-
- [self.list addObject:self.currentFile];
- }
-}
-
-- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
- [self.xmlChars appendString:string];
-}
-
-- (void)parserDidEndDocument:(NSXMLParser *)parser {
- NSLog(@"Finish xml list parse");
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLServerErrorsParser.h b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLServerErrorsParser.h
deleted file mode 100755
index 585ed1661..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLServerErrorsParser.h
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// OCXMLServerErrorsParser.h
-// ownCloud iOS library
-//
-// Created by Gonzalo González on 1/6/15.
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#import <Foundation/Foundation.h>
-
-typedef void(^OCServerErrorFinishBlock)(NSError *error);
-
-
-@interface OCXMLServerErrorsParser : NSObject <NSXMLParserDelegate>
-
-@property (nonatomic, strong) NSString *xmlString;
-@property (nonatomic, strong) NSMutableDictionary *resultDict;
-
-@property (nonatomic, strong) NSString *exception;
-@property (nonatomic, strong) NSString *message;
-
-
-@property (nonatomic, copy) OCServerErrorFinishBlock finishBlock;
-
-
-- (void) startToParseWithData:(NSData *)data withCompleteBlock: (void(^)(NSError *error)) completeBlock;
-
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLServerErrorsParser.m b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLServerErrorsParser.m
deleted file mode 100755
index 0b927c10b..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLServerErrorsParser.m
+++ /dev/null
@@ -1,137 +0,0 @@
-//
-// OCXMLServerErrorsParser.m
-// ownCloud iOS library
-//
-// Created by Gonzalo González on 1/6/15.
-//
-
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#import "OCXMLServerErrorsParser.h"
-#import "UtilsFramework.h"
-#import "OCErrorMsg.h"
-
-#define k_excepcion_element @"s:exception"
-#define k_message_element @"s:message"
-
-#define k_forbidden_character_error @"InvalidPath"
-
-NSString *OCErrorException = @"oc_exception";
-NSString *OCErrorMessage = @"oc_message";
-
-
-@implementation OCXMLServerErrorsParser
-
-
-- (void) startToParseWithData:(NSData *)data withCompleteBlock: (void(^)(NSError *error)) completeBlock{
-
- self.finishBlock = ^(NSError *err) {
-
- completeBlock(err);
- };
-
- if (!data) {
- NSError *error = nil;
-
- self.finishBlock(error);
- }else{
- NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
- [parser setDelegate:self];
- [parser parse];
-
- if (self.resultDict.count == 0) {
- NSError *error = nil;
- self.finishBlock(error);
- }
- }
-
-
-}
-
-
-#pragma mark - XML Parser Delegate Methods
-
-- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
-
- if (!self.xmlString) {
- self.xmlString = [NSMutableString string];
- }
-
- // NSLog(@"xml String: %@", self.xmlString);
-
- if (!self.resultDict) {
- self.resultDict = [NSMutableDictionary dictionary];
- }
-
-}
-
-- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
-
- // NSLog(@"elementName: %@:%@", elementName,self.xmlString);
-
- if ([elementName isEqualToString:k_excepcion_element]) {
-
- if (self.xmlString) {
- //Get the lastObject where is the exception name
- NSArray *splitedUrl = [self.xmlString componentsSeparatedByString:@"\\"];
- [self.resultDict setObject:[splitedUrl lastObject] forKey:OCErrorException];
- }
- }
-
- if ([elementName isEqualToString:k_message_element]) {
-
- if (self.xmlString) {
- [self.resultDict setObject:self.xmlString forKey:OCErrorMessage];
- }
- }
-
-
-}
-
-- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
- self.xmlString = string;
-}
-
-- (void)parserDidEndDocument:(NSXMLParser *)parser{
-
- // NSLog(@"Finish: %@", self.resultDict);
-
- [self checkTheResultLookingForErrors];
-
-}
-
-//Method that check the ressult in order to find server errors
-
-- (void) checkTheResultLookingForErrors{
-
- NSError *error = nil;
-
- if ([[self.resultDict objectForKey:OCErrorException] isEqualToString:k_forbidden_character_error]) {
- error = [UtilsFramework getErrorByCodeId:OCServerErrorForbiddenCharacters];
- }
-
- self.finishBlock(error);
-
-}
-
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLShareByLinkParser.h b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLShareByLinkParser.h
deleted file mode 100755
index bcbe70ccc..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLShareByLinkParser.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// OCXMLShareByLinkParser.h
-// OCCommunicationLib
-//
-// Created by Javier González on 1/13/14.
-
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface OCXMLShareByLinkParser : NSObject <NSXMLParserDelegate>
-
-@property (nonatomic, strong) NSString *token;
-@property (nonatomic, strong) NSString *message;
-@property (nonatomic, strong) NSString *url;
-@property (nonatomic) NSInteger statusCode;
-
-- (void)initParserWithData: (NSData*)data;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLShareByLinkParser.m b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLShareByLinkParser.m
deleted file mode 100755
index dbf3e6ca8..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLShareByLinkParser.m
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// OCXMLShareByLinkParser.m
-// OCCommunicationLib
-//
-// Created by Javier González on 1/13/14.
-// Copyright (c) 2014 ownCloud. All rights reserved.
-//
-
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#import "OCXMLShareByLinkParser.h"
-
-@interface OCXMLShareByLinkParser()
-
-@property (nonatomic, strong) NSMutableString *xmlChars;
-@property (nonatomic, strong) NSMutableDictionary *xmlBucket;
-
-@end
-
-@implementation OCXMLShareByLinkParser
-
-/*
- * Method that init the parse with the xml data from the server
- * @data -> XML webDav data from the owncloud server
- */
-- (void)initParserWithData: (NSData*)data{
-
- NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
- [parser setDelegate:self];
- [parser parse];
-
-}
-
-
-#pragma mark - XML Parser Delegate Methods
-
-
-/*
- * Method that init parse process.
- */
-
-- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
-
- if (!self.xmlChars) {
- self.xmlChars = [NSMutableString string];
- }
-
- [self.xmlChars setString:@""];
-
- if ([elementName isEqualToString:@"ocs"]) {
- self.xmlBucket = [NSMutableDictionary dictionary];
- }
-}
-
-- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
-
- if ([elementName isEqualToString:@"statuscode"]) {
- self.statusCode = [self.xmlChars intValue];
- }
-
- if ([elementName isEqualToString:@"token"]) {
- self.token = [NSString stringWithString:self.xmlChars];
- }
-
- if ([elementName isEqualToString:@"message"]) {
- self.message = [NSString stringWithString:self.xmlChars];
- }
-
- if ([elementName isEqualToString:@"url"]) {
- self.url = [NSString stringWithString:self.xmlChars];
- }
-}
-
-- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
- [self.xmlChars appendString:string];
-}
-
-- (void)parserDidEndDocument:(NSXMLParser *)parser{
- NSLog(@"Finish xml shareBylink parse");
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLSharedParser.h b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLSharedParser.h
deleted file mode 100755
index b80a71e1b..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLSharedParser.h
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// OCXMLSharedParser.h
-// OCCommunicationLib
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-#import <Foundation/Foundation.h>
-#import "OCSharedDto.h"
-
-@interface OCXMLSharedParser : NSObject <NSXMLParserDelegate> {
-
- NSMutableString *_xmlChars;
- NSMutableDictionary *_xmlBucket;
- NSMutableArray *_shareList;
- OCSharedDto *_currentShared;
- BOOL isNotFirstFileOfList;
-
-}
-
-@property(nonatomic,strong) NSMutableArray *shareList;
-@property(nonatomic,strong) OCSharedDto *currentShared;
-
-- (void)initParserWithData: (NSData*)data;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLSharedParser.m b/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLSharedParser.m
deleted file mode 100755
index 1223b9a9b..000000000
--- a/Libraries external/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLSharedParser.m
+++ /dev/null
@@ -1,247 +0,0 @@
-//
-// OCXMLSharedParser.m
-// OCCommunicationLib
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-#import "OCXMLSharedParser.h"
-#import "OCSharedDto.h"
-
-#define expirationDateFormat @"YYYY-MM-dd HH:mm:ss"
-
-@implementation OCXMLSharedParser
-
-@synthesize shareList=_shareList;
-@synthesize currentShared=_currentShared;
-
-/*
- * Method that init the parse with the xml data from the server
- * @data -> XML webDav data from the owncloud server
- */
-- (void)initParserWithData: (NSData*)data{
-
- _shareList = [[NSMutableArray alloc]init];
-
- NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
- [parser setDelegate:self];
- [parser parse];
-
-}
-
-
-#pragma mark - XML Parser Delegate Methods
-
-
-/*
- * Method that init parse process.
- */
-
-- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
-
- if (!_xmlChars) {
- _xmlChars = [NSMutableString string];
- }
-
- //NSLog(@"_xmlChars: %@", _xmlChars);
-
- [_xmlChars setString:@""];
-
- if ([elementName isEqualToString:@"element"]) {
- _xmlBucket = [NSMutableDictionary dictionary];
-
- if (_currentShared) {
- [_shareList addObject:_currentShared];
- }
- }
-}
-
-/*
- * Util method to make a NSDate object from a string from xml
- * @dateString -> Data string from xml
- */
-
-+ (NSDate*)parseDateString:(NSString*)dateString {
- //Parse the date in all the formats
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
- /*In most cases the best locale to choose is "en_US_POSIX", a locale that's specifically designed to yield US English results regardless of both user and system preferences. "en_US_POSIX" is also invariant in time (if the US, at some point in the future, changes the way it formats dates, "en_US" will change to reflect the new behaviour, but "en_US_POSIX" will not). It will behave consistently for all users.*/
- [dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];
- [dateFormatter setDateFormat:expirationDateFormat];
-
- NSDate *theDate = nil;
- NSError *error = nil;
- if (![dateFormatter getObjectValue:&theDate forString:dateString range:nil error:&error]) {
- NSLog(@"Date '%@' could not be parsed: %@", dateString, error);
- }
-
- return theDate;
-}
-
-
-- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
-
- //NSLog(@"elementName: %@:%@", elementName,_xmlChars);
-
- if ([elementName isEqualToString:@"id"]) {
-
- _currentShared = [[OCSharedDto alloc] init];
- _currentShared.idRemoteShared = [_xmlChars intValue];
-
- } else if ([elementName isEqualToString:@"item_type"]) {
-
- if([_xmlChars isEqualToString:@"file"]) {
- _currentShared.isDirectory = NO;
- } else {
- _currentShared.isDirectory = YES;
- if (_currentShared.path) {
- _currentShared.path = [_currentShared.path stringByAppendingString:@"/"];
- }
- }
- } else if ([elementName isEqualToString:@"item_source"]) {
-
- _currentShared.itemSource = [_xmlChars intValue];
-
- } else if ([elementName isEqualToString:@"parent"]) {
-
- _currentShared.parent = [_xmlChars intValue];
-
- } else if ([elementName isEqualToString:@"share_type"]) {
-
- _currentShared.shareType = [_xmlChars intValue];
-
- } else if ([elementName isEqualToString:@"share_with"]) {
-
- _currentShared.shareWith = _xmlChars;
-
- } else if ([elementName isEqualToString:@"file_source"]) {
-
- _currentShared.fileSource = [_xmlChars intValue];
-
- } else if ([elementName isEqualToString:@"path"]) {
-
- if (_currentShared.isDirectory) {
- _currentShared.path = [_xmlChars stringByAppendingString:@"/"];
- } else {
- _currentShared.path = _xmlChars;
- }
-
- } else if ([elementName isEqualToString:@"permissions"]) {
-
- _currentShared.permissions = [_xmlChars intValue];
-
- } else if ([elementName isEqualToString:@"stime"]) {
-
- _currentShared.sharedDate = (long)[_xmlChars longLongValue];
-
-
- } else if ([elementName isEqualToString:@"expiration"]) {
-
- //Check expiration, is a optional field, sometimes is empty
- if (![_xmlChars isEqualToString:@""]) {
- NSDate *date = [[self class] parseDateString:_xmlChars];
- _currentShared.expirationDate = [date timeIntervalSince1970];
- }else{
- _currentShared.expirationDate = 0.0;
- }
-
- } else if ([elementName isEqualToString:@"token"]) {
-
- _currentShared.token = _xmlChars;
-
- } else if ([elementName isEqualToString:@"storage"]) {
-
- _currentShared.storage = [_xmlChars intValue];
-
- } else if ([elementName isEqualToString:@"mail_send"]) {
-
- _currentShared.mailSend = [_xmlChars intValue];
-
- } else if ([elementName isEqualToString:@"uid_owner"]) {
-
- _currentShared.uidOwner = _xmlChars;
-
- } else if ([elementName isEqualToString:@"uid_file_owner"]) {
-
- _currentShared.uidFileOwner = _xmlChars;
-
- } else if ([elementName isEqualToString:@"share_with_displayname"]) {
-
- _currentShared.shareWithDisplayName = _xmlChars;
-
- } else if ([elementName isEqualToString:@"displayname_owner"]) {
-
- _currentShared.displayNameOwner = _xmlChars;
-
- //Last value on the XML so we add the object to the array and begin again
- if (!_currentShared.shareWithDisplayName) {
- //To not have a nil we set an empty string
- _currentShared.shareWithDisplayName = @"";
- }
-
- } else if ([elementName isEqualToString:@"hide_download"]) {
-
- _currentShared.hideDownload = [_xmlChars boolValue];
-
- } else if ([elementName isEqualToString:@"note"]) {
-
- _currentShared.note = _xmlChars;
-
- } else if ([elementName isEqualToString:@"label"]) {
-
- _currentShared.label = _xmlChars;
-
- } else if ([elementName isEqualToString:@"displayname_file_owner"]) {
-
- _currentShared.displayNameFileOwner = _xmlChars;
-
- } else if ([elementName isEqualToString:@"url"]) {
-
- _currentShared.url = _xmlChars;
-
- } else if ([elementName isEqualToString:@"mimetype"]) {
-
- _currentShared.mimeType = _xmlChars;
-
- } else if ([elementName isEqualToString:@"storage_id"]) {
-
- _currentShared.storageID = _xmlChars;
-
- } else if ([elementName isEqualToString:@"file_parent"]) {
-
- _currentShared.fileParent = _xmlChars;
-
- } else if ([elementName isEqualToString:@"file_target"]) {
-
- _currentShared.fileTarget = _xmlChars;
- }
-}
-
-- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
- [_xmlChars appendString:string];
-}
-
-- (void)parserDidEndDocument:(NSXMLParser *)parser{
- NSLog(@"Finish xml shared parse");
- if (_currentShared) {
- [_shareList addObject:_currentShared];
- }
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/Utils/NSString+Encode.h b/Libraries external/OCCommunicationLib/Utils/NSString+Encode.h
deleted file mode 100755
index a59a70817..000000000
--- a/Libraries external/OCCommunicationLib/Utils/NSString+Encode.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// NSString+Encode.h
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-#import <Foundation/Foundation.h>
-
-@interface NSString (encode)
-- (NSString *)encodeString:(NSStringEncoding)encoding;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/Utils/NSString+Encode.m b/Libraries external/OCCommunicationLib/Utils/NSString+Encode.m
deleted file mode 100755
index 0cae1d75a..000000000
--- a/Libraries external/OCCommunicationLib/Utils/NSString+Encode.m
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// NSString+Encode.m
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-#import "NSString+Encode.h"
-
-@implementation NSString (encode)
-- (NSString *)encodeString:(NSStringEncoding)encoding
-{
-
- CFStringRef stringRef = CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)self,
- NULL, (CFStringRef)@";?@&=$+{}<>,!'*",
- CFStringConvertNSStringEncodingToEncoding(encoding));
-
- NSString *output = (NSString *)CFBridgingRelease(stringRef);
-
-
-
-
- int countCharactersAfterPercent = -1;
-
- for(int i = 0 ; i < [output length] ; i++) {
- NSString * newString = [output substringWithRange:NSMakeRange(i, 1)];
- //NSLog(@"newString: %@", newString);
-
- if(countCharactersAfterPercent>=0) {
-
- //NSLog(@"newString lowercaseString: %@", [newString lowercaseString]);
- output = [output stringByReplacingCharactersInRange:NSMakeRange(i, 1) withString:[newString lowercaseString]];
- countCharactersAfterPercent++;
- }
-
- if([newString isEqualToString:@"%"]) {
- countCharactersAfterPercent = 0;
- }
-
- if(countCharactersAfterPercent==2) {
- countCharactersAfterPercent = -1;
- }
- }
-
- // NSLog(@"output: %@", output);
-
- return output;
-}
-
-@end
diff --git a/Libraries external/OCCommunicationLib/Utils/OCConstants.h b/Libraries external/OCCommunicationLib/Utils/OCConstants.h
deleted file mode 100755
index d340d8659..000000000
--- a/Libraries external/OCCommunicationLib/Utils/OCConstants.h
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// OCConstants.h
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#define k_redirected_code_1 301
-#define k_redirected_code_2 302
-#define k_redirected_code_3 307
-
-//The result of the sum of those values means the permissions that have a share file
-//permissions - (int) 1 = read; 2 = update; 4 = create; 8 = delete; 16 = share; 31 = all (default: 31, for public shares: 1)
-#define k_read_share_permission 1
-#define k_update_share_permission 2
-#define k_create_share_permission 4
-#define k_delete_share_permission 8
-#define k_share_share_permission 16
-
-#define k_min_file_share_permission 1
-#define k_max_file_share_permission 19
-#define k_min_folder_share_permission 1
-#define k_max_folder_share_permission 31
-#define k_default_file_remote_share_permission_no_support_share_option 3
-#define k_default_folder_remote_share_permission_no_support_share_option 15
-
-#define k_max_redirections_allow 5
diff --git a/Libraries external/OCCommunicationLib/Utils/UtilsFramework.h b/Libraries external/OCCommunicationLib/Utils/UtilsFramework.h
deleted file mode 100755
index 216132b8c..000000000
--- a/Libraries external/OCCommunicationLib/Utils/UtilsFramework.h
+++ /dev/null
@@ -1,318 +0,0 @@
-//
-// UtilsFramework.h
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface UtilsFramework : NSObject
-
-
-/*
- * Method that return a unique Id.
- * The global ID for the process includes the host name, process ID, and a time stamp,
- * which ensures that the ID is unique for the network
- * @return -> Unique Id (token)
- */
-+ (NSString *) getUserSessionToken;
-
-
-/*
- * Method that check the file name or folder name to find forbidden characters
- * This is the forbidden characters in server: "\", "/","<",">",":",""","|","?","*"
- * @fileName -> file name
- *
- * @isFCSupported -> From ownCloud 8.1 the forbidden characters are controller by the server except the '/'
- */
-+ (BOOL) isForbiddenCharactersInFileName:(NSString*)fileName withForbiddenCharactersSupported:(BOOL)isFCSupported;
-
-/*
- * Get error code with the errorCode and message of the server
- *
- */
-
-+ (NSError *) getErrorWithCode:(NSInteger)errorCode andCustomMessageFromTheServer:(NSString *)message;
-
-
-/*
- * Get error for the same errors in the share api
- *
- * Statuscodes:
- * 100 - successful
- * 400 - wrong or no update parameter given
- * 403 - public upload disabled by the admin
- * 404 - couldn’t update share
- *
- */
-
-+ (NSError *) getShareAPIErrorByCode:(NSInteger)errorCode;
-
-///-----------------------------------
-/// @name getErrorByCodeId
-///-----------------------------------
-
-/**
- * Method to return a NSError based on the Error Code Enum
- *
- * @param int errorCode to Enum to identify the error code
- *
- * @return NSError
- */
-+ (NSError *) getErrorByCodeId:(int) errorCode;
-
-///-----------------------------------
-/// @name getFileNameOrFolderByPath
-///-----------------------------------
-
-/**
- * Method that return a filename from a path
- *
- * @param NSString -> path of the file (including the file)
- *
- * @return NSString -> fileName
- *
- */
-+ (NSString *) getFileNameOrFolderByPath:(NSString *) path;
-
-/*
- * Method that return a boolean that indicate if is the same url
- */
-+ (BOOL) isTheSameFileOrFolderByNewURLString:(NSString *) newURLString andOriginURLString:(NSString *) originalURLString;
-
-/*
- * Method that return a boolean that indicate if newUrl is under the original Url
- */
-+ (BOOL) isAFolderUnderItByNewURLString:(NSString *) newURLString andOriginURLString:(NSString *) originalURLString;
-
-/**
- * Method to return the size of a file by a path
- *
- * @param NSString -> path of the file
- *
- * @return long long -> size of the file in the path
- */
-+ (long long) getSizeInBytesByPath:(NSString *) path;
-
-
-///-----------------------------------
-/// @name isURLWithSamlFragment:
-///-----------------------------------
-
-/**
- * Method to check a url string to looking for a SAML fragment
- *
- * @param urlString -> url from redirect server
- *
- * @return BOOL -> the result about if exist the SAML fragment or not
- */
-+ (BOOL) isURLWithSamlFragment:(NSString*)urlString;
-
-///-----------------------------------
-/// @name AFBase64EncodedStringFromString:
-///-----------------------------------
-
-/**
- * Method encode a string to base64 in order to set the credentials
- *
- * @param string -> string to be encoding
- *
- * @return NSString -> the result of the encoded string
- */
-+ (NSString *) AFBase64EncodedStringFromString:(NSString *) string;
-
-//-----------------------------------
-/// @name addCookiesToStorageFromResponse
-///-----------------------------------
-
-#pragma mark - Manage Cookies
-
-/**
- * Method to storage all the cookies from a response in order to use them in future requests
- *
- * @param NSHTTPURLResponse -> response
- * @param NSURL -> url
- *
- */
-+ (void) addCookiesToStorageFromResponse: (NSURLResponse *) response andPath:(NSURL *) url;
-//-----------------------------------
-/// @name getRequestWithCookiesByRequest
-///-----------------------------------
-
-/**
- * Method to return a request with all the necessary cookies of the original url without redirection
- *
- * @param NSMutableURLRequest -> request
- * @param NSString -> originalUrlServer
- *
- * @return request
- *
- */
-+ (NSMutableURLRequest *) getRequestWithCookiesByRequest: (NSMutableURLRequest *) request andOriginalUrlServer:(NSString *) originalUrlServer;
-
-//-----------------------------------
-/// @name deleteAllCookies
-///-----------------------------------
-
-/**
- * Method to clean the CookiesStorage
- *
- */
-+ (void) deleteAllCookies;
-
-//-----------------------------------
-/// @name isServerVersionHigherThanLimitVersion
-///-----------------------------------
-
-/**
- * Method to detect if a server version is higher than a limit version.
- * This method is used for example to know if the server have share API or support Cookies
- *
- * @param NSString -> serverVersion
- * @param NSArray -> limitVersion
- *
- * @return BOOL
- *
- */
-+ (BOOL) isServerVersion:(NSString *) serverVersionString higherThanLimitVersion:(NSArray *) limitVersion;
-
-//-----------------------------------
-/// @name getPermissionsValueByCanCreate
-///-----------------------------------
-
-/**
- * Method know the value of the permissions of a share file or folder.
- * This method is used to calculate the value of a permission parameter to share a file or document
- *
- * @param BOOL -> canEdit
- * @param BOOL -> canCreate
- * @param BOOL -> canChange
- * @param BOOL -> canDelete
- * @param BOOL -> canShare
- * @param BOOL -> isFolder
- *
- * @return NSInteger
- *
- */
-+ (NSInteger) getPermissionsValueByCanEdit:(BOOL)canEdit andCanCreate:(BOOL)canCreate andCanChange:(BOOL)canChange andCanDelete:(BOOL)canDelete andCanShare:(BOOL)canShare andIsFolder:(BOOL) isFolder;
-
-
-//-----------------------------------
-/// @name isPermissionToCanCreate
-///-----------------------------------
-
-/**
- * Method know if we have permission to create by the permissionValue of the OCShareDto
- *
- * @param NSInteger -> permissionValue
- *
- * @return BOOL
- *
- */
-+ (BOOL) isPermissionToCanCreate:(NSInteger) permissionValue;
-
-//-----------------------------------
-/// @name isPermissionToCanChange
-///-----------------------------------
-
-/**
- * Method know if we have permission to Change by the permissionValue of the OCShareDto
- *
- * @param NSInteger -> permissionValue
- *
- * @return BOOL
- *
- */
-+ (BOOL) isPermissionToCanChange:(NSInteger) permissionValue;
-
-//-----------------------------------
-/// @name isPermissionToCanDelete
-///-----------------------------------
-
-/**
- * Method know if we have permission to Delete by the permissionValue of the OCShareDto
- *
- * @param NSInteger -> permissionValue
- *
- * @return BOOL
- *
- */
-+ (BOOL) isPermissionToCanDelete:(NSInteger) permissionValue;
-
-//-----------------------------------
-/// @name isPermissionToCanShare
-///-----------------------------------
-
-/**
- * Method know if we have permission to Share by the permissionValue of the OCShareDto
- *
- * @param NSInteger -> permissionValue
- *
- * @return BOOL
- *
- */
-+ (BOOL) isPermissionToCanShare:(NSInteger) permissionValue;
-
-//-----------------------------------
-/// @name isAnyPermissionToEdit
-///-----------------------------------
-
-/**
- * Method to know if any permission related to edit (canCreate, canChange and canDelete) is active by the permissionValue of the OCShareDto
- *
- * @param NSInteger -> permissionValue
- *
- * @return BOOL
- *
- */
-+ (BOOL) isAnyPermissionToEdit:(NSInteger) permissionValue;
-
-//-----------------------------------
-/// @name isPermissionToRead
-///-----------------------------------
-
-/**
- * Method to know if we have permission to Read by the permissionValue of the OCShareDto
- *
- * @param NSInteger -> permissionValue
- *
- * @return BOOL
- *
- */
-
-+ (BOOL) isPermissionToRead:(NSInteger) permissionValue;
-
-//---------------------------------------------------
-/// @name isPermissionToReadCreateUpdate
-///--------------------------------------------------
-
-/**
- * Method to know if we have permissions to read,create and update by the permissionValue of the OCShareDto
- *
- * @param NSInteger -> permissionValue
- *
- * @return BOOL
- *
- */
-+ (BOOL) isPermissionToReadCreateUpdate:(NSInteger) permissionValue;
-
-@end
diff --git a/Libraries external/OCCommunicationLib/Utils/UtilsFramework.m b/Libraries external/OCCommunicationLib/Utils/UtilsFramework.m
deleted file mode 100755
index c19ab58aa..000000000
--- a/Libraries external/OCCommunicationLib/Utils/UtilsFramework.m
+++ /dev/null
@@ -1,646 +0,0 @@
-//
-// UtilsFramework.m
-// Owncloud iOs Client
-//
-// Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-
-#import "UtilsFramework.h"
-#import "OCCommunication.h"
-#import "OCFrameworkConstants.h"
-#import "OCErrorMsg.h"
-#import "OCConstants.h"
-
-#define kSAMLFragmentArray [NSArray arrayWithObjects: @"wayf", @"saml", @"sso_orig_uri", nil]
-
-@implementation UtilsFramework
-
-/*
- * Method that return a unique Id.
- * The global ID for the process includes the host name, process ID, and a time stamp,
- * which ensures that the ID is unique for the network
- * @return -> Unique Id (token)
- */
-+ (NSString *) getUserSessionToken{
-
- return [[NSProcessInfo processInfo] globallyUniqueString];
-}
-
-/*
- * Method that check the file name or folder name to find forbidden characters
- * This is the forbidden characters in server: "\", "/","<",">",":",""","|","?","*"
- * @fileName -> file name
- *
- * @isFCSupported -> From ownCloud 8.1 the forbidden characters are controller by the server except the '/'
- */
-+ (BOOL) isForbiddenCharactersInFileName:(NSString*)fileName withForbiddenCharactersSupported:(BOOL)isFCSupported{
- BOOL thereAreForbidenCharacters = NO;
-
- //Check the filename
- for(NSInteger i = 0 ;i<[fileName length]; i++) {
-
- if ([fileName characterAtIndex:i]=='/'){
- thereAreForbidenCharacters = YES;
- }
-
- if (!isFCSupported) {
-
- if ([fileName characterAtIndex:i] == '\\'){
- thereAreForbidenCharacters = YES;
- }
- if ([fileName characterAtIndex:i] == '<'){
- thereAreForbidenCharacters = YES;
- }
- if ([fileName characterAtIndex:i] == '>'){
- thereAreForbidenCharacters = YES;
- }
- if ([fileName characterAtIndex:i] == '"'){
- thereAreForbidenCharacters = YES;
- }
- if ([fileName characterAtIndex:i] == ','){
- thereAreForbidenCharacters = YES;
- }
- if ([fileName characterAtIndex:i] == ':'){
- thereAreForbidenCharacters = YES;
- }
- if ([fileName characterAtIndex:i] == '|'){
- thereAreForbidenCharacters = YES;
- }
- if ([fileName characterAtIndex:i] == '?'){
- thereAreForbidenCharacters = YES;
- }
- if ([fileName characterAtIndex:i] == '*'){
- thereAreForbidenCharacters = YES;
- }
- }
-
- }
-
- return thereAreForbidenCharacters;
-}
-
-+ (NSError *) getErrorWithCode:(NSInteger)errorCode andCustomMessageFromTheServer:(NSString *)message {
- NSError *error = nil;
-
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:message forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:errorCode userInfo:details];
-
- return error;
-}
-
-/*
- * Get error for the same errors in the share api
- *
- * Statuscodes:
- * 100 - successful
- * 400 - wrong or no update parameter given
- * 403 - public upload disabled by the admin (or is neccesary put a password)
- * 404 - couldn’t update share
- *
- */
-
-+ (NSError *) getShareAPIErrorByCode:(NSInteger)errorCode {
- NSError *error = nil;
-
- switch (errorCode) {
- case kOCErrorSharedAPIWrong:
-
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"Wrong or no update parameter given" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:kOCErrorSharedAPIWrong userInfo:details];
- break;
- }
-
- case kOCErrorServerForbidden:
-
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"Public upload disabled by the admin" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:kOCErrorServerForbidden userInfo:details];
- break;
- }
-
- case kOCErrorServerPathNotFound:
-
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"Couldn't update share" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:kOCErrorServerPathNotFound userInfo:details];
- break;
- }
-
-
- default:
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"Unknow error" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:OCErrorUnknow userInfo:details];
- break;
- }
- }
-
- return error;
-
-}
-
-///-----------------------------------
-/// @name getErrorByCodeId
-///-----------------------------------
-
-/**
- * Method to return a Error with description from a OC Error code
- *
- * @param int -> errorCode number to identify the OC Error
- *
- * @return NSError
- *
- */
-+ (NSError *) getErrorByCodeId:(int) errorCode {
- NSError *error = nil;
-
- switch (errorCode) {
- case OCErrorForbidenCharacters:
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"You have entered forbbiden characters" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:OCErrorForbidenCharacters userInfo:details];
- break;
- }
-
- case OCErrorMovingDestinyNameHaveForbiddenCharacters:
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"The file or folder that you are moving have forbidden characters" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:OCErrorMovingDestinyNameHaveForbiddenCharacters userInfo:details];
- break;
- }
-
- case OCErrorMovingTheDestinyAndOriginAreTheSame:
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"You are trying to move the file to the same folder" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:OCErrorMovingTheDestinyAndOriginAreTheSame userInfo:details];
- break;
- }
-
- case OCErrorMovingFolderInsideHimself:
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"You are trying to move a folder inside himself" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:OCErrorMovingFolderInsideHimself userInfo:details];
- break;
- }
-
- case kOCErrorServerPathNotFound:
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"You are trying to access to a file that does not exist" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:kOCErrorServerPathNotFound userInfo:details];
- break;
- }
-
- case kOCErrorServerForbidden:
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"You are trying to do a forbbiden operation" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:kOCErrorServerForbidden userInfo:details];
- break;
- }
-
- case OCServerErrorForbiddenCharacters:
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"Server said: File name contains at least one invalid character" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:OCServerErrorForbiddenCharacters userInfo:details];
- break;
- }
-
-
- default:
- {
- NSMutableDictionary* details = [NSMutableDictionary dictionary];
- [details setValue:@"Unknow error" forKey:NSLocalizedDescriptionKey];
-
- error = [NSError errorWithDomain:k_domain_error_code code:OCErrorUnknow userInfo:details];
- break;
- }
- }
-
- return error;
-}
-
-///-----------------------------------
-/// @name getFileNameOrFolderByPath
-///-----------------------------------
-
-/**
- * Method that return a filename from a path
- *
- * @param NSString -> path of the file (including the file)
- *
- * @return NSString -> fileName
- *
- */
-+ (NSString *) getFileNameOrFolderByPath:(NSString *) path {
-
- NSString *output;
-
- if (path && [path length] > 0) {
- NSArray *listItems = [path componentsSeparatedByString:@"/"];
-
- output = [listItems objectAtIndex:[listItems count]-1];
-
- if ([output length] <= 0) {
- output = [listItems objectAtIndex:[listItems count]-2];
- }
-
- //If is a folder we set the last character in order to compare folders with folders and files with files
- /*if([path hasSuffix:@"/"]) {
- output = [NSString stringWithFormat:@"%@/", output];
- }*/
- }
-
- return output;
-}
-
-/*
- * Method that return a boolean that indicate if is the same url
- */
-+ (BOOL) isTheSameFileOrFolderByNewURLString:(NSString *) newURLString andOriginURLString:(NSString *) originalURLString{
-
-
- if ([originalURLString isEqualToString:newURLString]) {
- return YES;
- }
-
- return NO;
-
-}
-
-/*
- * Method that return a boolean that indicate if newUrl is under the original Url
- */
-+ (BOOL) isAFolderUnderItByNewURLString:(NSString *) newURLString andOriginURLString:(NSString *) originalURLString{
-
- if([originalURLString length] < [newURLString length]) {
-
- NSString *subString = [newURLString substringToIndex: [originalURLString length]];
-
- if([originalURLString isEqualToString: subString]){
-
- newURLString = [newURLString substringFromIndex:[subString length]];
-
- if ([newURLString rangeOfString:@"/"].location == NSNotFound) {
- //Is a rename of the last part of the file or folder
- return NO;
- } else {
- //Is a move inside himself
- return YES;
- }
- }
- }
- return NO;
-
-}
-
-///-----------------------------------
-/// @name getSizeInBytesByPath
-///-----------------------------------
-
-/**
- * Method to return the size of a file by a path
- *
- * @param NSString -> path of the file
- *
- * @return long long -> size of the file in the path
- */
-+ (long long) getSizeInBytesByPath:(NSString *)path {
- long long fileLength = [[[[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil] valueForKey:NSFileSize] unsignedLongLongValue];
-
- return fileLength;
-}
-
-
-
-
-
-///-----------------------------------
-/// @name isURLWithSamlFragment:
-///-----------------------------------
-
-/**
- * Method to check a url string to looking for a SAML fragment
- *
- * @param urlString -> url from redirect server
- *
- * @return BOOL -> the result about if exist the SAML fragment or not
- */
-+ (BOOL) isURLWithSamlFragment:(NSString*)urlString {
-
- urlString = [urlString lowercaseString];
-
- if (urlString) {
- for (NSString* samlFragment in kSAMLFragmentArray) {
- if ([urlString rangeOfString:samlFragment options:NSCaseInsensitiveSearch].location != NSNotFound) {
- NSLog(@"A SAML fragment is in the request url");
- return YES;
- }
- }
- }
- return NO;
-}
-
-+ (NSString *) AFBase64EncodedStringFromString:(NSString *) string {
- NSData *data = [NSData dataWithBytes:[string UTF8String] length:[string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];
- NSUInteger length = [data length];
- NSMutableData *mutableData = [NSMutableData dataWithLength:((length + 2) / 3) * 4];
-
- uint8_t *input = (uint8_t *)[data bytes];
- uint8_t *output = (uint8_t *)[mutableData mutableBytes];
-
- for (NSUInteger i = 0; i < length; i += 3) {
- NSUInteger value = 0;
- for (NSUInteger j = i; j < (i + 3); j++) {
- value <<= 8;
- if (j < length) {
- value |= (0xFF & input[j]);
- }
- }
-
- static uint8_t const kAFBase64EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
- NSUInteger idx = (i / 3) * 4;
- output[idx + 0] = kAFBase64EncodingTable[(value >> 18) & 0x3F];
- output[idx + 1] = kAFBase64EncodingTable[(value >> 12) & 0x3F];
- output[idx + 2] = (i + 1) < length ? kAFBase64EncodingTable[(value >> 6) & 0x3F] : '=';
- output[idx + 3] = (i + 2) < length ? kAFBase64EncodingTable[(value >> 0) & 0x3F] : '=';
- }
-
- return [[NSString alloc] initWithData:mutableData encoding:NSASCIIStringEncoding];
-}
-
-#pragma mark - Manage Cookies
-
-//-----------------------------------
-/// @name addCookiesToStorageFromResponse
-///-----------------------------------
-
-/**
- * Method to storage all the cookies from a response in order to use them in future requests
- *
- * @param NSHTTPURLResponse -> response
- * @param NSURL -> url
- *
- */
-+ (void) addCookiesToStorageFromResponse: (NSURLResponse *) response andPath:(NSURL *) url {
- //TODO: Using NSURLSession this should not be necessary
- /*NSArray* cookies = [NSHTTPCookie cookiesWithResponseHeaderFields:[response allHeaderFields] forURL:url];
-
- for (NSHTTPCookie *current in cookies) {
- [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:current];
- }*/
-}
-
-//-----------------------------------
-/// @name getRequestWithCookiesByRequest
-///-----------------------------------
-
-/**
- * Method to return a request with all the necessary cookies of the original url without redirection
- *
- * @param NSMutableURLRequest -> request
- * @param NSString -> originalUrlServer
- *
- * @return request
- *
- */
-+ (NSMutableURLRequest *) getRequestWithCookiesByRequest: (NSMutableURLRequest *) request andOriginalUrlServer:(NSString *) originalUrlServer {
- //We add the cookies of that URL
- NSArray *cookieStorage = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:originalUrlServer]];
- NSDictionary *cookieHeaders = [NSHTTPCookie requestHeaderFieldsWithCookies:cookieStorage];
-
- for (NSString *key in cookieHeaders) {
- [request addValue:cookieHeaders[key] forHTTPHeaderField:key];
- }
-
- return request;
-}
-
-//-----------------------------------
-/// @name deleteAllCookies
-///-----------------------------------
-
-/**
- * Method to clean the CookiesStorage
- *
- */
-+ (void) deleteAllCookies {
- NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
- for (NSHTTPCookie *each in cookieStorage.cookies) {
- [cookieStorage deleteCookie:each];
- }
-}
-
-//-----------------------------------
-/// @name isServerVersionHigherThanLimitVersion
-///-----------------------------------
-
-/**
- * Method to detect if a server version is higher than a limit version.
- * This methos is used for example to know if the server have share API or support Cookies
- *
- * @param NSString -> serverVersion
- * @param NSArray -> limitVersion
- *
- * @return BOOL
- *
- */
-+ (BOOL) isServerVersion:(NSString *) serverVersionString higherThanLimitVersion:(NSArray *) limitVersion {
-
- //Split the strings - Type 5.0.13
- NSArray *spliteVersion = [serverVersionString componentsSeparatedByString:@"."];
-
-
- NSMutableArray *serverVersion = [NSMutableArray new];
- for (NSString *string in spliteVersion) {
- [serverVersion addObject:string];
- }
-
- __block BOOL isSupported = NO;
-
- //Loop of compare
- [limitVersion enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
- NSString *firstVersionString = obj;
- NSString *currentVersionString;
- if ([serverVersion count] > idx) {
- currentVersionString = [serverVersion objectAtIndex:idx];
-
- int firstVersionInt = [firstVersionString intValue];
- int currentVersionInt = [currentVersionString intValue];
-
- //NSLog(@"firstVersion item %d item is: %d", idx, firstVersionInt);
- //NSLog(@"currentVersion item %d item is: %d", idx, currentVersionInt);
-
- //Comparation secure
- switch (idx) {
- case 0:
- //if the first number is higher
- if (currentVersionInt > firstVersionInt) {
- isSupported = YES;
- *stop=YES;
- }
- //if the first number is lower
- if (currentVersionInt < firstVersionInt) {
- isSupported = NO;
- *stop=YES;
- }
-
- break;
-
- case 1:
- //if the seccond number is higger
- if (currentVersionInt > firstVersionInt) {
- isSupported = YES;
- *stop=YES;
- }
- //if the second number is lower
- if (currentVersionInt < firstVersionInt) {
- isSupported = NO;
- *stop=YES;
- }
- break;
-
- case 2:
- //if the third number is higger or equal
- if (currentVersionInt >= firstVersionInt) {
- isSupported = YES;
- *stop=YES;
- } else {
- //if the third number is lower
- isSupported = NO;
- *stop=YES;
- }
- break;
-
- default:
- break;
- }
- } else {
- isSupported = NO;
- *stop=YES;
- }
-
- }];
-
- return isSupported;
-}
-
-#pragma mark - Share Permissions
-
-+ (NSInteger) getPermissionsValueByCanEdit:(BOOL)canEdit andCanCreate:(BOOL)canCreate andCanChange:(BOOL)canChange andCanDelete:(BOOL)canDelete andCanShare:(BOOL)canShare andIsFolder:(BOOL) isFolder {
-
- NSInteger permissionsValue = k_read_share_permission;
-
- if (canEdit && !isFolder) {
- permissionsValue = permissionsValue + k_update_share_permission;
- }
- if (canCreate & isFolder) {
- permissionsValue = permissionsValue + k_create_share_permission;
- }
- if (canChange && isFolder) {
- permissionsValue = permissionsValue + k_update_share_permission;
- }
- if (canDelete & isFolder) {
- permissionsValue = permissionsValue + k_delete_share_permission;
- }
- if (canShare) {
- permissionsValue = permissionsValue + k_share_share_permission;
- }
-
- return permissionsValue;
-}
-
-+ (BOOL) isPermissionToCanCreate:(NSInteger) permissionValue {
- BOOL canCreate = ((permissionValue & k_create_share_permission) > 0);
- return canCreate;
-}
-
-+ (BOOL) isPermissionToCanChange:(NSInteger) permissionValue {
- BOOL canChange = ((permissionValue & k_update_share_permission) > 0);
- return canChange;
-}
-
-+ (BOOL) isPermissionToCanDelete:(NSInteger) permissionValue {
- BOOL canDelete = ((permissionValue & k_delete_share_permission) > 0);
- return canDelete;
-}
-
-+ (BOOL) isPermissionToCanShare:(NSInteger) permissionValue {
- BOOL canShare = ((permissionValue & k_share_share_permission) > 0);
- return canShare;
-}
-
-+ (BOOL) isAnyPermissionToEdit:(NSInteger) permissionValue {
-
- BOOL canCreate = [self isPermissionToCanCreate:permissionValue];
- BOOL canChange = [self isPermissionToCanChange:permissionValue];
- BOOL canDelete = [self isPermissionToCanDelete:permissionValue];
-
-
- BOOL canEdit = (canCreate || canChange || canDelete);
-
- return canEdit;
-
-}
-
-+ (BOOL) isPermissionToRead:(NSInteger) permissionValue {
- BOOL canRead = ((permissionValue & k_read_share_permission) > 0);
- return canRead;
-}
-
-+ (BOOL) isPermissionToReadCreateUpdate:(NSInteger) permissionValue {
-
- BOOL canRead = [self isPermissionToRead:permissionValue];
- BOOL canCreate = [self isPermissionToCanCreate:permissionValue];
- BOOL canChange = [self isPermissionToCanChange:permissionValue];
-
-
- BOOL canEdit = (canCreate && canChange && canRead);
-
- return canEdit;
-
-}
-@end