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:
authorMarino Faggiana <marinofaggiana@mbp-di-marino-001.homenet.telecomitalia.it>2018-03-21 22:15:14 +0300
committerMarino Faggiana <marinofaggiana@mbp-di-marino-001.homenet.telecomitalia.it>2018-03-21 22:15:14 +0300
commita81a1922c13acdffee5f46488145732b25ddd6f2 (patch)
tree06ca8d2eabc85aac3f400a74196f0e14e0f040e7
parent643504b9a33759379a1167eeb572d92821d11985 (diff)
parent4f6afb1b0dee22034a9ccf919ab6267cb8dfb88c (diff)
Merge branch 'develop'2.20.6
-rwxr-xr-xLibraries external/UICKeyChainStore/UICKeyChainStore.h14
-rwxr-xr-xLibraries external/UICKeyChainStore/UICKeyChainStore.m19
-rw-r--r--Nextcloud.xcodeproj/project.pbxproj19
-rw-r--r--Picker/DocumentPickerViewController.swift98
-rwxr-xr-xiOSClient/.tx/config14
-rw-r--r--iOSClient/Actions/CCActions.swift58
-rw-r--r--iOSClient/AppDelegate.h3
-rw-r--r--iOSClient/AppDelegate.m152
-rw-r--r--iOSClient/AutoUpload/NCAutoUpload.m4
-rw-r--r--iOSClient/Brand/Picker.plist4
-rw-r--r--iOSClient/Brand/PickerFileProvider.plist4
-rw-r--r--iOSClient/Brand/Share.plist4
-rw-r--r--iOSClient/Brand/iOSClient.plist4
-rw-r--r--iOSClient/CCGlobal.h7
-rw-r--r--iOSClient/Database/NCDatabase.swift1
-rw-r--r--iOSClient/Database/NCManageDatabase.swift196
-rw-r--r--iOSClient/Favorites/CCFavorites.h3
-rw-r--r--iOSClient/Favorites/CCFavorites.m113
-rw-r--r--iOSClient/Images.xcassets/file_photo_encrypted.imageset/Contents.json21
-rw-r--r--iOSClient/Images.xcassets/file_photo_encrypted.imageset/photo@2x.pngbin0 -> 3250 bytes
-rw-r--r--iOSClient/Library/OCCommunicationLib/OCCapabilities.h10
-rw-r--r--iOSClient/Library/OCCommunicationLib/OCCapabilities.m7
-rwxr-xr-xiOSClient/Library/OCCommunicationLib/OCCommunication.h2
-rw-r--r--iOSClient/Library/OCCommunicationLib/OCCommunication.m50
-rwxr-xr-xiOSClient/Library/OCCommunicationLib/OCFrameworkConstants.h3
-rwxr-xr-xiOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h2
-rwxr-xr-xiOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m213
-rw-r--r--iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLListParser.m2
-rw-r--r--iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLParser.m3
-rw-r--r--iOSClient/Library/SwiftWebVC/SwiftWebVC.swift9
-rw-r--r--iOSClient/Login/CCLogin.m115
-rw-r--r--iOSClient/Main/CCDetail.m6
-rw-r--r--iOSClient/Main/CCMain.h7
-rw-r--r--iOSClient/Main/CCMain.m667
-rw-r--r--iOSClient/Main/CCSection.h4
-rw-r--r--iOSClient/Main/CCSection.m22
-rw-r--r--iOSClient/Move/CCMove.m119
-rw-r--r--iOSClient/Networking/CCNetworking.h2
-rw-r--r--iOSClient/Networking/CCNetworking.m9
-rw-r--r--iOSClient/Networking/NCService.swift380
-rw-r--r--iOSClient/Networking/OCNetworking.h41
-rw-r--r--iOSClient/Networking/OCNetworking.m409
-rw-r--r--iOSClient/Notification/CCNotification.swift44
-rw-r--r--iOSClient/PeekPop/CCPeekPop.m35
-rw-r--r--iOSClient/Photos/CCPhotos.h4
-rw-r--r--iOSClient/Photos/CCPhotos.m143
-rw-r--r--iOSClient/Settings/CCAdvanced.m22
-rw-r--r--iOSClient/Settings/CCSettings.m2
-rw-r--r--iOSClient/Settings/NCEndToEndInitialize.swift2
-rw-r--r--iOSClient/Settings/NCManageEndToEndEncryption.m4
-rw-r--r--iOSClient/Shares/NCShares.m25
-rw-r--r--iOSClient/Supporting Files/cs-CZ.lproj/Error.stringsbin6568 -> 6722 bytes
-rw-r--r--iOSClient/Supporting Files/cs-CZ.lproj/Localizable.stringsbin55034 -> 55046 bytes
-rw-r--r--iOSClient/Supporting Files/de.lproj/Error.stringsbin7150 -> 7308 bytes
-rw-r--r--iOSClient/Supporting Files/de.lproj/Localizable.stringsbin59156 -> 59154 bytes
-rw-r--r--iOSClient/Supporting Files/en-GB.lproj/Error.stringsbin6696 -> 6850 bytes
-rw-r--r--iOSClient/Supporting Files/en-GB.lproj/Localizable.stringsbin53842 -> 53844 bytes
-rw-r--r--iOSClient/Supporting Files/en.lproj/Error.strings1
-rw-r--r--iOSClient/Supporting Files/en.lproj/Localizable.strings2
-rw-r--r--iOSClient/Supporting Files/es-419.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-419.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-CL.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-CL.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-CO.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-CO.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-CR.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-CR.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-DO.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-DO.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-EC.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-EC.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-GT.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-GT.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-HN.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-HN.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-MX.lproj/Error.stringsbin7120 -> 7276 bytes
-rw-r--r--iOSClient/Supporting Files/es-MX.lproj/Localizable.stringsbin58868 -> 58874 bytes
-rw-r--r--iOSClient/Supporting Files/es-NI.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-NI.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-PA.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-PA.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-PE.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-PE.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-PR.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-PR.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-PY.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-PY.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-SV.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-SV.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es-UY.lproj/Error.stringsbin7098 -> 7252 bytes
-rw-r--r--iOSClient/Supporting Files/es-UY.lproj/Localizable.stringsbin58400 -> 58384 bytes
-rw-r--r--iOSClient/Supporting Files/es.lproj/Error.stringsbin7088 -> 7244 bytes
-rw-r--r--iOSClient/Supporting Files/es.lproj/Intro.stringsbin3796 -> 3798 bytes
-rw-r--r--iOSClient/Supporting Files/es.lproj/Localizable.stringsbin58128 -> 58126 bytes
-rw-r--r--iOSClient/Supporting Files/fr.lproj/Error.stringsbin7148 -> 7310 bytes
-rw-r--r--iOSClient/Supporting Files/fr.lproj/Localizable.stringsbin59924 -> 59926 bytes
-rw-r--r--iOSClient/Supporting Files/hu.lproj/Error.stringsbin6616 -> 6770 bytes
-rw-r--r--iOSClient/Supporting Files/hu.lproj/Localizable.stringsbin55422 -> 55416 bytes
-rw-r--r--iOSClient/Supporting Files/is.lproj/Error.stringsbin6640 -> 6794 bytes
-rw-r--r--iOSClient/Supporting Files/is.lproj/Localizable.stringsbin55880 -> 55882 bytes
-rw-r--r--iOSClient/Supporting Files/it.lproj/Error.stringsbin6994 -> 7146 bytes
-rw-r--r--iOSClient/Supporting Files/it.lproj/Localizable.stringsbin57308 -> 57306 bytes
-rw-r--r--iOSClient/Supporting Files/ka-GE.lproj/Error.stringsbin6732 -> 6886 bytes
-rw-r--r--iOSClient/Supporting Files/ka-GE.lproj/Localizable.stringsbin57230 -> 57218 bytes
-rw-r--r--iOSClient/Supporting Files/ko.lproj/Error.stringsbin5478 -> 5632 bytes
-rw-r--r--iOSClient/Supporting Files/ko.lproj/Localizable.stringsbin44418 -> 44438 bytes
-rw-r--r--iOSClient/Supporting Files/nb-NO.lproj/Error.stringsbin6634 -> 6798 bytes
-rw-r--r--iOSClient/Supporting Files/nb-NO.lproj/Localizable.stringsbin54684 -> 54676 bytes
-rw-r--r--iOSClient/Supporting Files/nl.lproj/Error.stringsbin6906 -> 7072 bytes
-rw-r--r--iOSClient/Supporting Files/nl.lproj/Localizable.stringsbin56488 -> 56682 bytes
-rw-r--r--iOSClient/Supporting Files/pl.lproj/Error.stringsbin6856 -> 7010 bytes
-rw-r--r--iOSClient/Supporting Files/pl.lproj/Localizable.stringsbin55236 -> 55224 bytes
-rw-r--r--iOSClient/Supporting Files/pt-BR.lproj/Error.stringsbin6886 -> 7046 bytes
-rw-r--r--iOSClient/Supporting Files/pt-BR.lproj/Localizable.stringsbin56464 -> 56462 bytes
-rw-r--r--iOSClient/Supporting Files/pt-PT.lproj/BKPasscodeView.strings (renamed from iOSClient/Supporting Files/pt_PT.lproj/BKPasscodeView.strings)bin4684 -> 4684 bytes
-rw-r--r--iOSClient/Supporting Files/pt-PT.lproj/CTAssetsPicker.strings (renamed from iOSClient/Supporting Files/pt_PT.lproj/CTAssetsPicker.strings)bin5050 -> 5050 bytes
-rw-r--r--iOSClient/Supporting Files/pt-PT.lproj/Error.strings (renamed from iOSClient/Supporting Files/pt_PT.lproj/Error.strings)bin6926 -> 7080 bytes
-rw-r--r--iOSClient/Supporting Files/pt-PT.lproj/InfoPlist.strings (renamed from iOSClient/Supporting Files/pt_PT.lproj/InfoPlist.strings)bin2020 -> 2020 bytes
-rw-r--r--iOSClient/Supporting Files/pt-PT.lproj/Intro.strings (renamed from iOSClient/Supporting Files/pt_PT.lproj/Intro.strings)bin3856 -> 3856 bytes
-rw-r--r--iOSClient/Supporting Files/pt-PT.lproj/Localizable.strings (renamed from iOSClient/Supporting Files/pt_PT.lproj/Localizable.strings)bin56328 -> 56318 bytes
-rw-r--r--iOSClient/Supporting Files/pt-PT.lproj/SwiftWebVC.strings (renamed from iOSClient/Supporting Files/pt_PT.lproj/SwiftWebVC.strings)bin1778 -> 1778 bytes
-rw-r--r--iOSClient/Supporting Files/ru.lproj/Error.stringsbin6788 -> 6942 bytes
-rw-r--r--iOSClient/Supporting Files/ru.lproj/Localizable.stringsbin57274 -> 57278 bytes
-rw-r--r--iOSClient/Supporting Files/sk-SK.lproj/Error.stringsbin6714 -> 6868 bytes
-rw-r--r--iOSClient/Supporting Files/sk-SK.lproj/Localizable.stringsbin56210 -> 56206 bytes
-rw-r--r--iOSClient/Supporting Files/sr.lproj/Error.stringsbin6614 -> 6760 bytes
-rw-r--r--iOSClient/Supporting Files/sr.lproj/Localizable.stringsbin55452 -> 55438 bytes
-rw-r--r--iOSClient/Supporting Files/sv.lproj/Error.stringsbin6672 -> 6826 bytes
-rw-r--r--iOSClient/Supporting Files/sv.lproj/Localizable.stringsbin54626 -> 54612 bytes
-rw-r--r--iOSClient/Supporting Files/tr.lproj/Error.stringsbin6508 -> 6644 bytes
-rw-r--r--iOSClient/Supporting Files/tr.lproj/Localizable.stringsbin56326 -> 56324 bytes
-rw-r--r--iOSClient/Supporting Files/zh-Hans.lproj/Error.stringsbin4986 -> 5140 bytes
-rw-r--r--iOSClient/Supporting Files/zh-Hans.lproj/Localizable.stringsbin42516 -> 42554 bytes
-rw-r--r--iOSClient/Supporting Files/zh-Hant-TW.lproj/Error.stringsbin5086 -> 5240 bytes
-rw-r--r--iOSClient/Supporting Files/zh-Hant-TW.lproj/Localizable.stringsbin45346 -> 45348 bytes
-rw-r--r--iOSClient/Synchronize/CCSynchronize.m121
-rw-r--r--iOSClient/Text/NCText.swift3
-rw-r--r--iOSClient/Transfers/CCTransfers.m15
-rw-r--r--iOSClient/Utility/CCUtility.h2
-rw-r--r--iOSClient/Utility/CCUtility.m14
140 files changed, 1854 insertions, 1405 deletions
diff --git a/Libraries external/UICKeyChainStore/UICKeyChainStore.h b/Libraries external/UICKeyChainStore/UICKeyChainStore.h
index b5a628098..095720a63 100755
--- a/Libraries external/UICKeyChainStore/UICKeyChainStore.h
+++ b/Libraries external/UICKeyChainStore/UICKeyChainStore.h
@@ -96,9 +96,16 @@ typedef NS_ENUM(NSInteger, UICKeyChainStoreAccessibility) {
}
__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_4_0);
-typedef NS_ENUM(NSInteger, UICKeyChainStoreAuthenticationPolicy) {
- UICKeyChainStoreAuthenticationPolicyUserPresence = kSecAccessControlUserPresence,
-};
+typedef NS_ENUM(unsigned long, UICKeyChainStoreAuthenticationPolicy) {
+ UICKeyChainStoreAuthenticationPolicyUserPresence = 1 << 0,
+ UICKeyChainStoreAuthenticationPolicyTouchIDAny NS_ENUM_AVAILABLE(10_12_1, 9_0) = 1u << 1,
+ UICKeyChainStoreAuthenticationPolicyTouchIDCurrentSet NS_ENUM_AVAILABLE(10_12_1, 9_0) = 1u << 3,
+ UICKeyChainStoreAuthenticationPolicyDevicePasscode NS_ENUM_AVAILABLE(10_11, 9_0) = 1u << 4,
+ UICKeyChainStoreAuthenticationPolicyControlOr NS_ENUM_AVAILABLE(10_12_1, 9_0) = 1u << 14,
+ UICKeyChainStoreAuthenticationPolicyControlAnd NS_ENUM_AVAILABLE(10_12_1, 9_0) = 1u << 15,
+ UICKeyChainStoreAuthenticationPolicyPrivateKeyUsage NS_ENUM_AVAILABLE(10_12_1, 9_0) = 1u << 30,
+ UICKeyChainStoreAuthenticationPolicyApplicationPassword NS_ENUM_AVAILABLE(10_12_1, 9_0) = 1u << 31,
+}__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
@interface UICKeyChainStore : NSObject
@@ -114,6 +121,7 @@ typedef NS_ENUM(NSInteger, UICKeyChainStoreAuthenticationPolicy) {
@property (nonatomic) UICKeyChainStoreAccessibility accessibility;
@property (nonatomic, readonly) UICKeyChainStoreAuthenticationPolicy authenticationPolicy
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
+@property (nonatomic) BOOL useAuthenticationUI;
@property (nonatomic) BOOL synchronizable;
diff --git a/Libraries external/UICKeyChainStore/UICKeyChainStore.m b/Libraries external/UICKeyChainStore/UICKeyChainStore.m
index ace499b51..6e5237307 100755
--- a/Libraries external/UICKeyChainStore/UICKeyChainStore.m
+++ b/Libraries external/UICKeyChainStore/UICKeyChainStore.m
@@ -117,6 +117,7 @@ static NSString *_defaultService;
- (void)commonInit
{
_accessibility = UICKeyChainStoreAccessibilityAfterFirstUnlock;
+ _useAuthenticationUI = YES;
}
#pragma mark -
@@ -360,9 +361,9 @@ static NSString *_defaultService;
{
NSMutableDictionary *query = [self query];
query[(__bridge __strong id)kSecAttrAccount] = key;
-
+
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, NULL);
- return status == errSecSuccess;
+ return status == errSecSuccess || status == errSecInteractionNotAllowed;
}
#pragma mark -
@@ -1140,6 +1141,20 @@ static NSString *_defaultService;
}
}
#endif
+
+ if (!_useAuthenticationUI) {
+#if TARGET_OS_IOS
+ if (floor(NSFoundationVersionNumber) > floor(1144.17)) { // iOS 9+
+ query[(__bridge __strong id)kSecUseAuthenticationUI] = (__bridge id)kSecUseAuthenticationUIFail;
+#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
+ } else if (floor(NSFoundationVersionNumber) > floor(1047.25)) { // iOS 8+
+ query[(__bridge __strong id)kSecUseNoAuthenticationUI] = (__bridge id)kCFBooleanTrue;
+#endif
+ }
+#elif TARGET_OS_WATCH || TARGET_OS_TV
+ query[(__bridge __strong id)kSecUseAuthenticationUI] = (__bridge id)kSecUseAuthenticationUIFail;
+#endif
+ }
return query;
}
diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj
index f02593556..39d90417a 100644
--- a/Nextcloud.xcodeproj/project.pbxproj
+++ b/Nextcloud.xcodeproj/project.pbxproj
@@ -233,6 +233,7 @@
F75131641FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */ = {isa = PBXBuildFile; fileRef = F75131621FA5EFF4002BB4D1 /* NCNetworkingSync.m */; };
F75131651FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */ = {isa = PBXBuildFile; fileRef = F75131621FA5EFF4002BB4D1 /* NCNetworkingSync.m */; };
F75131661FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */ = {isa = PBXBuildFile; fileRef = F75131621FA5EFF4002BB4D1 /* NCNetworkingSync.m */; };
+ F755BD9B20594AC7008C5FBB /* NCService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F755BD9A20594AC7008C5FBB /* NCService.swift */; };
F75797AE1E81356C00187A1B /* CTAssetsPicker.strings in Resources */ = {isa = PBXBuildFile; fileRef = F75797AC1E81356C00187A1B /* CTAssetsPicker.strings */; };
F75AC2431F1F62450073EC19 /* NCManageAutoUploadFileName.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75AC2421F1F62450073EC19 /* NCManageAutoUploadFileName.swift */; };
F75ADF451DC75FFE008A7347 /* CCLogin.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F75ADF441DC75FFE008A7347 /* CCLogin.storyboard */; };
@@ -746,6 +747,13 @@
F7053E3C1C639DF500741EA5 /* CCUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCUtility.h; sourceTree = "<group>"; };
F7053E3D1C639DF500741EA5 /* CCUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCUtility.m; sourceTree = "<group>"; };
F70944BC1F86364000AE4541 /* MainInterface.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MainInterface.storyboard; sourceTree = "<group>"; };
+ F70A07C5205285FA00DC1231 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/CTAssetsPicker.strings"; sourceTree = "<group>"; };
+ F70A07C6205285FB00DC1231 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/SwiftWebVC.strings"; sourceTree = "<group>"; };
+ F70A07C7205285FB00DC1231 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/BKPasscodeView.strings"; sourceTree = "<group>"; };
+ F70A07C8205285FB00DC1231 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/Localizable.strings"; sourceTree = "<group>"; };
+ F70A07C9205285FB00DC1231 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
+ F70A07CA205285FB00DC1231 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/Intro.strings"; sourceTree = "<group>"; };
+ F70A07CB205285FB00DC1231 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/Error.strings"; sourceTree = "<group>"; };
F70A63061D5B3467004E2AA5 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libcrypto.a; sourceTree = "<group>"; };
F70A63071D5B3467004E2AA5 /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libssl.a; sourceTree = "<group>"; };
F70CAE381F8CF31A008125FD /* NCEndToEndEncryption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NCEndToEndEncryption.h; sourceTree = "<group>"; };
@@ -994,6 +1002,7 @@
F7540F2A1D5B238600C3FFA8 /* x509.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509.h; sourceTree = "<group>"; };
F7540F2B1D5B238600C3FFA8 /* x509_vfy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509_vfy.h; sourceTree = "<group>"; };
F7540F2C1D5B238600C3FFA8 /* x509v3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x509v3.h; sourceTree = "<group>"; };
+ F755BD9A20594AC7008C5FBB /* NCService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCService.swift; sourceTree = "<group>"; };
F75797AD1E81356C00187A1B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/CTAssetsPicker.strings; sourceTree = "<group>"; };
F75AC2421F1F62450073EC19 /* NCManageAutoUploadFileName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCManageAutoUploadFileName.swift; sourceTree = "<group>"; };
F75ADF441DC75FFE008A7347 /* CCLogin.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = CCLogin.storyboard; sourceTree = "<group>"; };
@@ -2151,6 +2160,7 @@
isa = PBXGroup;
children = (
F732BA031D76CE1500E9878B /* CCNetworking.h */,
+ F755BD9A20594AC7008C5FBB /* NCService.swift */,
F732BA041D76CE1500E9878B /* CCNetworking.m */,
F74D3DBD1BAC1941000BAE4B /* OCNetworking.h */,
F74D3DBE1BAC1941000BAE4B /* OCNetworking.m */,
@@ -3364,6 +3374,7 @@
"cs-CZ",
ko,
"es-419",
+ "pt-PT",
);
mainGroup = F7F67B9F1A24D27800EE80DA;
productRefGroup = F7F67B9F1A24D27800EE80DA;
@@ -3976,6 +3987,7 @@
F77B0E981D118A16002130FE /* CCManageAccount.m in Sources */,
F75131631FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */,
F762CB011EACB66200B38484 /* XLFormSelectorCell.m in Sources */,
+ F755BD9B20594AC7008C5FBB /* NCService.swift in Sources */,
F70022AD1EC4C9100080073F /* AFURLResponseSerialization.m in Sources */,
F7D424531F063B82009C9782 /* NSBundle+CTAssetsPickerController.m in Sources */,
F77B0E9B1D118A16002130FE /* CCBKPasscode.m in Sources */,
@@ -4124,6 +4136,7 @@
F7BB04841FD58ACB00BBFD2A /* cs-CZ */,
F7320933201B812F008A0888 /* ko */,
F732093A201B81E4008A0888 /* es-419 */,
+ F70A07C7205285FB00DC1231 /* pt-PT */,
);
name = BKPasscodeView.strings;
path = "Supporting Files";
@@ -4170,6 +4183,7 @@
F7BB04831FD58ACA00BBFD2A /* cs-CZ */,
F7320932201B812F008A0888 /* ko */,
F7320939201B81E4008A0888 /* es-419 */,
+ F70A07C6205285FB00DC1231 /* pt-PT */,
);
name = SwiftWebVC.strings;
path = "Supporting Files";
@@ -4216,6 +4230,7 @@
F7BB04871FD58ACB00BBFD2A /* cs-CZ */,
F7320936201B8130008A0888 /* ko */,
F732093D201B81E5008A0888 /* es-419 */,
+ F70A07CA205285FB00DC1231 /* pt-PT */,
);
name = Intro.strings;
path = "Supporting Files";
@@ -4262,6 +4277,7 @@
F7BB04821FD58ACA00BBFD2A /* cs-CZ */,
F7320931201B812F008A0888 /* ko */,
F7320938201B81E4008A0888 /* es-419 */,
+ F70A07C5205285FA00DC1231 /* pt-PT */,
);
name = CTAssetsPicker.strings;
path = "Supporting Files";
@@ -4308,6 +4324,7 @@
F7BB04881FD58ACB00BBFD2A /* cs-CZ */,
F7320937201B8130008A0888 /* ko */,
F732093E201B81E5008A0888 /* es-419 */,
+ F70A07CB205285FB00DC1231 /* pt-PT */,
);
name = Error.strings;
path = "Supporting Files";
@@ -4354,6 +4371,7 @@
F7BB04861FD58ACB00BBFD2A /* cs-CZ */,
F7320935201B8130008A0888 /* ko */,
F732093C201B81E4008A0888 /* es-419 */,
+ F70A07C9205285FB00DC1231 /* pt-PT */,
);
name = InfoPlist.strings;
path = "Supporting Files";
@@ -4400,6 +4418,7 @@
F7BB04851FD58ACB00BBFD2A /* cs-CZ */,
F7320934201B812F008A0888 /* ko */,
F732093B201B81E4008A0888 /* es-419 */,
+ F70A07C8205285FB00DC1231 /* pt-PT */,
);
name = Localizable.strings;
path = "Supporting Files";
diff --git a/Picker/DocumentPickerViewController.swift b/Picker/DocumentPickerViewController.swift
index 0e442f4d6..9f999ab87 100644
--- a/Picker/DocumentPickerViewController.swift
+++ b/Picker/DocumentPickerViewController.swift
@@ -235,67 +235,71 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
hud.visibleIndeterminateHud()
}
- func readFolderFailure(_ metadataNet: CCMetadataNet!, message: String!, errorCode: Int) {
+ func readFolderSuccessFailure(_ metadataNet: CCMetadataNet!, metadataFolder: tableMetadata?, metadatas: [Any]!, message: String!, errorCode: Int) {
- hud.hideHud()
-
- let alert = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: message, preferredStyle: .alert)
- alert.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default) { action in
- self.dismissGrantingAccess(to: nil)
- })
-
- self.present(alert, animated: true, completion: nil)
- }
-
- func readFolderSuccess(_ metadataNet: CCMetadataNet!, metadataFolder: tableMetadata?, metadatas: [Any]!) {
-
- // remove all record
- var predicate = NSPredicate(format: "account = %@ AND directoryID = %@ AND session = ''", activeAccount, metadataNet.directoryID!)
- NCManageDatabase.sharedInstance.deleteMetadata(predicate: predicate, clearDateReadDirectoryID: metadataNet.directoryID!)
+ if (errorCode == 0) {
- for metadata in metadatas as! [tableMetadata] {
+ // remove all record
+ var predicate = NSPredicate(format: "account = %@ AND directoryID = %@ AND session = ''", activeAccount, metadataNet.directoryID!)
+ NCManageDatabase.sharedInstance.deleteMetadata(predicate: predicate, clearDateReadDirectoryID: metadataNet.directoryID!)
- // Only Directory ?
- if (parameterMode == .moveToService || parameterMode == .exportToService) && metadata.directory == false {
- continue
+ for metadata in metadatas as! [tableMetadata] {
+
+ // Only Directory ?
+ if (parameterMode == .moveToService || parameterMode == .exportToService) && metadata.directory == false {
+ continue
+ }
+
+ // Add record
+ _ = NCManageDatabase.sharedInstance.addMetadata(metadata)
}
- // Add record
- _ = NCManageDatabase.sharedInstance.addMetadata(metadata)
- }
-
- predicate = NSPredicate(format: "account = %@ AND directoryID = %@", activeAccount, metadataNet.directoryID!)
- recordsTableMetadata = NCManageDatabase.sharedInstance.getMetadatas(predicate: predicate, sorted: "fileName", ascending: true)
-
- autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
- autoUploadDirectory = NCManageDatabase.sharedInstance.getAccountAutoUploadDirectory(activeUrl)
-
- if (CCUtility.isEnd(toEndEnabled: activeAccount)) {
+ predicate = NSPredicate(format: "account = %@ AND directoryID = %@", activeAccount, metadataNet.directoryID!)
+ recordsTableMetadata = NCManageDatabase.sharedInstance.getMetadatas(predicate: predicate, sorted: "fileName", ascending: true)
+
+ autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
+ autoUploadDirectory = NCManageDatabase.sharedInstance.getAccountAutoUploadDirectory(activeUrl)
+
+ if (CCUtility.isEnd(toEndEnabled: activeAccount)) {
+ }
+
+ tableView.reloadData()
+
+ hud.hideHud()
+
+ } else {
+
+ hud.hideHud()
+
+ let alert = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: message, preferredStyle: .alert)
+ alert.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default) { action in
+ self.dismissGrantingAccess(to: nil)
+ })
+
+ self.present(alert, animated: true, completion: nil)
}
-
- tableView.reloadData()
-
- hud.hideHud()
}
// MARK: - Download Thumbnail
- func downloadThumbnailFailure(_ metadataNet: CCMetadataNet!, message: String!, errorCode: Int) {
- NSLog("[LOG] Thumbnail Error \(metadataNet.fileName) \(message) (error \(errorCode))");
- }
-
- func downloadThumbnailSuccess(_ metadataNet: CCMetadataNet!) {
+ func downloadThumbnailSuccessFailure(_ metadataNet: CCMetadataNet!, message: String!, errorCode: Int) {
- if let indexPath = thumbnailInLoading[metadataNet.fileID] {
-
- let path = "\(directoryUser)/\(metadataNet.fileID!).ico"
-
- if FileManager.default.fileExists(atPath: path) {
+ if (errorCode == 0) {
+
+ if let indexPath = thumbnailInLoading[metadataNet.fileID] {
- if let cell = tableView.cellForRow(at: indexPath) as? recordMetadataCell {
- cell.fileImageView.image = UIImage(contentsOfFile: path)
+ let path = "\(directoryUser)/\(metadataNet.fileID!).ico"
+
+ if FileManager.default.fileExists(atPath: path) {
+
+ if let cell = tableView.cellForRow(at: indexPath) as? recordMetadataCell {
+ cell.fileImageView.image = UIImage(contentsOfFile: path)
+ }
}
}
+ } else {
+
+ NSLog("[LOG] Thumbnail Error \(metadataNet.fileName) \(message) (error \(errorCode))");
}
}
diff --git a/iOSClient/.tx/config b/iOSClient/.tx/config
index dee55ed81..12a1620ed 100755
--- a/iOSClient/.tx/config
+++ b/iOSClient/.tx/config
@@ -6,46 +6,46 @@ file_filter = Supporting Files/<lang>.lproj/BKPasscodeView.strings
source_file = Supporting Files/en.lproj/BKPasscodeView.strings
source_lang = en
type = STRINGS
-lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419
+lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419,pt_PT:pt-PT
[nextcloud.ios-assetspicker]
file_filter = Supporting Files/<lang>.lproj/CTAssetsPicker.strings
source_file = Supporting Files/en.lproj/CTAssetsPicker.strings
source_lang = en
type = STRINGS
-lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419
+lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419,pt_PT:pt-PT
[nextcloud.ios-error]
file_filter = Supporting Files/<lang>.lproj/Error.strings
source_file = Supporting Files/en.lproj/Error.strings
source_lang = en
type = STRINGS
-lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419
+lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419,pt_PT:pt-PT
[nextcloud.ios-infoplist]
file_filter = Supporting Files/<lang>.lproj/InfoPlist.strings
source_file = Supporting Files/en.lproj/InfoPlist.strings
source_lang = en
type = STRINGS
-lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419
+lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419,pt_PT:pt-PT
[nextcloud.ios-intro]
file_filter = Supporting Files/<lang>.lproj/Intro.strings
source_file = Supporting Files/en.lproj/Intro.strings
source_lang = en
type = STRINGS
-lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419
+lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419,pt_PT:pt-PT
[nextcloud.ios-localizable]
file_filter = Supporting Files/<lang>.lproj/Localizable.strings
source_file = Supporting Files/en.lproj/Localizable.strings
source_lang = en
type = STRINGS
-lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419
+lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419,pt_PT:pt-PT
[nextcloud.ios-swiftwebvc]
file_filter = Supporting Files/<lang>.lproj/SwiftWebVC.strings
source_file = Supporting Files/en.lproj/SwiftWebVC.strings
source_lang = en
type = STRINGS
-lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419
+lang_map = pt_BR:pt-BR,zh_CN:zh-Hans,fi_FI:fi-FI,es_MX:es-MX,nb_NO:nb-NO,cs_CZ:cs-CZ,en_GB:en-GB,es_AR:es-AR,sk_SK:sk-SK,hu_HU:hu,ka_GE:ka-GE,zh_TW:zh-Hant-TW,es_CL:es-CL,es_CO:es-CO,es_CR:es-CR,es_DO:es-DO,es_EC:es-EC,es_GT:es-GT,es_HN:es-HN,es_NI:es-NI,es_PA:es-PA,es_PE:es-PE,es_PR:es-PR,es_PY:es-PY,es_SV:es-SV,es_UY:es-UY,es_419:es-419,pt_PT:pt-PT
diff --git a/iOSClient/Actions/CCActions.swift b/iOSClient/Actions/CCActions.swift
index 93a258ec6..768a6dc5f 100644
--- a/iOSClient/Actions/CCActions.swift
+++ b/iOSClient/Actions/CCActions.swift
@@ -36,25 +36,22 @@ import Foundation
@objc protocol CCActionsSearchDelegate {
- func searchSuccess(_ metadataNet: CCMetadataNet, metadatas: [Any])
- func searchFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger)
+ func searchSuccessFailure(_ metadataNet: CCMetadataNet, metadatas: [Any], message: NSString, errorCode: NSInteger)
}
@objc protocol CCActionsDownloadThumbnailDelegate {
- func downloadThumbnailSuccess(_ metadataNet: CCMetadataNet)
+ func downloadThumbnailSuccessFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger)
}
@objc protocol CCActionsSettingFavoriteDelegate {
- func settingFavoriteSuccess(_ metadataNet: CCMetadataNet)
- func settingFavoriteFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger)
+ func settingFavoriteSuccessFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger)
}
@objc protocol CCActionsListingFavoritesDelegate {
- func listingFavoritesSuccess(_ metadataNet: CCMetadataNet, metadatas: [Any])
- func listingFavoritesFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger)
+ func listingFavoritesSuccessFailure(_ metadataNet: CCMetadataNet, metadatas: [Any], message: NSString, errorCode: NSInteger)
}
class CCActions: NSObject {
@@ -89,7 +86,7 @@ class CCActions: NSObject {
// fix CCActions.swift line 88 2.17.2 (00005)
if (serverUrl == "") {
- appDelegate.messageNotification("_delete_", description: "_file_not_found_reload_", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: 0)
+ appDelegate.messageNotification("_delete_", description: "_file_not_found_reload_", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: Int(k_CCErrorInternalError))
return
}
@@ -105,7 +102,7 @@ class CCActions: NSObject {
let error = NCNetworkingSync.sharedManager().lockEnd(toEndFolderEncrypted: self.appDelegate.activeUser, userID: self.appDelegate.activeUserID, password: self.appDelegate.activePassword, url: self.appDelegate.activeUrl, serverUrl:serverUrl, fileID: tableDirectory.fileID)
if error != nil {
DispatchQueue.main.async {
- self.appDelegate.messageNotification("_delete_", description: error!.localizedDescription, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: 0)
+ self.appDelegate.messageNotification("_delete_", description: error!.localizedDescription, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: Int(k_CCErrorInternalError))
}
return;
}
@@ -296,7 +293,7 @@ class CCActions: NSObject {
// MARK: Search
// --------------------------------------------------------------------------------------------
- @objc func search(_ serverUrl: String, fileName: String, depth: String, date: Date?, selector: String, delegate: AnyObject) {
+ @objc func search(_ serverUrl: String, fileName: String, depth: String, date: Date?, contenType: [String]?, selector: String, delegate: AnyObject) {
guard let directoryID = NCManageDatabase.sharedInstance.getDirectoryID(serverUrl) else {
return
@@ -307,6 +304,7 @@ class CCActions: NSObject {
let metadataNet: CCMetadataNet = CCMetadataNet.init(account: appDelegate.activeAccount)
metadataNet.action = actionSearch
+ metadataNet.contentType = contenType
metadataNet.date = date
metadataNet.delegate = delegate
metadataNet.directoryID = directoryID
@@ -319,14 +317,9 @@ class CCActions: NSObject {
appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
}
- @objc func searchSuccess(_ metadataNet: CCMetadataNet, metadatas: [tableMetadata]) {
+ @objc func searchSuccessFailure(_ metadataNet: CCMetadataNet, metadatas: [tableMetadata], message: NSString, errorCode: NSInteger) {
- metadataNet.delegate?.searchSuccess(metadataNet, metadatas: metadatas)
- }
-
- @objc func searchFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger) {
-
- metadataNet.delegate?.searchFailure(metadataNet, message: message, errorCode: errorCode)
+ metadataNet.delegate?.searchSuccessFailure(metadataNet, metadatas: metadatas, message: message, errorCode: errorCode)
}
// --------------------------------------------------------------------------------------------
@@ -354,14 +347,9 @@ class CCActions: NSObject {
appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
}
- @objc func downloadThumbnailSuccess(_ metadataNet: CCMetadataNet) {
+ @objc func downloadThumbnailSuccessFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger) {
- metadataNet.delegate?.downloadThumbnailSuccess(metadataNet)
- }
-
- @objc func downloadThumbnailFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger) {
-
- NSLog("[LOG] Thumbnail Error \(metadataNet.fileName!) \(message) error %\(errorCode))")
+ metadataNet.delegate?.downloadThumbnailSuccessFailure(metadataNet, message: message, errorCode: errorCode)
}
// --------------------------------------------------------------------------------------------
@@ -387,16 +375,13 @@ class CCActions: NSObject {
appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
}
- @objc func settingFavoriteSuccess(_ metadataNet: CCMetadataNet) {
+ @objc func settingFavoriteSuccessFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger) {
- metadataNet.delegate?.settingFavoriteSuccess(metadataNet)
- }
-
- @objc func settingFavoriteFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger) {
-
- appDelegate.messageNotification("_favorites_", description: message as String, visible: true, delay:TimeInterval(k_dismissAfterSecond), type:TWMessageBarMessageType.error, errorCode: errorCode)
+ if (errorCode != 0) {
+ appDelegate.messageNotification("_favorites_", description: message as String, visible: true, delay:TimeInterval(k_dismissAfterSecond), type:TWMessageBarMessageType.error, errorCode: errorCode)
+ }
- metadataNet.delegate?.settingFavoriteFailure(metadataNet, message: message, errorCode: errorCode)
+ metadataNet.delegate?.settingFavoriteSuccessFailure(metadataNet, message: message, errorCode: errorCode)
}
// --------------------------------------------------------------------------------------------
@@ -414,14 +399,9 @@ class CCActions: NSObject {
appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
}
- @objc func listingFavoritesSuccess(_ metadataNet: CCMetadataNet, metadatas: [tableMetadata]) {
-
- metadataNet.delegate?.listingFavoritesSuccess(metadataNet, metadatas: metadatas)
- }
-
- @objc func listingFavoritesFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger) {
+ @objc func listingFavoritesSuccessFailure(_ metadataNet: CCMetadataNet, metadatas: [tableMetadata], message: NSString, errorCode: NSInteger) {
- metadataNet.delegate?.listingFavoritesFailure(metadataNet, message: message, errorCode: errorCode)
+ metadataNet.delegate?.listingFavoritesSuccessFailure(metadataNet, metadatas: metadatas, message: message, errorCode: errorCode)
}
// --------------------------------------------------------------------------------------------
diff --git a/iOSClient/AppDelegate.h b/iOSClient/AppDelegate.h
index b55fdbfdf..e3c7ec1d2 100644
--- a/iOSClient/AppDelegate.h
+++ b/iOSClient/AppDelegate.h
@@ -131,9 +131,6 @@
// Setting Active Account
- (void)settingActiveAccount:(NSString *)activeAccount activeUrl:(NSString *)activeUrl activeUser:(NSString *)activeUser activeUserID:(NSString *)activeUserID activePassword:(NSString *)activePassword;
-// initializations
-- (void)applicationInitialized;
-
// Quick Actions - ShotcutItem
- (void)configDynamicShortcutItems;
- (BOOL)handleShortCutItem:(UIApplicationShortcutItem *)shortcutItem;
diff --git a/iOSClient/AppDelegate.m b/iOSClient/AppDelegate.m
index 03063d04c..350b096b3 100644
--- a/iOSClient/AppDelegate.m
+++ b/iOSClient/AppDelegate.m
@@ -106,11 +106,11 @@
NSLog(@"[LOG] Start program group -----------------");
NSLog(@"%@", dirGroup);
NSLog(@"[LOG] Start program application -----------");
- NSLog(@"%@", [[CCUtility getDirectoryLocal] stringByDeletingLastPathComponent]);
+ NSLog(@"%@", [[CCUtility getDirectoryDocuments] stringByDeletingLastPathComponent]);
NSLog(@"[LOG] -------------------------------------");
- // create Directory local => Documents
- dir = [CCUtility getDirectoryLocal];
+ // create Directory Documents
+ dir = [CCUtility getDirectoryDocuments];
if (![[NSFileManager defaultManager] fileExistsAtPath: dir] && [dir length])
[[NSFileManager defaultManager] createDirectoryAtPath:dir withIntermediateDirectories:YES attributes:nil error:nil];
@@ -119,7 +119,7 @@
if (![[NSFileManager defaultManager] fileExistsAtPath: dir] && [dir length])
[[NSFileManager defaultManager] createDirectoryAtPath:dir withIntermediateDirectories:YES attributes:nil error:nil];
- // create dir Database Nextcloud
+ // create Directory database Nextcloud
dir = [[dirGroup URLByAppendingPathComponent:appDatabaseNextcloud] path];
if (![[NSFileManager defaultManager] fileExistsAtPath:dir])
[[NSFileManager defaultManager] createDirectoryAtPath:dir withIntermediateDirectories:YES attributes:nil error:nil];
@@ -147,6 +147,14 @@
}
}
+#ifdef DEBUG
+ NSLog(@"[LOG] Copy DB on Documents directory");
+ NSString *atPathDB = [NSString stringWithFormat:@"%@/nextcloud.realm", [[dirGroup URLByAppendingPathComponent:appDatabaseNextcloud] path]];
+ NSString *toPathDB = [NSString stringWithFormat:@"%@/nextcloud.realm", [CCUtility getDirectoryDocuments]];
+ [[NSFileManager defaultManager] removeItemAtPath:toPathDB error:nil];
+ [[NSFileManager defaultManager] copyItemAtPath:atPathDB toPath:toPathDB error:nil];
+#endif
+
// Operation Queue OC Networking
_netQueue = [[NSOperationQueue alloc] init];
_netQueue.name = k_queue;
@@ -241,20 +249,16 @@
// L' applicazione entrerà in primo piano (attivo solo dopo il background)
//
- (void)applicationWillEnterForeground:(UIApplication *)application
-{
- // refresh active Main
- if (_activeMain) {
- [_activeMain reloadDatasource];
- [_activeMain readFileReloadFolder];
- }
+{
+ // Test Maintenance
+ if (self.activeAccount.length == 0 || self.maintenanceMode)
+ return;
- // refresh Photos tab
- if (_activePhotos) {
- [_activePhotos reloadDatasourceForced];
- }
+ NSLog(@"[LOG] Request Service Server Nextcloud");
+ [[NCService sharedInstance] startRequestServicesServer];
- // Initializations
- [self applicationInitialized];
+ NSLog(@"[LOG] Initialize Auto upload");
+ [[NCAutoUpload sharedInstance] initStateAutoUpload];
}
//
@@ -262,7 +266,18 @@
//
- (void)applicationDidBecomeActive:(UIApplication *)application
{
-
+ // Test Maintenance
+ if (self.activeAccount.length == 0 || self.maintenanceMode)
+ return;
+
+ // verify Upload
+ [self verifyUploadInErrorOrWait];
+
+ // middelware ping
+ if ([[NCBrandOptions sharedInstance] use_middlewarePing]) {
+ NSLog(@"[LOG] Middleware Ping");
+ [[NCService sharedInstance] middlewarePing];
+ }
}
//
@@ -297,50 +312,6 @@
NSLog(@"[LOG] bye bye, Nextcloud !");
}
-//
-// Application Initialized
-//
-- (void)applicationInitialized
-{
- // Test Maintenance
- if (self.maintenanceMode)
- return;
-
- // Execute : now
- NSLog(@"[LOG] Update Folder Photo");
- NSString *autoUploadPath = [[NCManageDatabase sharedInstance] getAccountAutoUploadPath:_activeUrl];
- if ([autoUploadPath length] > 0) {
-
- NSString *fileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
- NSString *serverUrl = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:_activeUrl];
-
- [[CCSynchronize sharedSynchronize] readFileForFolder:fileName serverUrl:serverUrl selector:selectorReadFileFolder];
- }
-
- // Execute : after 1 sec.
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
-
- // verify Upload
- [self verifyUploadInErrorOrWait];
-
- if (_activeMain) {
- NSLog(@"[LOG] Request Server Capabilities");
- [_activeMain requestServerCapabilities];
- }
-
- if (_activeMain && [[NCBrandOptions sharedInstance] use_middlewarePing]) {
- NSLog(@"[LOG] Middleware Ping");
- [_activeMain middlewarePing];
- }
-
- NSLog(@"[LOG] Initialize Auto upload");
- [[NCAutoUpload sharedInstance] initStateAutoUpload];
-
- NSLog(@"[LOG] Listning Favorites");
- [_activeFavorites readListingFavorites];
- });
-}
-
#pragma --------------------------------------------------------------------------------------------
#pragma mark ===== Login =====
#pragma --------------------------------------------------------------------------------------------
@@ -745,22 +716,28 @@
if (visible) {
- if (errorcode == kCFURLErrorNotConnectedToInternet || errorcode == k_CCErrorNetworkNowAvailable) {
-
- if (errorCodePrev != errorcode)
- [JDStatusBarNotification showWithStatus:NSLocalizedString(@"_network_available_", nil) dismissAfter:delay styleName:JDStatusBarStyleDefault];
-
- errorCodePrev = errorcode;
-
- } else {
-
- if (description.length > 0) {
-
- [TWMessageBarManager sharedInstance].styleSheet = self;
- [[TWMessageBarManager sharedInstance] showMessageWithTitle:[NSString stringWithFormat:@"%@\n", NSLocalizedString(title, nil)] description:NSLocalizedString(description, nil) type:type duration:delay];
- }
+ switch (errorcode) {
+
+ // JDStatusBarNotification
+ case kCFURLErrorNotConnectedToInternet :
+
+ if (errorCodePrev != errorcode)
+ [JDStatusBarNotification showWithStatus:NSLocalizedString(title, nil) dismissAfter:delay styleName:JDStatusBarStyleDefault];
+
+ errorCodePrev = errorcode;
+ break;
+
+ // TWMessageBarManager
+ default:
+
+ if (description.length > 0) {
+
+ [TWMessageBarManager sharedInstance].styleSheet = self;
+ [[TWMessageBarManager sharedInstance] showMessageWithTitle:[NSString stringWithFormat:@"%@\n", NSLocalizedString(title, nil)] description:NSLocalizedString(description, nil) type:type duration:delay];
+ }
+ break;
}
-
+
} else {
[[TWMessageBarManager sharedInstance] hideAllAnimated:YES];
@@ -1212,10 +1189,8 @@
if (self.lastReachability == NO) {
- [self messageNotification:@"_network_available_" description:nil visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:k_CCErrorNetworkNowAvailable];
-
- if (_activeMain)
- [_activeMain performSelector:@selector(requestServerCapabilities) withObject:nil afterDelay:3];
+ NSLog(@"[LOG] Request Service Server Nextcloud");
+ [[NCService sharedInstance] startRequestServicesServer];
}
NSLog(@"[LOG] Reachability Changed: Reachable");
@@ -1366,9 +1341,9 @@
}
else if ([[_listChangeTask objectForKey:fileID] isEqualToString:@"reloadDownload"]) {
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
- [[CCNetworking sharedNetworking] downloadFile:metadata.fileName fileID:fileID serverUrl:serverUrl selector:metadata.sessionSelector selectorPost:metadata.sessionSelectorPost session:k_download_session taskStatus:k_taskStatusResume delegate:self.activeMain];
- });
+ [[NCManageDatabase sharedInstance] setMetadataSession:@"" sessionError:@"" sessionSelector:@"" sessionSelectorPost:@"" sessionTaskIdentifier:k_taskIdentifierDone predicate:[NSPredicate predicateWithFormat:@"fileID = %@", fileID]];
+
+ [[CCNetworking sharedNetworking] downloadFile:metadata.fileName fileID:fileID serverUrl:serverUrl selector:metadata.sessionSelector selectorPost:metadata.sessionSelectorPost session:k_download_session taskStatus:k_taskStatusResume delegate:self.activeMain];
}
else if ([[_listChangeTask objectForKey:metadata.fileID] isEqualToString:@"cancelUpload"]) {
@@ -1490,7 +1465,7 @@
if (errorCount >= k_maxErrorAutoUploadAll) {
- [self messageNotification:@"_error_" description:@"_too_errors_automatic_all_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [self messageNotification:@"_error_" description:@"_too_errors_automatic_all_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
[[NCManageDatabase sharedInstance] addActivityClient:@"" fileID:@"" action:k_activityDebugActionAutoUpload selector:selectorUploadAutoUploadAll note:@"_too_errors_automatic_all_" type:k_activityTypeFailure verbose:k_activityVerboseDefault activeUrl:_activeUrl];
@@ -1555,6 +1530,10 @@
- (void)verifyUploadInErrorOrWait
{
+ // Test Maintenance
+ if (self.maintenanceMode || self.activeAccount.length == 0)
+ return;
+
NSMutableSet *directoryIDs = [NSMutableSet new];
NSArray *metadatas = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND session CONTAINS 'upload' AND (sessionTaskIdentifier = %i OR sessionTaskIdentifier = %i)", _activeAccount, k_taskIdentifierError, k_taskIdentifierWaitStart] sorted:nil ascending:NO];
@@ -1570,6 +1549,7 @@
NSLog(@"[LOG] Re upload file : %@", metadata.fileName);
}
}
+
#pragma --------------------------------------------------------------------------------------------
#pragma mark ===== Open CCUploadFromOtherUpp =====
#pragma --------------------------------------------------------------------------------------------
@@ -1660,9 +1640,7 @@
//[[NCManageDatabase sharedInstance] clearTable:[tablePhotoLibrary class] account:nil];
}
}
-
- // VERSION < 2.19.1
-
+
if (([actualVersion compare:@"2.19.1" options:NSNumericSearch] == NSOrderedAscending)) {
[[NCManageDatabase sharedInstance] clearTable:[tableMetadata class] account:nil];
diff --git a/iOSClient/AutoUpload/NCAutoUpload.m b/iOSClient/AutoUpload/NCAutoUpload.m
index f32f4d5a9..0c903efc8 100644
--- a/iOSClient/AutoUpload/NCAutoUpload.m
+++ b/iOSClient/AutoUpload/NCAutoUpload.m
@@ -493,7 +493,7 @@
[[NCManageDatabase sharedInstance] addActivityClient:folderPhotos fileID:@"" action:k_activityDebugActionAutoUpload selector:selector note:NSLocalizedStringFromTable(@"_not_possible_create_folder_", @"Error", nil) type:k_activityTypeFailure verbose:k_activityVerboseDefault activeUrl:appDelegate.activeUrl];
if ([selector isEqualToString:selectorUploadAutoUploadAll])
- [appDelegate messageNotification:@"_error_" description:@"_error_createsubfolders_upload_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"_error_" description:@"_error_createsubfolders_upload_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
return false;
}
@@ -517,7 +517,7 @@
[[NCManageDatabase sharedInstance] addActivityClient:folderPathName fileID:@"" action:k_activityDebugActionAutoUpload selector:selector note:NSLocalizedString(@"_error_createsubfolders_upload_",nil) type:k_activityTypeFailure verbose:k_activityVerboseDefault activeUrl:appDelegate.activeUrl];
if ([selector isEqualToString:selectorUploadAutoUploadAll])
- [appDelegate messageNotification:@"_error_" description:@"_error_createsubfolders_upload_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"_error_" description:@"_error_createsubfolders_upload_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
return false;
}
diff --git a/iOSClient/Brand/Picker.plist b/iOSClient/Brand/Picker.plist
index 4f6eb6d6f..15d410a15 100644
--- a/iOSClient/Brand/Picker.plist
+++ b/iOSClient/Brand/Picker.plist
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
- <string>2.20.5</string>
+ <string>2.20.6</string>
<key>CFBundleVersion</key>
- <string>00002</string>
+ <string>00010</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
diff --git a/iOSClient/Brand/PickerFileProvider.plist b/iOSClient/Brand/PickerFileProvider.plist
index 60ea8c2a1..637ec9dc5 100644
--- a/iOSClient/Brand/PickerFileProvider.plist
+++ b/iOSClient/Brand/PickerFileProvider.plist
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
- <string>2.20.5</string>
+ <string>2.20.6</string>
<key>CFBundleVersion</key>
- <string>00002</string>
+ <string>00010</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionFileProviderDocumentGroup</key>
diff --git a/iOSClient/Brand/Share.plist b/iOSClient/Brand/Share.plist
index 851114ca8..67f98e3d3 100644
--- a/iOSClient/Brand/Share.plist
+++ b/iOSClient/Brand/Share.plist
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
- <string>2.20.5</string>
+ <string>2.20.6</string>
<key>CFBundleVersion</key>
- <string>00002</string>
+ <string>00010</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
diff --git a/iOSClient/Brand/iOSClient.plist b/iOSClient/Brand/iOSClient.plist
index 650e81deb..6fc002ae5 100644
--- a/iOSClient/Brand/iOSClient.plist
+++ b/iOSClient/Brand/iOSClient.plist
@@ -46,7 +46,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>2.20.5</string>
+ <string>2.20.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@@ -69,7 +69,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
- <string>00002</string>
+ <string>00010</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
diff --git a/iOSClient/CCGlobal.h b/iOSClient/CCGlobal.h
index 5357295ab..5da2e2ce5 100644
--- a/iOSClient/CCGlobal.h
+++ b/iOSClient/CCGlobal.h
@@ -139,9 +139,9 @@ extern NSString *const flowEndpoint;
// Error
#define k_CCErrorTaskNil -9999
#define k_CCErrorTaskDownloadNotFound -9998
+#define k_CCErrorUserNotAvailble -9997
#define k_CCErrorInternalError -9996
-#define k_CCErrorNetworkNowAvailable -9995
-#define k_CCErrorFileAlreadyInDownload -9994
+#define k_CCErrorFileAlreadyInDownload -9995
// Search
#define k_minCharsSearch 2
@@ -175,7 +175,8 @@ extern NSString *const flowEndpoint;
#define selectorRename @"rename"
#define selectorSave @"save"
#define selectorShare @"share"
-#define selectorSearch @"search"
+#define selectorSearchFiles @"searchFiles"
+#define selectorSearchContentType @"searchContentType"
#define selectorUnshare @"unshare"
#define selectorUpdateShare @"updateShare"
#define selectorUploadAutoUpload @"uploadAutoUpload"
diff --git a/iOSClient/Database/NCDatabase.swift b/iOSClient/Database/NCDatabase.swift
index a13c7eb71..d8c8e272e 100644
--- a/iOSClient/Database/NCDatabase.swift
+++ b/iOSClient/Database/NCDatabase.swift
@@ -38,6 +38,7 @@ class tableAccount: Object {
@objc dynamic var autoUploadVideo: Bool = false
@objc dynamic var autoUploadWWAnPhoto: Bool = false
@objc dynamic var autoUploadWWAnVideo: Bool = false
+ @objc dynamic var dateSearchContentTypeImageVideo = NSDate.distantPast
@objc dynamic var displayName = ""
@objc dynamic var email = ""
@objc dynamic var enabled: Bool = false
diff --git a/iOSClient/Database/NCManageDatabase.swift b/iOSClient/Database/NCManageDatabase.swift
index 5f15ef903..8d2e55c0d 100644
--- a/iOSClient/Database/NCManageDatabase.swift
+++ b/iOSClient/Database/NCManageDatabase.swift
@@ -57,7 +57,7 @@ class NCManageDatabase: NSObject {
let config = Realm.Configuration(
fileURL: dirGroup?.appendingPathComponent("\(appDatabaseNextcloud)/\(k_databaseDefault)"),
- schemaVersion: 17,
+ schemaVersion: 18,
// 10 : Version 2.18.0
// 11 : Version 2.18.2
@@ -67,6 +67,7 @@ class NCManageDatabase: NSObject {
// 15 : Version 2.19.2
// 16 : Version 2.20.2
// 17 : Version 2.20.4
+ // 18 : Version 2.20.6
migrationBlock: { migration, oldSchemaVersion in
// We haven’t migrated anything yet, so oldSchemaVersion == 0
@@ -228,6 +229,7 @@ class NCManageDatabase: NSObject {
@objc func getAccountActive() -> tableAccount? {
let realm = try! Realm()
+ realm.refresh()
guard let result = realm.objects(tableAccount.self).filter("active = true").first else {
return nil
@@ -239,6 +241,7 @@ class NCManageDatabase: NSObject {
@objc func getAccounts() -> [String]? {
let realm = try! Realm()
+ realm.refresh()
let results = realm.objects(tableAccount.self).sorted(byKeyPath: "account", ascending: true)
@@ -252,7 +255,8 @@ class NCManageDatabase: NSObject {
@objc func getAccount(predicate: NSPredicate) -> tableAccount? {
let realm = try! Realm()
-
+ realm.refresh()
+
if let result = realm.objects(tableAccount.self).filter(predicate).first {
return tableAccount.init(value: result)
}
@@ -263,7 +267,8 @@ class NCManageDatabase: NSObject {
@objc func getAccountAutoUploadFileName() -> String {
let realm = try! Realm()
-
+ realm.refresh()
+
guard let result = realm.objects(tableAccount.self).filter("active = true").first else {
return ""
}
@@ -278,7 +283,8 @@ class NCManageDatabase: NSObject {
@objc func getAccountAutoUploadDirectory(_ activeUrl : String) -> String {
let realm = try! Realm()
-
+ realm.refresh()
+
guard let result = realm.objects(tableAccount.self).filter("active = true").first else {
return ""
}
@@ -405,7 +411,7 @@ class NCManageDatabase: NSObject {
}
}
- @objc func setAccountsUserProfile(_ userProfile: OCUserProfile) -> tableAccount? {
+ @objc func setAccountUserProfile(_ userProfile: OCUserProfile) -> tableAccount? {
guard let activeAccount = self.getAccountActive() else {
return nil
@@ -448,13 +454,36 @@ class NCManageDatabase: NSObject {
return activeAccount
}
+ @objc func setAccountDateSearchContentTypeImageVideo(_ date: Date) {
+
+ guard let activeAccount = self.getAccountActive() else {
+ return
+ }
+
+ let realm = try! Realm()
+
+ do {
+ try realm.write {
+
+ guard let result = realm.objects(tableAccount.self).filter("account = %@", activeAccount.account).first else {
+ return
+ }
+
+ result.dateSearchContentTypeImageVideo = date
+ }
+ } catch let error {
+ print("[LOG] Could not write to database: ", error)
+ }
+ }
+
//MARK: -
//MARK: Table Activity
@objc func getActivity(predicate: NSPredicate) -> [tableActivity] {
let realm = try! Realm()
-
+ realm.refresh()
+
let results = realm.objects(tableActivity.self).filter(predicate).sorted(byKeyPath: "date", ascending: false)
return Array(results.map { tableActivity.init(value:$0) })
@@ -601,7 +630,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
return realm.objects(tableCapabilities.self).filter("account = %@", tableAccount.account).first
}
@@ -612,7 +642,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
guard let result = realm.objects(tableCapabilities.self).filter("account = %@", tableAccount.account).first else {
return 0
}
@@ -627,7 +658,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
guard let result = realm.objects(tableCapabilities.self).filter("account = %@", tableAccount.account).first else {
return 0
}
@@ -692,7 +724,8 @@ class NCManageDatabase: NSObject {
@objc func getCertificatesLocation(_ localCertificatesFolder: String) -> [String] {
let realm = try! Realm()
-
+ realm.refresh()
+
let results = realm.objects(tableCertificates.self)
return Array(results.map { "\(localCertificatesFolder)/\($0.certificateLocation)" })
@@ -760,7 +793,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
let results = realm.objects(tableDirectory.self).filter("account = %@ AND serverUrl BEGINSWITH %@", tableAccount.account, serverUrl)
// Delete table Metadata & LocalFile
@@ -854,6 +888,7 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
+ realm.refresh()
guard let result = realm.objects(tableDirectory.self).filter(predicate).first else {
return nil
@@ -869,6 +904,7 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
+ realm.refresh()
let results = realm.objects(tableDirectory.self).filter(predicate).sorted(byKeyPath: sorted, ascending: ascending)
@@ -890,7 +926,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND serverUrl = %@", tableAccount.account,serverUrl).first else {
return self.addDirectory(encrypted: false, favorite: false, fileID: nil, permissions: nil, serverUrl: serverUrl)?.directoryID
}
@@ -909,6 +946,7 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
+ realm.refresh()
guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND directoryID = %@", tableAccount.account, directoryID).first else {
return nil
@@ -926,7 +964,7 @@ class NCManageDatabase: NSObject {
let realm = try! Realm()
realm.beginWrite()
-
+
guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND directoryID = %@", tableAccount.account, directoryID).first else {
realm.cancelWrite()
return
@@ -1015,28 +1053,6 @@ class NCManageDatabase: NSObject {
}
}
- /*
- @objc func getDirectoryE2ETokenLock(serverUrl: String, completion: @escaping (String?) -> Void) {
-
- DispatchQueue.main.async {
-
- guard let tableAccount = self.getAccountActive() else {
- completion(nil)
- return
- }
-
- let realm = try! Realm()
-
- guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND serverUrl = %@ AND e2eTokenLock != ''", tableAccount.account, serverUrl).first else {
- completion(nil)
- return
- }
-
- completion(result.e2eTokenLock)
- }
- }
- */
-
//MARK: -
//MARK: Table e2e Encryption
@@ -1087,7 +1103,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
guard let result = realm.objects(tableE2eEncryption.self).filter(predicate).sorted(byKeyPath: "metadataKeyIndex", ascending: false).first else {
return nil
}
@@ -1102,7 +1119,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
let results : Results<tableE2eEncryption>
results = realm.objects(tableE2eEncryption.self).filter(predicate)
@@ -1174,7 +1192,6 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
- realm.refresh()
realm.beginWrite()
@@ -1201,7 +1218,6 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
- realm.refresh()
realm.beginWrite()
@@ -1276,7 +1292,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
let results = realm.objects(tableExternalSites.self).filter("account = %@", tableAccount.account).sorted(byKeyPath: "idExternalSite", ascending: true)
return Array(results)
@@ -1321,7 +1338,8 @@ class NCManageDatabase: NSObject {
@objc func getLocationFromGeoLatitude(_ latitude: String, longitude: String) -> String? {
let realm = try! Realm()
-
+ realm.refresh()
+
guard let result = realm.objects(tableGPS.self).filter("latitude = %@ AND longitude = %@", latitude, longitude).first else {
return nil
}
@@ -1426,7 +1444,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
guard let result = realm.objects(tableLocalFile.self).filter(predicate).first else {
return nil
}
@@ -1728,7 +1747,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
guard let result = realm.objects(tableMetadata.self).filter(predicate).first else {
return nil
}
@@ -1743,7 +1763,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
let results : Results<tableMetadata>
if let sorted = sorted {
@@ -1773,7 +1794,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
let results = realm.objects(tableMetadata.self).filter(predicate).sorted(byKeyPath: sorted, ascending: ascending)
if (results.count > 0 && results.count > index) {
@@ -1790,7 +1812,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
guard let result = realm.objects(tableMetadata.self).filter("account = %@ AND directoryID = %@ AND fileName = %@", tableAccount.account, directoryID, fileName).first else {
return nil
}
@@ -1842,22 +1865,75 @@ class NCManageDatabase: NSObject {
return self.getMetadatas(predicate: predicate, sorted: nil, ascending: false)
}
- @objc func getTableMetadatasPhotos(serverUrl: String) -> [tableMetadata]? {
+ @objc func getTableMetadatasContentTypeImageVideo() -> [tableMetadata]? {
guard let tableAccount = self.getAccountActive() else {
return nil
}
let realm = try! Realm()
-
- let directories = realm.objects(tableDirectory.self).filter(NSPredicate(format: "account = %@ AND serverUrl BEGINSWITH %@", tableAccount.account, serverUrl)).sorted(byKeyPath: "serverUrl", ascending: true)
- let directoriesID = Array(directories.map { $0.directoryID })
+ realm.refresh()
- let metadatas = realm.objects(tableMetadata.self).filter(NSPredicate(format: "account = %@ AND session = '' AND (typeFile = %@ OR typeFile = %@) AND directoryID IN %@", tableAccount.account, k_metadataTypeFile_image, k_metadataTypeFile_video, directoriesID)).sorted(byKeyPath: "date", ascending: false)
+ let metadatas = realm.objects(tableMetadata.self).filter(NSPredicate(format: "account = %@ AND NOT (session CONTAINS 'upload') AND (typeFile = %@ OR typeFile = %@)", tableAccount.account, k_metadataTypeFile_image, k_metadataTypeFile_video)).sorted(byKeyPath: "date", ascending: false)
return Array(metadatas.map { tableMetadata.init(value:$0) })
}
+ @objc func updateTableMetadatasContentTypeImageVideo(_ metadatas: [tableMetadata]) -> Bool {
+
+ guard let tableAccount = self.getAccountActive() else {
+ return false
+ }
+
+ let realm = try! Realm()
+ realm.refresh()
+
+ let metadatasDBImageVideo = realm.objects(tableMetadata.self).filter(NSPredicate(format: "account = %@ AND NOT (session CONTAINS 'upload') AND (typeFile = %@ OR typeFile = %@)", tableAccount.account, k_metadataTypeFile_image, k_metadataTypeFile_video))
+ let fileIDArrayDB = metadatasDBImageVideo.map({ $0.fileID }) as [String]
+ let fileIDArraySearch = metadatas.map({ $0.fileID }) as [String]
+
+ // DELETE RECORD IF NOT PRESENT ON DB [From DB To SEARCH]
+ var resultsDelete = [tableMetadata]()
+ for fileID in fileIDArrayDB {
+ if !(fileIDArraySearch.contains(fileID)) {
+ if let result = realm.objects(tableMetadata.self).filter("account = %@ AND fileID = %@", tableAccount.account, fileID).first {
+ resultsDelete.append(result)
+ }
+ }
+ }
+
+ // INSERT NEW RECORD ON DB [From SEARCH To DB]
+ var resultsInsert = [tableMetadata]()
+ for metadata in metadatas {
+ if !(fileIDArrayDB.contains(metadata.fileID)) {
+ resultsInsert.append(metadata)
+ }
+ }
+
+ do {
+ try realm.write {
+
+ // DELETE
+ for metadata in resultsDelete {
+ realm.delete(metadata)
+ }
+ // INSERT
+ for metadata in resultsInsert {
+ realm.add(metadata, update: true)
+ }
+ }
+ } catch let error {
+ print("[LOG] Could not write to database: ", error)
+ realm.cancelWrite()
+ return false
+ }
+
+ if (resultsDelete.count > 0 || resultsInsert.count > 0) {
+ return true
+ }
+ return false
+ }
+
//MARK: -
//MARK: Table Photo Library
@@ -1921,7 +1997,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
var predicate = NSPredicate()
if (image && video) {
@@ -2036,7 +2113,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
let results : Results<tableQueueDownload>
if let session = session {
@@ -2184,7 +2262,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
guard let result = realm.objects(tableQueueUpload.self).filter("account = %@ AND lock == false", tableAccount.account).sorted(byKeyPath: "date", ascending: true).first else {
return nil
}
@@ -2210,7 +2289,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
let results = realm.objects(tableQueueUpload.self).filter("account = %@ AND lock = true", tableAccount.account)
return Array(results.map { tableQueueUpload.init(value:$0) })
@@ -2223,7 +2303,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
let results = realm.objects(tableQueueUpload.self).filter(predicate)
return Array(results.map { tableQueueUpload.init(value:$0) })
@@ -2560,7 +2641,8 @@ class NCManageDatabase: NSObject {
}
let realm = try! Realm()
-
+ realm.refresh()
+
let results = realm.objects(tableShare.self).filter("account = %@", tableAccount.account).sorted(byKeyPath: "fileName", ascending: true)
return Array(results)
diff --git a/iOSClient/Favorites/CCFavorites.h b/iOSClient/Favorites/CCFavorites.h
index 9f1afe0f3..11a00814e 100644
--- a/iOSClient/Favorites/CCFavorites.h
+++ b/iOSClient/Favorites/CCFavorites.h
@@ -46,7 +46,8 @@
@property (nonatomic, weak) CCDetail *detailViewController;
@property (nonatomic, strong) UIDocumentInteractionController *docController;
-- (void)readListingFavorites;
+- (void)reloadDatasource;
+- (void)listingFavorites;
- (void)addFavoriteFolder:(NSString *)serverUrl;
@end
diff --git a/iOSClient/Favorites/CCFavorites.m b/iOSClient/Favorites/CCFavorites.m
index 232ffecf5..e17fe9edb 100644
--- a/iOSClient/Favorites/CCFavorites.m
+++ b/iOSClient/Favorites/CCFavorites.m
@@ -181,25 +181,17 @@
#pragma mark ===== Favorite <delegate> =====
#pragma--------------------------------------------------------------------------------------------
-- (void)settingFavoriteFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
+- (void)settingFavoriteSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
- NSLog(@"[LOG] Setting Favorite failure error %d, %@", (int)errorCode, message);
-}
-
-- (void)settingFavoriteSuccess:(CCMetadataNet *)metadataNet
-{
- [[NCManageDatabase sharedInstance] setMetadataFavoriteWithFileID:metadataNet.fileID favorite:[metadataNet.options boolValue]];
-
- [self reloadDatasource];
-}
-
-- (void)readListingFavorites
-{
- // test
- if (appDelegate.activeAccount.length == 0)
- return;
-
- [[CCActions sharedInstance] listingFavorites:@"" delegate:self];
+ if (errorCode == 0) {
+
+ [[NCManageDatabase sharedInstance] setMetadataFavoriteWithFileID:metadataNet.fileID favorite:[metadataNet.options boolValue]];
+ [self reloadDatasource];
+
+ } else {
+
+ NSLog(@"[LOG] Setting Favorite failure error %d, %@", (int)errorCode, message);
+ }
}
- (void)addFavoriteFolder:(NSString *)serverUrl
@@ -225,68 +217,75 @@
[appDelegate addNetworkingOperationQueue:appDelegate.netQueue delegate:[CCSynchronize sharedSynchronize] metadataNet:metadataNet];
}
-- (void)listingFavoritesSuccess:(CCMetadataNet *)metadataNet metadatas:(NSArray *)metadatas
+- (void)listingFavoritesSuccessFailure:(CCMetadataNet *)metadataNet metadatas:(NSArray *)metadatas message:(NSString *)message errorCode:(NSInteger)errorCode
{
// Check Active Account
if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
return;
- NSString *father = @"";
- NSMutableArray *filesEtag = [NSMutableArray new];
+ if (errorCode == 0) {
- for (tableMetadata *metadata in metadatas) {
-
- // insert for test NOT favorite
- [filesEtag addObject:metadata.fileID];
+ NSString *father = @"";
+ NSMutableArray *filesEtag = [NSMutableArray new];
- NSString *serverUrl = [[NCManageDatabase sharedInstance] getServerUrl:metadata.directoryID];
- NSString *serverUrlSon = [CCUtility stringAppendServerUrl:serverUrl addFileName:metadata.fileName];
-
- if (![serverUrlSon containsString:father]) {
+ for (tableMetadata *metadata in metadatas) {
+
+ // insert for test NOT favorite
+ [filesEtag addObject:metadata.fileID];
+
+ NSString *serverUrl = [[NCManageDatabase sharedInstance] getServerUrl:metadata.directoryID];
+ NSString *serverUrlSon = [CCUtility stringAppendServerUrl:serverUrl addFileName:metadata.fileName];
- if (metadata.directory) {
+ if (![serverUrlSon containsString:father]) {
- if ([CCUtility getFavoriteOffline])
- [[CCSynchronize sharedSynchronize] readFileForFolder:metadata.fileName serverUrl:serverUrl selector:selectorReadFileFolderWithDownload];
- else
- [[CCSynchronize sharedSynchronize] readFileForFolder:metadata.fileName serverUrl:serverUrl selector:selectorReadFileFolder];
-
- } else {
+ if (metadata.directory) {
+
+ if ([CCUtility getFavoriteOffline])
+ [[CCSynchronize sharedSynchronize] readFileForFolder:metadata.fileName serverUrl:serverUrl selector:selectorReadFileFolderWithDownload];
+ else
+ [[CCSynchronize sharedSynchronize] readFileForFolder:metadata.fileName serverUrl:serverUrl selector:selectorReadFileFolder];
+
+ } else {
+
+ if ([CCUtility getFavoriteOffline])
+ [[CCSynchronize sharedSynchronize] readFile:metadata selector:selectorReadFileWithDownload];
+ else
+ [[CCSynchronize sharedSynchronize] readFile:metadata selector:selectorReadFile];
+ }
- if ([CCUtility getFavoriteOffline])
- [[CCSynchronize sharedSynchronize] readFile:metadata selector:selectorReadFileWithDownload];
- else
- [[CCSynchronize sharedSynchronize] readFile:metadata selector:selectorReadFile];
+ father = serverUrlSon;
}
-
- father = serverUrlSon;
}
- }
-
- // Verify remove favorite
- NSArray *allRecordFavorite = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND favorite = true", appDelegate.activeAccount] sorted:nil ascending:NO];
-
- for (tableMetadata *metadata in allRecordFavorite)
- if (![filesEtag containsObject:metadata.fileID])
- [[NCManageDatabase sharedInstance] setMetadataFavoriteWithFileID:metadata.fileID favorite:NO];
+
+ // Verify remove favorite
+ NSArray *allRecordFavorite = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND favorite = true", appDelegate.activeAccount] sorted:nil ascending:NO];
+
+ for (tableMetadata *metadata in allRecordFavorite)
+ if (![filesEtag containsObject:metadata.fileID])
+ [[NCManageDatabase sharedInstance] setMetadataFavoriteWithFileID:metadata.fileID favorite:NO];
+
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"clearDateReadDataSource" object:nil];
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"clearDateReadDataSource" object:nil];
+ } else {
+
+ NSLog(@"[LOG] Listing Favorites failure error %d, %@", (int)errorCode, message);
+ }
}
-- (void)listingFavoritesFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
+- (void)listingFavorites
{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
+ // test
+ if (appDelegate.activeAccount.length == 0)
return;
- NSLog(@"[LOG] Listing Favorites failure error %d, %@", (int)errorCode, message);
+ [[CCActions sharedInstance] listingFavorites:@"" delegate:self];
}
#pragma --------------------------------------------------------------------------------------------
#pragma mark ==== Download Thumbnail <Delegate> ====
#pragma --------------------------------------------------------------------------------------------
-- (void)downloadThumbnailSuccess:(CCMetadataNet *)metadataNet
+- (void)downloadThumbnailSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
// Check Active Account
if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
@@ -510,7 +509,7 @@
recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND directoryID = %@", appDelegate.activeAccount, directoryID] sorted:sorted ascending:[CCUtility getAscendingSettings]];
}
- CCSectionDataSourceMetadata *sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil e2eEncryptions:nil groupByField:nil activeAccount:appDelegate.activeAccount];
+ CCSectionDataSourceMetadata *sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil groupByField:nil activeAccount:appDelegate.activeAccount];
NSArray *fileIDs = [sectionDataSource.sectionArrayRow objectForKey:@"_none_"];
for (NSString *fileID in fileIDs)
diff --git a/iOSClient/Images.xcassets/file_photo_encrypted.imageset/Contents.json b/iOSClient/Images.xcassets/file_photo_encrypted.imageset/Contents.json
new file mode 100644
index 000000000..a23e5d8ef
--- /dev/null
+++ b/iOSClient/Images.xcassets/file_photo_encrypted.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "photo@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+} \ No newline at end of file
diff --git a/iOSClient/Images.xcassets/file_photo_encrypted.imageset/photo@2x.png b/iOSClient/Images.xcassets/file_photo_encrypted.imageset/photo@2x.png
new file mode 100644
index 000000000..68ab2f6fb
--- /dev/null
+++ b/iOSClient/Images.xcassets/file_photo_encrypted.imageset/photo@2x.png
Binary files differ
diff --git a/iOSClient/Library/OCCommunicationLib/OCCapabilities.h b/iOSClient/Library/OCCommunicationLib/OCCapabilities.h
index 10327db05..4efe18986 100644
--- a/iOSClient/Library/OCCommunicationLib/OCCapabilities.h
+++ b/iOSClient/Library/OCCommunicationLib/OCCapabilities.h
@@ -51,6 +51,16 @@
// 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;
diff --git a/iOSClient/Library/OCCommunicationLib/OCCapabilities.m b/iOSClient/Library/OCCommunicationLib/OCCapabilities.m
index efde55520..a514804bf 100644
--- a/iOSClient/Library/OCCommunicationLib/OCCapabilities.m
+++ b/iOSClient/Library/OCCommunicationLib/OCCapabilities.m
@@ -30,7 +30,14 @@
self.themingSlogan = @"";
self.themingUrl = @"";
+ self.externalSiteV1 = @"";
+
self.endToEndEncryptionVersion = @"";
+
+ self.notificationOcsEndpoints = @"";
+ self.notificationPush = @"";
+
+ self.spreedFeatures = @"";
}
return self;
}
diff --git a/iOSClient/Library/OCCommunicationLib/OCCommunication.h b/iOSClient/Library/OCCommunicationLib/OCCommunication.h
index cfef6c24f..966333cb3 100755
--- a/iOSClient/Library/OCCommunicationLib/OCCommunication.h
+++ b/iOSClient/Library/OCCommunicationLib/OCCommunication.h
@@ -469,7 +469,7 @@ typedef enum {
/// @name Search
///-----------------------------------
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth dateLastModified:(NSString *)dateLastModified contentType:(NSString *)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 depth:(NSString *)depth dateLastModified:(NSString *)dateLastModified 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;
///-----------------------------------
/// @name Setting favorite
diff --git a/iOSClient/Library/OCCommunicationLib/OCCommunication.m b/iOSClient/Library/OCCommunicationLib/OCCommunication.m
index 709837d12..3e5376dfd 100644
--- a/iOSClient/Library/OCCommunicationLib/OCCommunication.m
+++ b/iOSClient/Library/OCCommunicationLib/OCCommunication.m
@@ -624,7 +624,7 @@
///-----------------------------------
/// @name search
///-----------------------------------
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth dateLastModified:(NSString *)dateLastModified contentType:(NSString *)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 depth:(NSString *)depth dateLastModified:(NSString *)dateLastModified 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";
@@ -639,14 +639,19 @@
if (successRequest) {
- NSData *responseData = (NSData*) responseObject;
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
+
+ NSData *responseData = (NSData*) responseObject;
- OCXMLListParser *parser = [OCXMLListParser new];
- [parser initParserWithData:responseData];
- NSMutableArray *searchList = [parser.searchList mutableCopy];
+ OCXMLListParser *parser = [OCXMLListParser new];
+ [parser initParserWithData:responseData];
+ NSMutableArray *searchList = [parser.searchList mutableCopy];
- //Return success
- successRequest(response, searchList, request.redirectedServer, token);
+ //Return success
+ dispatch_async(dispatch_get_main_queue(), ^{
+ successRequest(response, searchList, request.redirectedServer, token);
+ });
+ });
}
} failure:^(NSHTTPURLResponse *response, id responseData, NSError *error, NSString *token) {
@@ -818,17 +823,11 @@
failure(response, nil, request.redirectedServer);
}
-
} failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
failure(response, error, request.redirectedServer);
}];
-
-
-
-
}
-
- (void) readSharedByServer: (NSString *) path
onCommunication:(OCCommunication *)sharedOCCommunication
successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *listOfShared, NSString *redirectedServer)) successRequest
@@ -1386,10 +1385,29 @@
NSDictionary *externalSitesDic = [capabilitiesDict valueForKey:@"external"];
if (externalSitesDic) {
+ capabilities.isExternalSitesServerEnabled = YES;
NSArray *externalSitesArray = [externalSitesDic valueForKey:@"v1"];
- if (externalSitesArray)
- if ([[externalSitesArray objectAtIndex:0] isEqualToString:@"sites"])
- capabilities.isExternalSitesServerEnabled = YES;
+ capabilities.externalSiteV1 = [externalSitesArray 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
diff --git a/iOSClient/Library/OCCommunicationLib/OCFrameworkConstants.h b/iOSClient/Library/OCCommunicationLib/OCFrameworkConstants.h
index 4e67c9251..233d47793 100755
--- a/iOSClient/Library/OCCommunicationLib/OCFrameworkConstants.h
+++ b/iOSClient/Library/OCCommunicationLib/OCFrameworkConstants.h
@@ -32,6 +32,9 @@
//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
diff --git a/iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h b/iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h
index 93066c61b..67a68dbb4 100755
--- a/iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h
+++ b/iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h
@@ -196,7 +196,7 @@ extern NSString * _Nullable OCWebDAVModificationDateKey;
*/
-- (void)search:(NSString * _Nonnull)path folder:(NSString * _Nonnull)folder fileName:(NSString * _Nonnull)fileName depth:(NSString * _Nonnull)depth dateLastModified:(NSString * _Nonnull)dateLastModified contentType:(NSString * _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 * _Nonnull)path folder:(NSString * _Nonnull)folder fileName:(NSString * _Nonnull)fileName depth:(NSString * _Nonnull)depth dateLastModified:(NSString * _Nonnull)dateLastModified 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;
/**
diff --git a/iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m b/iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m
index 44c33bb24..4463ec44a 100755
--- a/iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m
+++ b/iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m
@@ -151,18 +151,18 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
}
-- (NSMutableURLRequest *)requestWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters {
+- (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: k_timeout_webdav];
+ [request setTimeoutInterval: timeout];
return request;
}
-- (NSMutableURLRequest *)sharedRequestWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters {
+- (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];
@@ -186,7 +186,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
success:(void(^)(NSHTTPURLResponse *, id))success
failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
_requestMethod = @"MOVE";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:source parameters:nil];
+ 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];
@@ -200,7 +200,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
_requestMethod = @"DELETE";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil];
+ 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];
@@ -214,7 +214,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
NSParameterAssert(success);
_requestMethod = @"PROPFIND";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil];
+ NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
[request setValue: depth forHTTPHeaderField: @"Depth"];
[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><D:resourcetype/><D:getlastmodified/><size xmlns=\"http://owncloud.org/ns\"/><favorite xmlns=\"http://owncloud.org/ns\"/><id xmlns=\"http://owncloud.org/ns\"/><D:getcontentlength/><D:getetag/><permissions xmlns=\"http://owncloud.org/ns\"/><D:getcontenttype/><nc:is-encrypted/></D:prop></D:propfind>" dataUsingEncoding:NSUTF8StringEncoding]];
@@ -233,7 +233,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
NSParameterAssert(success);
_requestMethod = @"PROPFIND";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil];
+ NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
[request setValue: depth forHTTPHeaderField: @"Depth"];
[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><D:resourcetype/><D:getlastmodified/><size xmlns=\"http://owncloud.org/ns\"/><favorite xmlns=\"http://owncloud.org/ns\"/><id xmlns=\"http://owncloud.org/ns\"/><D:getcontentlength/><D:getetag/><permissions xmlns=\"http://owncloud.org/ns\"/><D:getcontenttype/><nc:is-encrypted/></D:prop></D:propfind>" dataUsingEncoding:NSUTF8StringEncoding]];
@@ -266,51 +266,88 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
[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 dateLastModified:(NSString *)dateLastModified contentType:(NSString *)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 {
+- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth dateLastModified:(NSString *)dateLastModified 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 *body = @"";
+ NSString *whereType = @"";
NSParameterAssert(success);
_requestMethod = @"SEARCH";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil];
+ 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:getlastmodified />"
- "<d:getetag />"
- "<d:getcontenttype />"
- "<d:resourcetype/>"
- "<d:getcontentlength />"
- "<oc:fileid/>"
- "<oc:id/>"
- "<oc:permissions />"
- "<oc:size />"
- "<oc:favorite/>"
- "<nc:is-encrypted/>"
- "</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:getcontenttype/></d:prop>"
- //"<d:literal>image/%</d:literal>"
- "<d:prop><d:displayname/></d:prop>"
- "<d:literal>%@</d:literal>"
- "</d:like>"
- "</d:where>"
- "</d:basicsearch>"
- "</d:searchrequest>", userID, folder, fileName];
+ if (contentType && dateLastModified) {
+
+ 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:getlastmodified />"
+ "<d:getetag />"
+ "<d:getcontenttype />"
+ "<d:resourcetype/>"
+ "<d:getcontentlength />"
+ "<oc:fileid/>"
+ "<oc:id/>"
+ "<oc:permissions />"
+ "<oc:size />"
+ "<oc:favorite/>"
+ "<nc:is-encrypted/>"
+ "</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:and><d:or>", userID];
+
+ 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:gte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:gte></d:and></d:where></d:basicsearch></d:searchrequest>", body, whereType, dateLastModified];
+
+ } 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:getlastmodified />"
+ "<d:getetag />"
+ "<d:getcontenttype />"
+ "<d:resourcetype/>"
+ "<d:getcontentlength />"
+ "<oc:fileid/>"
+ "<oc:id/>"
+ "<oc:permissions />"
+ "<oc:size />"
+ "<oc:favorite/>"
+ "<nc:is-encrypted/>"
+ "</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>", userID, folder, fileName];
+ }
[request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
[request setValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
@@ -326,7 +363,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"PROPPATCH";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil];
+ NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_webdav];
NSString *body;
body = [NSString stringWithFormat: @""
@@ -357,7 +394,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"REPORT";
userID = [userID stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:[NSString stringWithFormat:@"%@/files/%@%@", path, userID, folder] parameters:nil];
+ NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:[NSString stringWithFormat:@"%@/files/%@%@", path, userID, folder] parameters:nil timeout:k_timeout_webdav];
body = [NSString stringWithFormat: @""
"<?xml version=\"1.0\"?>"
@@ -389,7 +426,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
- (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];
+ 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) {
@@ -430,7 +467,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
success:(void(^)(NSHTTPURLResponse *, id))success
failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
_requestMethod = @"HEAD";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil];
+ 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];
@@ -442,7 +479,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
success:(void(^)(NSHTTPURLResponse *, id))success
failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *))failure {
_requestMethod = @"MKCOL";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil];
+ 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];
@@ -463,7 +500,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
return nil;
} else {
- NSMutableURLRequest *request = [self requestWithMethod:@"PUT" path:remoteDestination parameters:nil];
+ 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];
@@ -511,7 +548,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"GET";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path: apiUserUrl parameters: nil];
+ 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];
@@ -527,7 +564,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"GET";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path: urlString parameters: nil];
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path: urlString parameters: nil timeout:k_timeout_webdav];
request.HTTPShouldHandleCookies = false;
@@ -545,7 +582,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"GET";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -563,7 +600,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
serverPath = [serverPath stringByAppendingString:postString];
_requestMethod = @"GET";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -578,7 +615,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"POST";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
_postStringForShare = [NSString stringWithFormat: @"path=%@&shareType=3&password=%@",filePath,password];
[request setHTTPBody:[_postStringForShare dataUsingEncoding:NSUTF8StringEncoding]];
@@ -595,7 +632,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"POST";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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]];
@@ -611,7 +648,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"POST";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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]];
@@ -630,7 +667,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"DELETE";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -646,7 +683,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"GET";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -662,7 +699,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"PUT";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
if (password) {
self.postStringForShare = [NSString stringWithFormat:@"password=%@",password];
@@ -695,7 +732,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
serverPath = [serverPath stringByAppendingString:searchQuery];
serverPath = [serverPath stringByAppendingString:pagination];
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -709,7 +746,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
NSParameterAssert(success);
_requestMethod = @"PROPFIND";
- NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:fileName parameters:nil];
+ NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:fileName parameters:nil timeout:k_timeout_webdav];
[request setHTTPBody:[@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><a:propfind xmlns:a=\"DAV:\" xmlns:b=\"http://open-collaboration-services.org/ns\"><a:prop><b:share-permissions/></a:prop></a:propfind>" dataUsingEncoding:NSUTF8StringEncoding]];
@@ -727,7 +764,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -745,7 +782,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
NSString *query = [NSString stringWithFormat:@"/%i/%i/%@", (int)fileWidth, (int)fileHeight, filePath];
serverPath = [serverPath stringByAppendingString:query];
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -762,7 +799,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -775,7 +812,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = type;
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -796,7 +833,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
serverPath = [serverPath stringByAppendingString:devicePublicKeyParam];
serverPath = [serverPath stringByAppendingString:proxyServerPathParam];
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
[request setValue:[NSString stringWithFormat:@"token %@", authorizationToken] forHTTPHeaderField:@"Authorization"];
OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
@@ -820,7 +857,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
serverPath = [serverPath stringByAppendingString:deviceIdentifierSignature];
serverPath = [serverPath stringByAppendingString:userPublicKey];
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
@@ -838,7 +875,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -854,7 +891,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -870,7 +907,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -884,7 +921,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"GET";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -898,7 +935,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"GET";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -912,7 +949,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"GET";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -928,7 +965,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"POST";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
[request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
_postStringKey = [NSString stringWithFormat: @"csr=%@",key];
@@ -947,7 +984,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"POST";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
[request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
_postStringKey = [NSString stringWithFormat: @"privateKey=%@",key];
@@ -964,7 +1001,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"DELETE";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -978,7 +1015,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"DELETE";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -992,7 +1029,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"PUT";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -1006,7 +1043,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"DELETE";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -1020,7 +1057,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"POST";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -1034,7 +1071,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"DELETE";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
[request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
// Add token
@@ -1053,7 +1090,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"GET";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -1069,7 +1106,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"POST";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
[request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
_postStringMetadata = [NSString stringWithFormat: @"metaData=%@",metadata];
@@ -1088,7 +1125,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"PUT";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
[request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
_postStringMetadata = [NSString stringWithFormat: @"metaData=%@",metadata];
@@ -1107,7 +1144,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
_requestMethod = @"DELETE";
- NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
+ 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];
@@ -1152,7 +1189,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
if (_postStringForShare) {
//It is a request to share a file by link
- requestRedirect = [self sharedRequestWithMethod:_requestMethod path:responseURLString parameters:nil];
+ requestRedirect = [self sharedRequestWithMethod:_requestMethod path:responseURLString parameters:nil timeout:k_timeout_webdav];
[requestRedirect setHTTPBody:[_postStringForShare dataUsingEncoding:NSUTF8StringEncoding]];
}
diff --git a/iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLListParser.m b/iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLListParser.m
index 703cf165d..2ddac4c6d 100644
--- a/iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLListParser.m
+++ b/iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLListParser.m
@@ -162,7 +162,7 @@
} else if ([elementName hasSuffix:@":getetag"] && [_xmlChars length]) {
//ETAG
- NSLog(@"getetag: %@", _xmlChars);
+ //NSLog(@"getetag: %@", _xmlChars);
NSString *stringClean = _xmlChars;
stringClean = [_xmlChars stringByReplacingOccurrencesOfString:@"\"" withString:@""];
diff --git a/iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLParser.m b/iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLParser.m
index e66533279..14dca2878 100644
--- a/iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLParser.m
+++ b/iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLParser.m
@@ -201,8 +201,9 @@ NSString *OCCWebDAVURIKey = @"uri";
_currentFile.ocId = _xmlChars;
} else if ([elementName hasSuffix:@":getetag"] && [_xmlChars length]) {
+
//ETAG
- NSLog(@"getetag: %@", _xmlChars);
+ //NSLog(@"getetag: %@", _xmlChars);
NSString *stringClean = _xmlChars;
stringClean = [_xmlChars stringByReplacingOccurrencesOfString:@"\"" withString:@""];
diff --git a/iOSClient/Library/SwiftWebVC/SwiftWebVC.swift b/iOSClient/Library/SwiftWebVC/SwiftWebVC.swift
index ff62bcf03..6722967a4 100644
--- a/iOSClient/Library/SwiftWebVC/SwiftWebVC.swift
+++ b/iOSClient/Library/SwiftWebVC/SwiftWebVC.swift
@@ -318,13 +318,16 @@ extension SwiftWebVC: WKNavigationDelegate {
}
public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
+
self.delegate?.didFinishLoading(success: true)
self.delegate?.didFinishLoading(success: true, url: webView.url!)
UIApplication.shared.isNetworkActivityIndicatorVisible = false
- webView.evaluateJavaScript("document.title") { (result, error) -> Void in
- if error == nil {
- self.navBarTitle.text = String(describing: result!)
+ webView.evaluateJavaScript("document.title") { result, error in
+ guard let title = result as? String else { return }
+
+ if (error == nil && self.navBarTitle != nil) {
+ self.navBarTitle.text = String(describing: title)
self.navBarTitle.sizeToFit()
self.updateToolbarItems()
}
diff --git a/iOSClient/Login/CCLogin.m b/iOSClient/Login/CCLogin.m
index 7ecbb9b4a..3d9d749ef 100644
--- a/iOSClient/Login/CCLogin.m
+++ b/iOSClient/Login/CCLogin.m
@@ -120,8 +120,10 @@
} else {
// Landscape
- self.bottomLabel.hidden = YES;
- self.loginTypeView.hidden = YES;
+ if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
+ self.bottomLabel.hidden = YES;
+ self.loginTypeView.hidden = YES;
+ }
}
// Brand
@@ -199,8 +201,10 @@
} else {
// Landscape
- self.bottomLabel.hidden = YES;
- self.loginTypeView.hidden = YES;
+ if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
+ self.bottomLabel.hidden = YES;
+ self.loginTypeView.hidden = YES;
+ }
}
}];
@@ -277,15 +281,7 @@
} else {
- if (![self serverStatus:data]) {
-
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_serverstatus_error_", nil) message:[error localizedDescription] preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
-
- [alertController addAction:okAction];
- [self presentViewController:alertController animated:YES completion:nil];
- return;
- }
+ [self serverStatus:data];
// Login Flow
if (_user.hidden && _password.hidden && versionMajor >= k_flow_version_available) {
@@ -339,14 +335,21 @@
}
}
-- (BOOL)serverStatus:(NSData *)data
+- (void)serverStatus:(NSData *)data
{
+ serverProductName = @"";
+ serverVersion = @"0.0.0";
+ serverVersionString = @"0.0.0";
+
+ versionMajor = 0;
+ versionMicro = 0;
+ versionMinor = 0;
+
NSError *error;
NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
- if (error) {
- return false;
- }
+ if (error)
+ return;
serverProductName = [jsongParsed valueForKey:@"productname"];
serverVersion = [jsongParsed valueForKey:@"version"];
@@ -357,11 +360,7 @@
versionMajor = [arrayVersion[0] integerValue];
versionMicro = [arrayVersion[1] integerValue];
versionMinor = [arrayVersion[2] integerValue];
- } else {
- return false;
}
-
- return true;
}
#pragma --------------------------------------------------------------------------------------------
@@ -399,10 +398,16 @@
[[NCManageDatabase sharedInstance] deleteAccount:account];
[[NCManageDatabase sharedInstance] addAccount:account url:url user:user password:password loginFlow:false];
- // Read User Profile
- CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:account];
- metadataNet.action = actionGetUserProfile;
- [appDelegate.netQueue addOperation:[[OCnetworking alloc] initWithDelegate:self metadataNet:metadataNet withUser:user withUserID:user withPassword:password withUrl:url]];
+ tableAccount *tableAccount = [[NCManageDatabase sharedInstance] setAccountActive:account];
+
+ // Setting appDelegate active account
+ [appDelegate settingActiveAccount:tableAccount.account activeUrl:tableAccount.url activeUser:tableAccount.user activeUserID:tableAccount.userID activePassword:tableAccount.password];
+
+ [self.delegate loginSuccess:_loginType];
+
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
+ [self dismissViewControllerAnimated:YES completion:nil];
+ });
}
} else {
@@ -426,66 +431,6 @@
}
#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== User Profile ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)getUserProfileFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
-{
- [[NCManageDatabase sharedInstance] deleteAccount:metadataNet.account];
-
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_error_", nil) message:message preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
-
- [alertController addAction:okAction];
- [self presentViewController:alertController animated:YES completion:nil];
-}
-
-- (void)getUserProfileSuccess:(CCMetadataNet *)metadataNet userProfile:(OCUserProfile *)userProfile
-{
- // Verify if the account already exists
- if (userProfile.id.length > 0 && self.baseUrl.text.length > 0 && self.user.text.length > 0) {
-
- tableAccount *accountAlreadyExists = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"url = %@ AND user = %@ AND userID != %@", self.baseUrl.text, userProfile.id, self.user.text]];
-
- if (accountAlreadyExists) {
-
- [[NCManageDatabase sharedInstance] deleteAccount:metadataNet.account];
-
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_error_", nil) message:[NSString stringWithFormat:NSLocalizedString(@"_account_already_exists_", nil), userProfile.id] preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
-
- [alertController addAction:okAction];
- [self presentViewController:alertController animated:YES completion:nil];
-
- return;
- }
- }
-
- // Verify if account is a valid account
- tableAccount *account = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account = %@", metadataNet.account]];
-
- if (account) {
-
- // Update User (+ userProfile.id)
- (void)[[NCManageDatabase sharedInstance] setAccountsUserProfile:userProfile];
-
- // Set this account as default
- tableAccount *account = [[NCManageDatabase sharedInstance] setAccountActive:metadataNet.account];
- if (account) {
-
- // Setting appDelegate active account
- [appDelegate settingActiveAccount:account.account activeUrl:account.url activeUser:account.user activeUserID:account.userID activePassword:account.password];
-
- [self.delegate loginSuccess:_loginType];
-
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
- [self dismissViewControllerAnimated:YES completion:nil];
- });
- }
- }
-}
-
-#pragma --------------------------------------------------------------------------------------------
#pragma mark == TextField ==
#pragma --------------------------------------------------------------------------------------------
diff --git a/iOSClient/Main/CCDetail.m b/iOSClient/Main/CCDetail.m
index 52803ddfc..f3deb5b68 100644
--- a/iOSClient/Main/CCDetail.m
+++ b/iOSClient/Main/CCDetail.m
@@ -654,9 +654,9 @@
NSString *serverUrl = [[NCManageDatabase sharedInstance] getServerUrl:metadata.directoryID];
if (serverUrl) {
- [[CCNetworking sharedNetworking] downloadFile:metadata.fileName fileID:metadata.fileID serverUrl:serverUrl selector:selectorLoadViewImage selectorPost:nil session:k_download_session taskStatus:k_taskStatusResume delegate:appDelegate.activeMain];
-
[_hud visibleHudTitle:@"" mode:MBProgressHUDModeDeterminate color:[NCBrandColor sharedInstance].brandElement];
+
+ [[CCNetworking sharedNetworking] downloadFile:metadata.fileName fileID:metadata.fileID serverUrl:serverUrl selector:selectorLoadViewImage selectorPost:nil session:k_download_session taskStatus:k_taskStatusResume delegate:appDelegate.activeMain];
}
}
@@ -864,6 +864,8 @@
- (void)handleSwipeUpDown
{
+ self.navigationController.navigationBarHidden = false; // iOS App is unusable after swipe up or down with PDF in fullscreen #526
+
[self removeAllView];
[self.navigationController popViewControllerAnimated:YES];
}
diff --git a/iOSClient/Main/CCMain.h b/iOSClient/Main/CCMain.h
index b93906db2..b7a042c5d 100644
--- a/iOSClient/Main/CCMain.h
+++ b/iOSClient/Main/CCMain.h
@@ -65,10 +65,14 @@
@property (nonatomic, strong) UIView *reMenuBackgroundView;
@property (nonatomic, strong) UITapGestureRecognizer *singleFingerTap;
@property (nonatomic, strong) UIImage *imageTitle;
+@property BOOL isSelectedMode;
+
- (void)closeAllMenu;
- (void)returnCreate:(NSInteger)type;
+- (void)setUINavigationBarDefault;
+
- (void)readFolder:(NSString *)serverUrl;
- (void)readFileReloadFolder;
@@ -81,9 +85,6 @@
- (void)reloadDatasource;
- (void)reloadDatasource:(NSString *)serverUrl;
-- (void)requestServerCapabilities;
-- (void)middlewarePing;
-
- (void)openWindowShare:(tableMetadata *)metadata;
- (void)clearDateReadDataSource:(NSNotification *)notification;
- (void)cancelSearchBar;
diff --git a/iOSClient/Main/CCMain.m b/iOSClient/Main/CCMain.m
index 54d69756b..c890812b3 100644
--- a/iOSClient/Main/CCMain.m
+++ b/iOSClient/Main/CCMain.m
@@ -46,8 +46,6 @@
BOOL _isRoot;
BOOL _isViewDidLoad;
- BOOL _isSelectedMode;
-
NSMutableDictionary *_selectedFileIDsMetadatas;
NSUInteger _numSelectedFileIDsMetadatas;
NSMutableArray *_queueSelector;
@@ -114,6 +112,9 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setTitle) name:@"setTitleMain" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(triggerProgressTask:) name:@"NotificationProgressTask" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
+
+ // Active Main
+ appDelegate.activeMain = self;
}
return self;
@@ -150,8 +151,9 @@
self.searchController.delegate = self;
self.searchController.searchBar.delegate = self;
+ // Actie Delegate Networking
[CCNetworking sharedNetworking].delegate = self;
-
+
// Custom Cell
[self.tableView registerNib:[UINib nibWithNibName:@"CCCellMain" bundle:nil] forCellReuseIdentifier:@"CellMain"];
[self.tableView registerNib:[UINib nibWithNibName:@"CCCellMainTransfer" bundle:nil] forCellReuseIdentifier:@"CellMainTransfer"];
@@ -183,9 +185,6 @@
// Settings this folder & delegate & Loading datasource
appDelegate.directoryUser = [CCUtility getDirectoryActiveUser:appDelegate.activeUser activeUrl:appDelegate.activeUrl];
- // Load Datasource
- [self reloadDatasource:_serverUrl];
-
// Read (File) Folder
[self readFileReloadFolder];
}
@@ -249,9 +248,6 @@
if (appDelegate.activeAccount.length > 0 && [_selectedFileIDsMetadatas count] == 0) {
- // Load Datasource
- [self reloadDatasource:_serverUrl];
-
// Read (file) Folder
[self readFileReloadFolder];
}
@@ -333,6 +329,14 @@
#pragma mark ===== Initizlize Mail =====
#pragma --------------------------------------------------------------------------------------------
+//
+// Callers :
+//
+// loginSuccess (delagate)
+// ChangeDefaultAccount (delegate)
+// Split : inizialize
+// Settings Advanced : removeAllFiles
+//
- (void)initializeMain:(NSNotification *)notification
{
_directoryGroupBy = nil;
@@ -368,36 +372,33 @@
appDelegate.sharesLink = results[0];
appDelegate.sharesUserAndGroup = results[1];
}
-
- // Load Datasource
- [self reloadDatasource:_serverUrl];
-
- // Read (File) Folder
- [self readFileReloadFolder];
-
+
// Setting Theming
[appDelegate settingThemingColorBrand];
- // Load photo datasorce
- if (appDelegate.activePhotos)
- [appDelegate.activePhotos reloadDatasourceForced];
-
// remove all of detail
- if (appDelegate.activeDetail)
- [appDelegate.activeDetail removeAllView];
+ [appDelegate.activeDetail removeAllView];
// remove all Notification Messages
[appDelegate.listOfNotifications removeAllObjects];
- // Not Photos Video in library ? then align
+ // Not Photos Video in library ? then align and Init Auto Upload
NSArray *recordsPhotoLibrary = [[NCManageDatabase sharedInstance] getPhotoLibraryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@", appDelegate.activeAccount]];
if ([recordsPhotoLibrary count] == 0) {
[[NCAutoUpload sharedInstance] alignPhotoLibrary];
}
+ [[NCAutoUpload sharedInstance] initStateAutoUpload];
+
+ NSLog(@"[LOG] Request Service Server Nextcloud");
+ [[NCService sharedInstance] startRequestServicesServer];
+
+ // Clear datasorce
+ [appDelegate.activePhotos reloadDatasource];
+ [appDelegate.activeFavorites reloadDatasource];
+
+ // Read this folder
+ [self readFileReloadFolder];
- // Initializations
- [appDelegate applicationInitialized];
-
} else {
// reload datasource
@@ -771,7 +772,7 @@
{
if (picker.selectedAssets.count > k_pickerControllerMax) {
- [appDelegate messageNotification:@"_info_" description:@"_limited_dimension_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:0];
+ [appDelegate messageNotification:@"_info_" description:@"_limited_dimension_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:k_CCErrorInternalError];
return NO;
}
@@ -916,6 +917,22 @@
}
#pragma --------------------------------------------------------------------------------------------
+#pragma mark ==== View Notification ====
+#pragma --------------------------------------------------------------------------------------------
+
+- (void)viewNotification
+{
+ if ([appDelegate.listOfNotifications count] > 0) {
+
+ CCNotification *notificationVC = [[UIStoryboard storyboardWithName:@"CCNotification" bundle:nil] instantiateViewControllerWithIdentifier:@"CCNotification"];
+
+ [notificationVC setModalPresentationStyle:UIModalPresentationFormSheet];
+
+ [self presentViewController:notificationVC animated:YES completion:nil];
+ }
+}
+
+#pragma --------------------------------------------------------------------------------------------
#pragma mark === Delegate Login ===
#pragma --------------------------------------------------------------------------------------------
@@ -978,338 +995,29 @@
}
#pragma mark -
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== External Sites ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)getExternalSitesServerSuccess:(CCMetadataNet *)metadataNet listOfExternalSites:(NSArray *)listOfExternalSites
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- [[NCManageDatabase sharedInstance] deleteExternalSites];
-
- for (OCExternalSites *tableExternalSites in listOfExternalSites)
- [[NCManageDatabase sharedInstance] addExternalSites:tableExternalSites];
-}
-
-- (void)getExternalSitesServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- NSString *error = [NSString stringWithFormat:@"Get external site failure error %d, %@", (int)errorCode, message];
- NSLog(@"[LOG] %@", error);
-
- [[NCManageDatabase sharedInstance] addActivityClient:@"" fileID:@"" action:k_activityDebugActionCapabilities selector:@"Get External Sites Server" note:error type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:appDelegate.activeUrl];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Activity ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)getActivityServerSuccess:(CCMetadataNet *)metadataNet listOfActivity:(NSArray *)listOfActivity
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- [[NCManageDatabase sharedInstance] addActivityServer:listOfActivity];
-
- // Reload Activity Data Source
- [appDelegate.activeActivity reloadDatasource];
-}
-
-- (void)getActivityServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- NSString *error = [NSString stringWithFormat:@"Get Activity Server failure error %d, %@", (int)errorCode, message];
- NSLog(@"[LOG] %@", error);
-
- [[NCManageDatabase sharedInstance] addActivityClient:@"" fileID:@"" action:k_activityDebugActionCapabilities selector:@"Get Activity Server" note:error type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:appDelegate.activeUrl];
-}
-
#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Notification ====
+#pragma mark ==== Download Thumbnail Delegate ====
#pragma --------------------------------------------------------------------------------------------
-- (void)getNotificationServerSuccess:(CCMetadataNet *)metadataNet listOfNotifications:(NSArray *)listOfNotifications
+- (void)downloadThumbnailSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
// Check Active Account
if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
return;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
-
- // Order by date
- NSArray *sortedListOfNotifications = [listOfNotifications sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
-
- OCNotifications *notification1 = obj1, *notification2 = obj2;
-
- return [notification2.date compare: notification1.date];
+ if (errorCode == 0) {
- }];
-
- // verify if listOfNotifications is changed
- NSString *old = @"", *new = @"";
- for (OCNotifications *notification in listOfNotifications)
- new = [new stringByAppendingString:@(notification.idNotification).stringValue];
- for (OCNotifications *notification in appDelegate.listOfNotifications)
- old = [old stringByAppendingString:@(notification.idNotification).stringValue];
-
- if (![new isEqualToString:old]) {
+ NSIndexPath *indexPath = [_sectionDataSource.fileIDIndexPath objectForKey:metadataNet.fileID];
- appDelegate.listOfNotifications = [[NSMutableArray alloc] initWithArray:sortedListOfNotifications];
+ if ([self indexPathIsValid:indexPath]) {
- // reload Notification view
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"notificationReloadData" object:nil];
- }
-
- // Update NavigationBar
- if (!_isSelectedMode) {
-
- [self performSelectorOnMainThread:@selector(setUINavigationBarDefault) withObject:nil waitUntilDone:NO];
+ if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", appDelegate.directoryUser, metadataNet.fileID]])
+ [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}
- });
-}
-
-- (void)getNotificationServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- NSString *error = [NSString stringWithFormat:@"Get Notification Server failure error %d, %@", (int)errorCode, message];
- NSLog(@"[LOG] %@", error);
-
- [[NCManageDatabase sharedInstance] addActivityClient:@"" fileID:@"" action:k_activityDebugActionCapabilities selector:@"Get Notification Server" note:error type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:appDelegate.activeUrl];
-
- // Update NavigationBar
- if (!_isSelectedMode)
- [self setUINavigationBarDefault];
-}
-
-- (void)viewNotification
-{
- if ([appDelegate.listOfNotifications count] > 0) {
- CCNotification *notificationVC = [[UIStoryboard storyboardWithName:@"CCNotification" bundle:nil] instantiateViewControllerWithIdentifier:@"CCNotification"];
-
- [notificationVC setModalPresentationStyle:UIModalPresentationFormSheet];
-
- [self presentViewController:notificationVC animated:YES completion:nil];
- }
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== User Profile ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)getUserProfileFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- NSString *error = [NSString stringWithFormat:@"Get user profile failure error %d, %@", (int)errorCode, message];
- NSLog(@"[LOG] %@", error);
-
- [[NCManageDatabase sharedInstance] addActivityClient:@"" fileID:@"" action:k_activityDebugActionCapabilities selector:@"Get user profile Server" note:error type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:appDelegate.activeUrl];
-}
-
-- (void)getUserProfileSuccess:(CCMetadataNet *)metadataNet userProfile:(OCUserProfile *)userProfile
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- // Update User (+ userProfile.id) & active account & account network
- tableAccount *tableAccount = [[NCManageDatabase sharedInstance] setAccountsUserProfile:userProfile];
- if (tableAccount) {
- [[CCNetworking sharedNetworking] settingAccount];
- [appDelegate settingActiveAccount:tableAccount.account activeUrl:tableAccount.url activeUser:tableAccount.user activeUserID:tableAccount.userID activePassword:tableAccount.password];
} else {
- [appDelegate messageNotification:@"Account" description:@"Internal error : account not found" visible:true delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
- }
-
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
-
- NSString *address = [NSString stringWithFormat:@"%@/index.php/avatar/%@/128", appDelegate.activeUrl, appDelegate.activeUser];
- //UIImage *avatar = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]]; DEPRECATED iOS9
- UIImage *avatar = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[address stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]]]];
- if (avatar)
- [UIImagePNGRepresentation(avatar) writeToFile:[NSString stringWithFormat:@"%@/avatar.png", appDelegate.directoryUser] atomically:YES];
- else
- [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/avatar.png", appDelegate.directoryUser] error:nil];
-
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"changeUserProfile" object:nil];
- });
-}
-
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Capabilities ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)getCapabilitiesOfServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- // Unauthorized
- if (errorCode == kOCErrorServerUnauthorized)
- [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
-
- NSString *error = [NSString stringWithFormat:@"Get Capabilities failure error %d, %@", (int)errorCode, message];
- NSLog(@"[LOG] %@", error);
-
- [[NCManageDatabase sharedInstance] addActivityClient:@"" fileID:@"" action:k_activityDebugActionCapabilities selector:@"Get Capabilities of Server" note:error type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:appDelegate.activeUrl];
-
- // Change Theming color
- [appDelegate settingThemingColorBrand];
-}
-
-- (void)getCapabilitiesOfServerSuccess:(CCMetadataNet *)metadataNet capabilities:(OCCapabilities *)capabilities
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- // Update capabilities db
- [[NCManageDatabase sharedInstance] addCapabilities:capabilities];
-
- // ------ THEMING -----------------------------------------------------------------------
-
- // Download Theming Background & Change Theming color
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
-
- if ([NCBrandOptions sharedInstance].use_themingBackground == YES) {
-
- //UIImage *themingBackground = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[capabilities.themingBackground stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]]; DEPRECATED iOS9
- UIImage *themingBackground = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[capabilities.themingBackground stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]]]];
- if (themingBackground) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [UIImagePNGRepresentation(themingBackground) writeToFile:[NSString stringWithFormat:@"%@/themingBackground.png", appDelegate.directoryUser] atomically:YES];
- });
- } else {
- [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/themingBackground.png", appDelegate.directoryUser] error:nil];
- }
- }
-
- dispatch_async(dispatch_get_main_queue(), ^{
- [appDelegate settingThemingColorBrand];
- });
- });
-
- // ------ SEARCH ------------------------------------------------------------------------
-
- // Search bar if change version
- if ([[NCManageDatabase sharedInstance] getServerVersion] != capabilities.versionMajor) {
-
- [self cancelSearchBar];
- }
-
- // ------ GET SERVICE SERVER ------------------------------------------------------------
-
- //CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:appDelegate.activeAccount];
-
- // Read External Sites
- if (capabilities.isExternalSitesServerEnabled) {
-
- metadataNet.action = actionGetExternalSitesServer;
- [appDelegate addNetworkingOperationQueue:appDelegate.netQueue delegate:self metadataNet:metadataNet];
- }
-
- // Read Share
- if (capabilities.isFilesSharingAPIEnabled) {
-
- [appDelegate.sharesID removeAllObjects];
- metadataNet.action = actionReadShareServer;
- [appDelegate addNetworkingOperationQueue:appDelegate.netQueue delegate:self metadataNet:metadataNet];
- }
-
- // Read Notification
- metadataNet.action = actionGetNotificationServer;
- [appDelegate addNetworkingOperationQueue:appDelegate.netQueue delegate:self metadataNet:metadataNet];
-
- // Read User Profile
- metadataNet.action = actionGetUserProfile;
- [appDelegate addNetworkingOperationQueue:appDelegate.netQueue delegate:self metadataNet:metadataNet];
-
- // Read Activity
- metadataNet.action = actionGetActivityServer;
- [appDelegate addNetworkingOperationQueue:appDelegate.netQueue delegate:self metadataNet:metadataNet];
-}
-
-#pragma mark -
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Request Server Information ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)requestServerCapabilities
-{
- // test
- if (appDelegate.activeAccount.length == 0)
- return;
-
- CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:appDelegate.activeAccount];
-
- metadataNet.action = actionGetCapabilities;
- [appDelegate addNetworkingOperationQueue:appDelegate.netQueue delegate:self metadataNet:metadataNet];
-}
-
-#pragma mark -
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Middleware Ping ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)middlewarePing
-{
- // test
- if (appDelegate.activeAccount.length == 0)
- return;
-
- CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:appDelegate.activeAccount];
-
- metadataNet.action = actionMiddlewarePing;
- metadataNet.serverUrl = [[NCBrandOptions sharedInstance] middlewarePingUrl];
- [appDelegate addNetworkingOperationQueue:appDelegate.netQueue delegate:self metadataNet:metadataNet];
-}
-
-#pragma mark -
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Download Thumbnail Delegate ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)downloadThumbnailFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- NSLog(@"[LOG] Download Thumbnail Failure error %d, %@", (int)errorCode, message);
-}
-
-- (void)downloadThumbnailSuccess:(CCMetadataNet *)metadataNet
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- NSIndexPath *indexPath = [_sectionDataSource.fileIDIndexPath objectForKey:metadataNet.fileID];
-
- if ([self indexPathIsValid:indexPath]) {
-
- if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", appDelegate.directoryUser, metadataNet.fileID]])
- [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
+ NSLog(@"[LOG] Download Thumbnail Failure error %d, %@", (int)errorCode, message);
}
}
@@ -1333,6 +1041,7 @@
// add Favorite
if ([selector isEqualToString:selectorAddFavorite]) {
[[CCActions sharedInstance] settingFavorite:metadata favorite:YES delegate:self];
+ [self reloadDatasource:serverUrl];
}
// open View File
@@ -1386,7 +1095,7 @@
if (image)
UIImageWriteToSavedPhotosAlbum(image, self, @selector(saveSelectedFilesSelector: didFinishSavingWithError: contextInfo:), nil);
else
- [appDelegate messageNotification:@"_save_selected_files_" description:@"_file_not_saved_cameraroll_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"_save_selected_files_" description:@"_file_not_saved_cameraroll_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
}
if ([metadata.typeFile isEqualToString: k_metadataTypeFile_video] && status == PHAuthorizationStatusAuthorized) {
@@ -1397,7 +1106,7 @@
UISaveVideoAtPathToSavedPhotosAlbum([NSTemporaryDirectory() stringByAppendingString:metadata.fileNameView], self, @selector(saveSelectedFilesSelector: didFinishSavingWithError: contextInfo:), nil);
} else {
- [appDelegate messageNotification:@"_save_selected_files_" description:@"_file_not_saved_cameraroll_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"_save_selected_files_" description:@"_file_not_saved_cameraroll_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
}
}
@@ -1671,32 +1380,29 @@
#pragma mark ==== Read File ====
#pragma --------------------------------------------------------------------------------------------
-- (void)readFileFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
+- (void)readFileSuccessFailure:(CCMetadataNet *)metadataNet metadata:(tableMetadata *)metadata message:(NSString *)message errorCode:(NSInteger)errorCode
{
// Check Active Account
if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
return;
- // Unauthorized
- if (errorCode == kOCErrorServerUnauthorized)
- [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
-}
-
-- (void)readFileSuccess:(CCMetadataNet *)metadataNet metadata:(tableMetadata *)metadata
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
+ if (errorCode == 0) {
- // Read Folder
- if ([metadataNet.selector isEqualToString:selectorReadFileReloadFolder]) {
-
- tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", metadataNet.account, metadataNet.serverUrl]];
-
- // Change etag, read folder
- if ([metadata.etag isEqualToString:directory.etag] == NO) {
- [self readFolder:metadataNet.serverUrl];
+ // Read Folder
+ if ([metadataNet.selector isEqualToString:selectorReadFileReloadFolder]) {
+
+ tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", metadataNet.account, metadataNet.serverUrl]];
+
+ // Change etag, read folder
+ if ([metadata.etag isEqualToString:directory.etag] == NO) {
+ [self readFolder:metadataNet.serverUrl];
+ }
}
+
+ } else {
+ // Unauthorized
+ if (errorCode == kOCErrorServerUnauthorized)
+ [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
}
}
@@ -1705,6 +1411,9 @@
if (!_serverUrl || !appDelegate.activeAccount || appDelegate.maintenanceMode)
return;
+ // Load Datasource
+ [self reloadDatasource];
+
CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:appDelegate.activeAccount];
metadataNet.action = actionReadFile;
@@ -1719,40 +1428,40 @@
#pragma mark ==== Read Folder ====
#pragma --------------------------------------------------------------------------------------------
-- (void)readFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
+- (void)readFolderSuccessFailure:(CCMetadataNet *)metadataNet metadataFolder:(tableMetadata *)metadataFolder metadatas:(NSArray *)metadatas message:(NSString *)message errorCode:(NSInteger)errorCode
{
// stoprefresh
[_refreshControl endRefreshing];
- _loadingFolder = NO;
-
// Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
+ if (![metadataNet.account isEqualToString:metadataNet.account])
return;
- // Unauthorized
- if (errorCode == kOCErrorServerUnauthorized) {
- [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
-
- } else {
- [self tableViewReloadData];
+ // ERROR
+ if (errorCode != 0) {
+
+ _loadingFolder = NO;
+
+ // Check Active Account
+ if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
+ return;
+
+ // Unauthorized
+ if (errorCode == kOCErrorServerUnauthorized) {
+ [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
+
+ } else {
+ [self tableViewReloadData];
+
+ [_ImageTitleHomeCryptoCloud setUserInteractionEnabled:YES];
+
+ [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+
+ [self reloadDatasource:metadataNet.serverUrl];
+ }
- [_ImageTitleHomeCryptoCloud setUserInteractionEnabled:YES];
-
- [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
-
- [self reloadDatasource:metadataNet.serverUrl];
- }
-}
-
-- (void)readFolderSuccess:(CCMetadataNet *)metadataNet metadataFolder:(tableMetadata *)metadataFolder metadatas:(NSArray *)metadatas
-{
- // stoprefresh
- [_refreshControl endRefreshing];
-
- // Check Active Account
- if (![metadataNet.account isEqualToString:metadataNet.account])
return;
+ }
// save metadataFolder
_metadataFolder = metadataFolder;
@@ -1932,7 +1641,7 @@
{
NSString *home = [CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl];
- [[CCActions sharedInstance] search:home fileName:_searchFileName depth:@"infinity" date:nil selector:selectorSearch delegate:self];
+ [[CCActions sharedInstance] search:home fileName:_searchFileName depth:@"infinity" date:nil contenType:nil selector:selectorSearchFiles delegate:self];
_noFilesSearchTitle = @"";
_noFilesSearchDescription = NSLocalizedString(@"_search_in_progress_", nil);
@@ -1970,10 +1679,10 @@
metadataNet.account = appDelegate.activeAccount;
metadataNet.directoryID = directoryID;
- metadataNet.selector = selectorSearch;
+ metadataNet.selector = selectorSearchFiles;
metadataNet.serverUrl = _serverUrl;
- [self readFolderSuccess:metadataNet metadataFolder:nil metadatas:_searchResultMetadatas];
+ [self readFolderSuccessFailure:metadataNet metadataFolder:nil metadatas:_searchResultMetadatas message:nil errorCode:0];
// Version >= 12
if ([[NCManageDatabase sharedInstance] getServerVersion] >= 12) {
@@ -1996,30 +1705,27 @@
[self readFolder:_serverUrl];
}
-- (void)searchFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- // Unauthorized
- if (errorCode == kOCErrorServerUnauthorized)
- [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
- else
- [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
-
- _searchFileName = @"";
-}
-
-- (void)searchSuccess:(CCMetadataNet *)metadataNet metadatas:(NSArray *)metadatas
+- (void)searchSuccessFailure:(CCMetadataNet *)metadataNet metadatas:(NSArray *)metadatas message:(NSString *)message errorCode:(NSInteger)errorCode
{
// Check Active Account
if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
return;
- _searchResultMetadatas = [[NSMutableArray alloc] initWithArray:metadatas];
+ if (errorCode == 0) {
- [self readFolderSuccess:metadataNet metadataFolder:nil metadatas:metadatas];
+ _searchResultMetadatas = [[NSMutableArray alloc] initWithArray:metadatas];
+ [self readFolderSuccessFailure:metadataNet metadataFolder:nil metadatas:metadatas message:nil errorCode:0];
+
+ } else {
+
+ // Unauthorized
+ if (errorCode == kOCErrorServerUnauthorized)
+ [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
+ else
+ [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+
+ _searchFileName = @"";
+ }
}
- (void)cancelSearchBar
@@ -2125,7 +1831,7 @@
// verify if exists the new fileName
if ([[NCManageDatabase sharedInstance] getE2eEncryptionWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@ AND fileName = %@", appDelegate.activeAccount, self.serverUrl, fileName]]) {
- [appDelegate messageNotification:@"_error_e2ee_" description:@"_file_already_exists_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"_error_e2ee_" description:@"_file_already_exists_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
return;
}
@@ -2361,42 +2067,44 @@
#pragma mark ===== Create folder =====
#pragma --------------------------------------------------------------------------------------------
-- (void)createFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
+- (void)createFolderSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
- // Unauthorized
- if (errorCode == kOCErrorServerUnauthorized)
- [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
- else
- [appDelegate messageNotification:@"_create_folder_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
-
- [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", metadataNet.fileID] clearDateReadDirectoryID:nil];
- [self reloadDatasource];
+ if (errorCode == 0) {
- // We are in directory fail ?
- CCMain *vc = [appDelegate.listMainVC objectForKey:[CCUtility stringAppendServerUrl:_serverUrl addFileName:metadataNet.fileName]];
- if (vc)
- [vc.navigationController popViewControllerAnimated:YES];
-}
-
-- (void)createFolderSuccess:(CCMetadataNet *)metadataNet
-{
- NSString *newDirectory = [NSString stringWithFormat:@"%@/%@", metadataNet.serverUrl, metadataNet.fileName];
-
- if (_metadataFolder.e2eEncrypted) {
+ NSString *newDirectory = [NSString stringWithFormat:@"%@/%@", metadataNet.serverUrl, metadataNet.fileName];
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- NSError *error = [[NCNetworkingSync sharedManager] markEndToEndFolderEncrypted:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl fileID:metadataNet.fileID serverUrl:newDirectory];
- dispatch_async(dispatch_get_main_queue(), ^{
- if (error) {
- [appDelegate messageNotification:@"_e2e_error_mark_folder_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
- }
- [self readFolder:self.serverUrl];
+ if (_metadataFolder.e2eEncrypted) {
+
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ NSError *error = [[NCNetworkingSync sharedManager] markEndToEndFolderEncrypted:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl fileID:metadataNet.fileID serverUrl:newDirectory];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (error) {
+ [appDelegate messageNotification:@"_e2e_error_mark_folder_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
+ }
+ [self readFolder:self.serverUrl];
+ });
});
- });
+
+ } else {
+
+ [self readFolder:self.serverUrl];
+ }
} else {
- [self readFolder:self.serverUrl];
+ // Unauthorized
+ if (errorCode == kOCErrorServerUnauthorized)
+ [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
+ else
+ [appDelegate messageNotification:@"_create_folder_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+
+ [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", metadataNet.fileID] clearDateReadDirectoryID:nil];
+ [self reloadDatasource];
+
+ // We are in directory fail ?
+ CCMain *vc = [appDelegate.listMainVC objectForKey:[CCUtility stringAppendServerUrl:_serverUrl addFileName:metadataNet.fileName]];
+ if (vc)
+ [vc.navigationController popViewControllerAnimated:YES];
}
}
@@ -2903,41 +2611,41 @@
#pragma mark ===== Favorite =====
#pragma --------------------------------------------------------------------------------------------
-- (void)settingFavoriteSuccess:(CCMetadataNet *)metadataNet
+- (void)settingFavoriteSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
// Check Active Account
if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
return;
- _dateReadDataSource = nil;
-
- [[NCManageDatabase sharedInstance] setMetadataFavoriteWithFileID:metadataNet.fileID favorite:[metadataNet.options boolValue]];
-
- if (_isSearchMode)
- [self readFolder:metadataNet.serverUrl];
- else
- [self reloadDatasource:metadataNet.serverUrl];
-
-
- tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", metadataNet.fileID]];
+ if (errorCode == 0) {
- if (metadata.directory && metadata.favorite) {
+ _dateReadDataSource = nil;
+
+ [[NCManageDatabase sharedInstance] setMetadataFavoriteWithFileID:metadataNet.fileID favorite:[metadataNet.options boolValue]];
+
+ if (_isSearchMode)
+ [self readFolder:metadataNet.serverUrl];
+ else
+ [self reloadDatasource:metadataNet.serverUrl];
+
- NSString *dir = [CCUtility stringAppendServerUrl:metadataNet.serverUrl addFileName:metadata.fileName];
+ tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", metadataNet.fileID]];
- [appDelegate.activeFavorites addFavoriteFolder:dir];
+ if (metadata.directory && metadata.favorite) {
+
+ NSString *dir = [CCUtility stringAppendServerUrl:metadataNet.serverUrl addFileName:metadata.fileName];
+
+ [appDelegate.activeFavorites addFavoriteFolder:dir];
+ }
+ } else {
+
+ if (errorCode == kOCErrorServerUnauthorized)
+ [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
+
+ NSLog(@"[LOG] Setting Favorite failure error %d, %@", (int)errorCode, message);
}
}
-- (void)settingFavoriteFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
-{
- // Unauthorized
- if (errorCode == kOCErrorServerUnauthorized)
- [appDelegate openLoginView:self loginType:loginModifyPasswordUser];
-
- NSLog(@"[LOG] Setting Favorite failure error %d, %@", (int)errorCode, message);
-}
-
- (void)addFavorite:(tableMetadata *)metadata
{
if (metadata.directory) {
@@ -3831,7 +3539,7 @@
if (![[NCManageDatabase sharedInstance] setDirectoryLockWithServerUrl:lockServerUrl lock:NO]) {
- [appDelegate messageNotification:@"_error_" description:@"_error_operation_canc_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"_error_" description:@"_error_operation_canc_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
}
[self tableViewReloadData];
@@ -3906,7 +3614,7 @@
} else {
- [appDelegate messageNotification:@"_error_" description:@"_error_operation_canc_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"_error_" description:@"_error_operation_canc_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
}
}
@@ -3974,7 +3682,7 @@
if (directory.lock && [[CCUtility getBlockCode] length] && appDelegate.sessionePasscodeLock == nil) {
- [appDelegate messageNotification:@"_error_" description:@"_folder_blocked_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"_error_" description:@"_folder_blocked_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
return;
}
@@ -4146,17 +3854,14 @@
// Clear data (old) Auto Upload
[[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:_autoUploadDirectory directoryID:nil];
-
- if (appDelegate.activeAccount.length > 0 && appDelegate.activePhotos)
- [appDelegate.activePhotos reloadDatasourceForced];
-
+
[self readFolder:serverUrl];
- NSLog(@"[LOG] Update Folder Photo");
- NSString *autoUploadPath = [[NCManageDatabase sharedInstance] getAccountAutoUploadPath:appDelegate.activeUrl];
- if ([autoUploadPath length] > 0) {
- [[CCSynchronize sharedSynchronize] readFileForFolder:_metadata.fileName serverUrl:serverUrl selector:selectorReadFileFolder];
- }
+ //NSLog(@"[LOG] Update Folder Photo");
+ //NSString *autoUploadPath = [[NCManageDatabase sharedInstance] getAccountAutoUploadPath:appDelegate.activeUrl];
+ //if ([autoUploadPath length] > 0) {
+ // [[CCSynchronize sharedSynchronize] readFileForFolder:_metadata.fileName serverUrl:serverUrl selector:selectorReadFileFolder];
+ //}
}];
}
@@ -4347,7 +4052,7 @@
// Search Mode
if (_isSearchMode) {
- _sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:_searchResultMetadatas listProgressMetadata:nil e2eEncryptions:nil groupByField:_directoryGroupBy activeAccount:appDelegate.activeAccount];
+ _sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:_searchResultMetadatas listProgressMetadata:nil groupByField:_directoryGroupBy activeAccount:appDelegate.activeAccount];
[self tableViewReloadData];
@@ -4418,10 +4123,9 @@
if (directoryID) {
NSArray *recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND directoryID = %@ AND status = %i", appDelegate.activeAccount, directoryID, k_metadataStatusNormal] sorted:sorted ascending:[CCUtility getAscendingSettings]];
- NSArray *recordsTableE2eEncryption = [[NCManageDatabase sharedInstance] getE2eEncryptionsWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", appDelegate.activeAccount, serverUrl]];
_sectionDataSource = [CCSectionDataSourceMetadata new];
- _sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil e2eEncryptions:recordsTableE2eEncryption groupByField:_directoryGroupBy activeAccount:appDelegate.activeAccount];
+ _sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil groupByField:_directoryGroupBy activeAccount:appDelegate.activeAccount];
// get auto upload folder
_autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
@@ -4539,7 +4243,8 @@
[_statusSwipeCell removeAllObjects];
for (MGSwipeTableCell *cell in self.tableView.visibleCells) {
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
- [_statusSwipeCell setObject:[NSNumber numberWithDouble:cell.swipeOffset] forKey:indexPath];
+ if (cell != nil && indexPath != nil)
+ [_statusSwipeCell setObject:[NSNumber numberWithDouble:cell.swipeOffset] forKey:indexPath];
}
// reload table view
diff --git a/iOSClient/Main/CCSection.h b/iOSClient/Main/CCSection.h
index 563745dcf..178379d76 100644
--- a/iOSClient/Main/CCSection.h
+++ b/iOSClient/Main/CCSection.h
@@ -38,11 +38,13 @@
@property NSInteger files;
@property double totalSize;
+- (id)copyWithZone:(NSZone *)zone;
+
@end
@interface CCSectionMetadata : NSObject
-+ (CCSectionDataSourceMetadata *)creataDataSourseSectionMetadata:(NSArray *)records listProgressMetadata:(NSMutableDictionary *)listProgressMetadata e2eEncryptions:(NSArray *)e2eEncryptions groupByField:(NSString *)groupByField activeAccount:(NSString *)activeAccount;
++ (CCSectionDataSourceMetadata *)creataDataSourseSectionMetadata:(NSArray *)records listProgressMetadata:(NSMutableDictionary *)listProgressMetadata groupByField:(NSString *)groupByField activeAccount:(NSString *)activeAccount;
+ (void)removeAllObjectsSectionDataSource:(CCSectionDataSourceMetadata *)sectionDataSource;
diff --git a/iOSClient/Main/CCSection.m b/iOSClient/Main/CCSection.m
index 0d70f442f..5b143632b 100644
--- a/iOSClient/Main/CCSection.m
+++ b/iOSClient/Main/CCSection.m
@@ -46,6 +46,26 @@
return self;
}
+- (id)copyWithZone: (NSZone *) zone
+{
+ CCSectionDataSourceMetadata *sectionDataSourceMetadata = [[CCSectionDataSourceMetadata allocWithZone: zone] init];
+
+ [sectionDataSourceMetadata setAllRecordsDataSource: self.allRecordsDataSource];
+ [sectionDataSourceMetadata setAllEtag: self.allEtag];
+ [sectionDataSourceMetadata setSections: self.sections];
+ [sectionDataSourceMetadata setSectionArrayRow: self.sectionArrayRow];
+ [sectionDataSourceMetadata setFileIDIndexPath: self.fileIDIndexPath];
+
+ [sectionDataSourceMetadata setVideo: self.video];
+ [sectionDataSourceMetadata setImage: self.image];
+
+ [sectionDataSourceMetadata setDirectories: self.directories];
+ [sectionDataSourceMetadata setFiles: self.files];
+ [sectionDataSourceMetadata setTotalSize: self.totalSize];
+
+ return sectionDataSourceMetadata;
+}
+
@end
@@ -54,7 +74,7 @@
//
// orderByField : nil, date, typeFile
//
-+ (CCSectionDataSourceMetadata *)creataDataSourseSectionMetadata:(NSArray *)records listProgressMetadata:(NSMutableDictionary *)listProgressMetadata e2eEncryptions:(NSArray *)e2eEncryptions groupByField:(NSString *)groupByField activeAccount:(NSString *)activeAccount
++ (CCSectionDataSourceMetadata *)creataDataSourseSectionMetadata:(NSArray *)records listProgressMetadata:(NSMutableDictionary *)listProgressMetadata groupByField:(NSString *)groupByField activeAccount:(NSString *)activeAccount
{
id dataSection;
long counterSessionDownload = 0;
diff --git a/iOSClient/Move/CCMove.m b/iOSClient/Move/CCMove.m
index 56fcf9fda..ddcc38faa 100644
--- a/iOSClient/Move/CCMove.m
+++ b/iOSClient/Move/CCMove.m
@@ -273,21 +273,21 @@
// MARK: - Read Folder
-- (void)readFileFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
+- (void)readFileSuccessFailure:(CCMetadataNet *)metadataNet metadata:(tableMetadata *)metadata message:(NSString *)message errorCode:(NSInteger)errorCode
{
- [self readFolder];
-}
-
-- (void)readFileSuccess:(CCMetadataNet *)metadataNet metadata:(tableMetadata *)metadata
-{
- if ([metadataNet.selector isEqualToString:selectorReadFileReloadFolder]) {
-
- tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", metadataNet.account, metadataNet.serverUrl]];
-
- if ([metadata.etag isEqualToString:directory.etag] == NO) {
+ if (errorCode == 0) {
+
+ if ([metadataNet.selector isEqualToString:selectorReadFileReloadFolder]) {
+
+ tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", metadataNet.account, metadataNet.serverUrl]];
- [self readFolder];
+ if ([metadata.etag isEqualToString:directory.etag] == NO) {
+
+ [self readFolder];
+ }
}
+ } else {
+ [self readFolder];
}
}
@@ -305,44 +305,46 @@
// MARK: - Read Folder
-- (void)readFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
+- (void)readFolderSuccessFailure:(CCMetadataNet *)metadataNet metadataFolder:(tableMetadata *)metadataFolder metadatas:(NSArray *)metadatas message:(NSString *)message errorCode:(NSInteger)errorCode
{
- _loadingFolder = NO;
- self.move.enabled = NO;
-
- [self.tableView reloadData];
-
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_error_",nil) message:message preferredStyle:UIAlertControllerStyleAlert];
-
- [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
- }]];
-
- [self presentViewController:alertController animated:YES completion:nil];
-}
-
-- (void)readFolderSuccess:(CCMetadataNet *)metadataNet metadataFolder:(tableMetadata *)metadataFolder metadatas:(NSArray *)metadatas
-{
- NSMutableArray *metadatasToInsertInDB = [NSMutableArray new];
-
- // Update directory etag
- [[NCManageDatabase sharedInstance] setDirectoryWithServerUrl:metadataNet.serverUrl serverUrlTo:nil etag:metadataFolder.etag fileID:metadataFolder.fileID encrypted:metadataFolder.e2eEncrypted];
-
- for (tableMetadata *metadata in metadatas) {
+ if (errorCode == 0) {
- // Insert in Array
- [metadatasToInsertInDB addObject:metadata];
- }
+ NSMutableArray *metadatasToInsertInDB = [NSMutableArray new];
+
+ // Update directory etag
+ [[NCManageDatabase sharedInstance] setDirectoryWithServerUrl:metadataNet.serverUrl serverUrlTo:nil etag:metadataFolder.etag fileID:metadataFolder.fileID encrypted:metadataFolder.e2eEncrypted];
+
+ for (tableMetadata *metadata in metadatas) {
+
+ // Insert in Array
+ [metadatasToInsertInDB addObject:metadata];
+ }
- // insert in Database
- metadatas = [[NCManageDatabase sharedInstance] addMetadatas:metadatasToInsertInDB serverUrl:metadataNet.serverUrl];
+ // insert in Database
+ metadatas = [[NCManageDatabase sharedInstance] addMetadatas:metadatasToInsertInDB serverUrl:metadataNet.serverUrl];
- // get auto upload folder
- _autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
- _autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:activeUrl];
-
- _loadingFolder = NO;
-
- [self.tableView reloadData];
+ // get auto upload folder
+ _autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
+ _autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:activeUrl];
+
+ _loadingFolder = NO;
+
+ [self.tableView reloadData];
+
+ } else {
+
+ _loadingFolder = NO;
+ self.move.enabled = NO;
+
+ [self.tableView reloadData];
+
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_error_",nil) message:message preferredStyle:UIAlertControllerStyleAlert];
+
+ [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+ }]];
+
+ [self presentViewController:alertController animated:YES completion:nil];
+ }
}
- (void)readFolder
@@ -364,20 +366,21 @@
// MARK: - Create Folder
-- (void)createFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
+- (void)createFolderSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_error_",nil) message:message preferredStyle:UIAlertControllerStyleAlert];
-
- [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
- }]];
+ if (errorCode == 0) {
- [self presentViewController:alertController animated:YES completion:nil];
-}
-
-- (void)createFolderSuccess:(CCMetadataNet *)metadataNet
-{
- // Load Folder or the Datasource
- [self readFolder];
+ [self readFolder];
+
+ } else {
+
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_error_",nil) message:message preferredStyle:UIAlertControllerStyleAlert];
+
+ [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+ }]];
+
+ [self presentViewController:alertController animated:YES completion:nil];
+ }
}
- (void)createFolder:(NSString *)fileNameFolder
diff --git a/iOSClient/Networking/CCNetworking.h b/iOSClient/Networking/CCNetworking.h
index 075904024..ccff4eaa0 100644
--- a/iOSClient/Networking/CCNetworking.h
+++ b/iOSClient/Networking/CCNetworking.h
@@ -90,7 +90,7 @@
@property (nonatomic, strong) NSString *account;
@property (nonatomic, strong) NSString *action;
@property (nonatomic, strong) NSString *assetLocalIdentifier;
-@property (nonatomic, strong) NSString *contentType;
+@property (nonatomic, strong) NSArray *contentType;
@property (nonatomic, strong) NSDate *date;
@property (nonatomic, weak) id delegate;
@property (nonatomic, strong) NSString *depth;
diff --git a/iOSClient/Networking/CCNetworking.m b/iOSClient/Networking/CCNetworking.m
index cacf33948..29435e3de 100644
--- a/iOSClient/Networking/CCNetworking.m
+++ b/iOSClient/Networking/CCNetworking.m
@@ -417,8 +417,11 @@
etag = [CCUtility removeForbiddenCharactersFileSystem:[fields objectForKey:@"OC-ETag"]];
NSString *dateString = [fields objectForKey:@"Date"];
- if (![dateFormatter getObjectValue:&date forString:dateString range:nil error:&error]) {
- NSLog(@"[LOG] Date '%@' could not be parsed: %@", dateString, error);
+ if (dateString) {
+ if (![dateFormatter getObjectValue:&date forString:dateString range:nil error:&error]) {
+ date = [NSDate date];
+ }
+ } else {
date = [NSDate date];
}
}
@@ -931,7 +934,7 @@
[request setValue:authValue forHTTPHeaderField:@"Authorization"];
[request setValue:[CCUtility getUserAgent] forHTTPHeaderField:@"User-Agent"];
- // Change date file upload with header : X-OC-Mtime (ctime assetLocalIdentifier)
+ // Change date file upload with header : X-OC-Mtime (ctime assetLocalIdentifier) image/video
if (assetLocalIdentifier) {
PHFetchResult *result = [PHAsset fetchAssetsWithLocalIdentifiers:@[assetLocalIdentifier] options:nil];
if (result.count) {
diff --git a/iOSClient/Networking/NCService.swift b/iOSClient/Networking/NCService.swift
new file mode 100644
index 000000000..a0d3d0f4c
--- /dev/null
+++ b/iOSClient/Networking/NCService.swift
@@ -0,0 +1,380 @@
+//
+// NCService.swift
+// Nextcloud
+//
+// Created by Marino Faggiana on 14/03/18.
+// Copyright © 2018 TWS. All rights reserved.
+//
+// Author Marino Faggiana <m.faggiana@twsweb.it>
+//
+// 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
+
+class NCService: NSObject, OCNetworkingDelegate {
+
+ let appDelegate = UIApplication.shared.delegate as! AppDelegate
+
+ @objc static let sharedInstance: NCService = {
+ let instance = NCService()
+ return instance
+ }()
+
+ //MARK: -
+ //MARK: Start Services API NC
+
+ @objc func startRequestServicesServer() {
+
+ if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
+ return
+ }
+
+ self.requestUserProfile()
+ self.requestServerCapabilities()
+ self.requestActivityServer()
+ }
+
+ //MARK: -
+ //MARK: Request Service API NC
+
+ @objc func requestServerCapabilities() {
+
+ if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
+ return
+ }
+
+ guard let metadataNet = CCMetadataNet.init(account: appDelegate.activeAccount) else {
+ return
+ }
+
+ metadataNet.action = actionGetCapabilities
+ appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
+ }
+
+ @objc func requestUserProfile() {
+
+ if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
+ return
+ }
+
+ guard let metadataNet = CCMetadataNet.init(account: appDelegate.activeAccount) else {
+ return
+ }
+
+ metadataNet.action = actionGetUserProfile
+ appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
+ }
+
+ @objc func requestActivityServer() {
+
+ if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
+ return
+ }
+
+ guard let metadataNet = CCMetadataNet.init(account: appDelegate.activeAccount) else {
+ return
+ }
+
+ metadataNet.action = actionGetActivityServer
+ appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
+ }
+
+ @objc func middlewarePing() {
+
+ if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
+ return
+ }
+
+ guard let metadataNet = CCMetadataNet.init(account: appDelegate.activeAccount) else {
+ return
+ }
+
+ metadataNet.action = actionMiddlewarePing
+ metadataNet.serverUrl = NCBrandOptions.sharedInstance.middlewarePingUrl
+
+ //appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
+ }
+
+ //MARK: -
+ //MARK: Delegate Service API NC
+
+ func getCapabilitiesOfServerSuccessFailure(_ metadataNet: CCMetadataNet!, capabilities: OCCapabilities?, message: String?, errorCode: Int) {
+
+ // Check Active Account
+ if (metadataNet.account != appDelegate.activeAccount) {
+ return
+ }
+
+ if (errorCode == 0) {
+
+ // Update capabilities db
+ NCManageDatabase.sharedInstance.addCapabilities(capabilities!)
+
+ // ------ THEMING -----------------------------------------------------------------------
+
+ if (NCBrandOptions.sharedInstance.use_themingBackground && capabilities!.themingBackground != "") {
+
+ // Download Theming Background & Change Theming color
+ DispatchQueue.global().async {
+
+ let address = capabilities!.themingBackground!.addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed)!
+ let fileName = "\(self.appDelegate.directoryUser!)/themingBackground.png"
+
+ guard let imageData = try? Data(contentsOf: URL(string: address)!) else {
+ DispatchQueue.main.async {
+ self.appDelegate.settingThemingColorBrand()
+ }
+ return
+ }
+
+ DispatchQueue.main.async {
+
+ guard let image = UIImage(data: imageData) else {
+ try? FileManager.default.removeItem(atPath: fileName)
+ self.appDelegate.settingThemingColorBrand()
+ return
+ }
+
+ if let data = UIImagePNGRepresentation(image) {
+ try? data.write(to: URL(fileURLWithPath: fileName))
+ }
+
+ self.appDelegate.settingThemingColorBrand()
+ }
+ }
+
+ } else {
+
+ self.appDelegate.settingThemingColorBrand()
+ }
+
+ // ------ SEARCH ------------------------------------------------------------------------
+
+ if (NCManageDatabase.sharedInstance.getServerVersion() != capabilities!.versionMajor && appDelegate.activeMain != nil) {
+ appDelegate.activeMain.cancelSearchBar()
+ }
+
+ // ------ GET OTHER SERVICE -------------------------------------------------------------
+
+ // Read Notification
+ if (capabilities!.isNotificationServerEnabled) {
+
+ metadataNet.action = actionGetNotificationServer
+ appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
+
+ } else {
+
+ // Remove all Notification
+ self.appDelegate.listOfNotifications.removeAllObjects()
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "notificationReloadData"), object: nil)
+ // Update Main NavigationBar
+ if (appDelegate.activeMain != nil && self.appDelegate.activeMain.isSelectedMode == false) {
+ self.appDelegate.activeMain.setUINavigationBarDefault()
+ }
+ }
+
+ // Read External Sites
+ if (capabilities!.isExternalSitesServerEnabled) {
+
+ metadataNet.action = actionGetExternalSitesServer
+ appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
+
+ } else {
+
+ NCManageDatabase.sharedInstance.deleteExternalSites()
+ }
+
+ // Read Share
+ if (capabilities!.isFilesSharingAPIEnabled && appDelegate.activeMain != nil) {
+
+ appDelegate.sharesID.removeAllObjects()
+ metadataNet.action = actionReadShareServer
+ appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: appDelegate.activeMain, metadataNet: metadataNet)
+ }
+
+ } else {
+
+ // Change Theming color
+ appDelegate.settingThemingColorBrand()
+
+ let error = "Get Capabilities failure error \(errorCode) \(message!)"
+ print("[LOG] \(error)")
+
+ NCManageDatabase.sharedInstance.addActivityClient("", fileID: "", action: k_activityDebugActionCapabilities, selector: "Get Capabilities of Server", note: error, type: k_activityTypeFailure, verbose: true, activeUrl: appDelegate.activeUrl)
+ }
+ }
+
+ @objc func getUserProfileSuccessFailure(_ metadataNet: CCMetadataNet!, userProfile: OCUserProfile?, message: String?, errorCode: Int) {
+
+ // Check Active Account
+ if (metadataNet.account != appDelegate.activeAccount) {
+ return
+ }
+
+ if (errorCode == 0) {
+
+ // Update User (+ userProfile.id) & active account & account network
+ guard let tableAccount = NCManageDatabase.sharedInstance.setAccountUserProfile(userProfile!) else {
+ appDelegate.messageNotification("Accopunt", description: "Internal error : account not found on DB", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: Int(k_CCErrorInternalError))
+ return
+ }
+
+ CCNetworking.shared().settingAccount()
+ appDelegate.settingActiveAccount(tableAccount.account, activeUrl: tableAccount.url, activeUser: tableAccount.user, activeUserID: tableAccount.userID, activePassword: tableAccount.password)
+
+ // Call func thath required the userdID
+ appDelegate.activeFavorites.listingFavorites()
+ appDelegate.activePhotos.searchPhotoVideo()
+
+ DispatchQueue.global(qos: .default).async {
+
+ let address = "\(self.appDelegate.activeUrl!)/index.php/avatar/\(self.appDelegate.activeUser!)/128".addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed)!
+ let fileName = "\(self.appDelegate.directoryUser!)/avatar.png"
+
+ guard let imageData = try? Data(contentsOf: URL(string: address)!) else {
+ DispatchQueue.main.async {
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "changeUserProfile"), object: nil)
+ }
+ return
+ }
+
+ DispatchQueue.main.async {
+
+ guard let image = UIImage(data: imageData) else {
+ try? FileManager.default.removeItem(atPath: fileName)
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "changeUserProfile"), object: nil)
+ return
+ }
+
+ if let data = UIImagePNGRepresentation(image) {
+ try? data.write(to: URL(fileURLWithPath: fileName))
+ }
+
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "changeUserProfile"), object: nil)
+ }
+ }
+
+ } else {
+
+ let error = "Get user profile failure error \(errorCode) \(message!)"
+ print("[LOG] \(error)")
+
+ NCManageDatabase.sharedInstance.addActivityClient("", fileID: "", action: k_activityDebugActionCapabilities, selector: "Get user profile Server", note: error, type: k_activityTypeFailure, verbose: true, activeUrl: appDelegate.activeUrl)
+ }
+ }
+
+ @objc func getExternalSitesServerSuccessFailure(_ metadataNet: CCMetadataNet!, listOfExternalSites: [Any]?, message: String?, errorCode: Int) {
+
+ // Check Active Account
+ if (metadataNet.account != appDelegate.activeAccount) {
+ return
+ }
+
+ if (errorCode == 0) {
+
+ NCManageDatabase.sharedInstance.deleteExternalSites()
+ for externalSites in listOfExternalSites! {
+ NCManageDatabase.sharedInstance.addExternalSites(externalSites as! OCExternalSites)
+ }
+
+ } else {
+
+ let error = "Get external site failure error \(errorCode) \(message!)"
+ print("[LOG] \(error)")
+
+ NCManageDatabase.sharedInstance.addActivityClient("", fileID: "", action: k_activityDebugActionCapabilities, selector: "Get external site Server", note: error, type: k_activityTypeFailure, verbose: true, activeUrl: appDelegate.activeUrl)
+ }
+ }
+
+ @objc func getActivityServerSuccessFailure(_ metadataNet: CCMetadataNet!, listOfActivity: [Any]?, message: String?, errorCode: Int) {
+
+ // Check Active Account
+ if (metadataNet.account != appDelegate.activeAccount) {
+ return
+ }
+
+ if (errorCode == 0) {
+
+ NCManageDatabase.sharedInstance.addActivityServer(listOfActivity as! [OCActivity])
+ if (appDelegate.activeActivity != nil) {
+ appDelegate.activeActivity.reloadDatasource()
+ }
+
+ } else {
+
+ let error = "Get Activity Server failure error \(errorCode) \(message!)"
+ print("[LOG] \(error)")
+
+ NCManageDatabase.sharedInstance.addActivityClient("", fileID: "", action: k_activityDebugActionCapabilities, selector: "Get Activity Server", note: error, type: k_activityTypeFailure, verbose: true, activeUrl: appDelegate.activeUrl)
+ }
+ }
+
+ @objc func getNotificationServerSuccessFailure(_ metadataNet: CCMetadataNet!, listOfNotifications: [Any]?, message: String?, errorCode: Int) {
+
+ // Check Active Account
+ if (metadataNet.account != appDelegate.activeAccount) {
+ return
+ }
+
+ if (errorCode == 0) {
+
+ DispatchQueue.global(qos: .default).async {
+
+ let sortedListOfNotifications = (listOfNotifications! as NSArray).sortedArray(using: [
+ NSSortDescriptor(key: "date", ascending: false)
+ ])
+
+ var old = ""
+ var new = ""
+
+ for notification in listOfNotifications! {
+ let id = (notification as AnyObject).idNotification!
+ new = new + String(describing: id)
+ }
+ for notification in self.appDelegate.listOfNotifications! {
+ let id = (notification as AnyObject).idNotification!
+ old = old + String(describing: id)
+ }
+
+
+ DispatchQueue.main.async {
+
+ if (new != old) {
+
+ self.appDelegate.listOfNotifications = NSMutableArray.init(array: sortedListOfNotifications)
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "notificationReloadData"), object: nil)
+
+ // Update Main NavigationBar
+ if (self.appDelegate.activeMain.isSelectedMode == false && self.appDelegate.activeMain != nil) {
+ self.appDelegate.activeMain.setUINavigationBarDefault()
+ }
+ }
+ }
+ }
+
+ } else {
+
+ let error = "Get Notification Server failure error \(errorCode) \(message!)"
+ print("[LOG] \(error)")
+
+ NCManageDatabase.sharedInstance.addActivityClient("", fileID: "", action: k_activityDebugActionCapabilities, selector: "Get Notification Server", note: error, type: k_activityTypeFailure, verbose: true, activeUrl: appDelegate.activeUrl)
+
+ // Update Main NavigationBar
+ if (appDelegate.activeMain.isSelectedMode == false && self.appDelegate.activeMain != nil) {
+ appDelegate.activeMain.setUINavigationBarDefault()
+ }
+ }
+ }
+}
diff --git a/iOSClient/Networking/OCNetworking.h b/iOSClient/Networking/OCNetworking.h
index eb8425ea2..59f43922b 100644
--- a/iOSClient/Networking/OCNetworking.h
+++ b/iOSClient/Networking/OCNetworking.h
@@ -48,14 +48,11 @@
@optional
-- (void)downloadThumbnailSuccess:(CCMetadataNet *)metadataNet;
-- (void)downloadThumbnailFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)downloadThumbnailSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
-- (void)readFolderSuccess:(CCMetadataNet *)metadataNet metadataFolder:(tableMetadata *)metadataFolder metadatas:(NSArray *)metadatas;
-- (void)readFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)readFolderSuccessFailure:(CCMetadataNet *)metadataNet metadataFolder:(tableMetadata *)metadataFolder metadatas:(NSArray *)metadatas message:(NSString *)message errorCode:(NSInteger)errorCode;
-- (void)createFolderSuccess:(CCMetadataNet *)metadataNet;
-- (void)createFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)createFolderSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
- (void)deleteFileOrFolderSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
@@ -63,8 +60,7 @@
- (void)renameSuccess:(CCMetadataNet *)metadataNet;
- (void)renameMoveFileOrFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
-- (void)readFileSuccess:(CCMetadataNet *)metadataNet metadata:(tableMetadata *)metadata;
-- (void)readFileFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)readFileSuccessFailure:(CCMetadataNet *)metadataNet metadata:(tableMetadata *)metadata message:(NSString *)message errorCode:(NSInteger)errorCode;
- (void)readSharedSuccess:(CCMetadataNet *)metadataNet items:(NSDictionary *)items openWindow:(BOOL)openWindow;
- (void)unShareSuccess:(CCMetadataNet *)metadataNet;
@@ -77,38 +73,27 @@
- (void)getSharePermissionsFileFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
// Capabilities
-- (void)getCapabilitiesOfServerSuccess:(CCMetadataNet *)metadataNet capabilities:(OCCapabilities *)capabilities;
-- (void)getCapabilitiesOfServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)getCapabilitiesOfServerSuccessFailure:(CCMetadataNet *)metadataNet capabilities:(OCCapabilities *)capabilities message:(NSString *)message errorCode:(NSInteger)errorCode;
// Activity
-- (void)getActivityServerSuccess:(CCMetadataNet *)metadataNet listOfActivity:(NSArray *)listOfActivity;
-- (void)getActivityServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)getActivityServerSuccessFailure:(CCMetadataNet *)metadataNet listOfActivity:(NSArray *)listOfActivity message:(NSString *)message errorCode:(NSInteger)errorCode;
// External Sites
-- (void)getExternalSitesServerSuccess:(CCMetadataNet *)metadataNet listOfExternalSites:(NSArray *)listOfExternalSites;
-- (void)getExternalSitesServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)getExternalSitesServerSuccessFailure:(CCMetadataNet *)metadataNet listOfExternalSites:(NSArray *)listOfExternalSites message:(NSString *)message errorCode:(NSInteger)errorCode;
// Notification
-- (void)getNotificationServerSuccess:(CCMetadataNet *)metadataNet listOfNotifications:(NSArray *)listOfNotifications;
-- (void)getNotificationServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
-
-- (void)setNotificationServerSuccess:(CCMetadataNet *)metadataNet;
-- (void)setNotificationServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)getNotificationServerSuccessFailure:(CCMetadataNet *)metadataNet listOfNotifications:(NSArray *)listOfNotifications message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)setNotificationServerSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
// User Profile
-- (void)getUserProfileSuccess:(CCMetadataNet *)metadataNet userProfile:(OCUserProfile *)userProfile;
-- (void)getUserProfileFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)getUserProfileSuccessFailure:(CCMetadataNet *)metadataNet userProfile:(OCUserProfile *)userProfile message:(NSString *)message errorCode:(NSInteger)errorCode;
// Search
-- (void)searchSuccess:(CCMetadataNet *)metadataNet metadatas:(NSArray *)metadatas;
-- (void)searchFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)searchSuccessFailure:(CCMetadataNet *)metadataNet metadatas:(NSArray *)metadatas message:(NSString *)message errorCode:(NSInteger)errorCode;
// Favorite
-- (void)settingFavoriteSuccess:(CCMetadataNet *)metadataNet;
-- (void)settingFavoriteFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
-
-- (void)listingFavoritesSuccess:(CCMetadataNet *)metadataNet metadatas:(NSArray *)metadatas;
-- (void)listingFavoritesFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)settingFavoriteSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
+- (void)listingFavoritesSuccessFailure:(CCMetadataNet *)metadataNet metadatas:(NSArray *)metadatas message:(NSString *)message errorCode:(NSInteger)errorCode;
// Subscribing Nextcloud Server
- (void)subscribingNextcloudServerFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
diff --git a/iOSClient/Networking/OCNetworking.m b/iOSClient/Networking/OCNetworking.m
index ee2ee33d5..6e88b8432 100644
--- a/iOSClient/Networking/OCNetworking.m
+++ b/iOSClient/Networking/OCNetworking.m
@@ -149,7 +149,8 @@
if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.%@", directoryUser, _metadataNet.fileID, ext]]) {
- [self.delegate downloadThumbnailSuccess:_metadataNet];
+ if ([self.delegate respondsToSelector:@selector(downloadThumbnailSuccessFailure:message:errorCode:)])
+ [self.delegate downloadThumbnailSuccessFailure:_metadataNet message:nil errorCode:0];
[self complete];
@@ -170,12 +171,13 @@
[CCGraphics saveIcoWithEtag:_metadataNet.fileID image:thumbnailImage writeToFile:[NSString stringWithFormat:@"%@/%@.%@", directoryUser, _metadataNet.fileID, ext] copy:NO move:NO fromPath:nil toPath:nil];
- if ([self.delegate respondsToSelector:@selector(downloadThumbnailSuccess:)] && [_metadataNet.action isEqualToString:actionDownloadThumbnail])
- [self.delegate downloadThumbnailSuccess:_metadataNet];
+ if ([self.delegate respondsToSelector:@selector(downloadThumbnailSuccessFailure:message:errorCode:)] && [_metadataNet.action isEqualToString:actionDownloadThumbnail])
+ [self.delegate downloadThumbnailSuccessFailure:_metadataNet message:nil errorCode:0];
+
} else {
- if ([self.delegate respondsToSelector:@selector(downloadThumbnailFailure:message:errorCode:)] && [_metadataNet.action isEqualToString:actionDownloadThumbnail])
- [self.delegate downloadThumbnailFailure:_metadataNet message:@"No data" errorCode:0];
+ if ([self.delegate respondsToSelector:@selector(downloadThumbnailSuccessFailure:message:errorCode:)] && [_metadataNet.action isEqualToString:actionDownloadThumbnail])
+ [self.delegate downloadThumbnailSuccessFailure:_metadataNet message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
}
[self complete];
@@ -187,12 +189,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(downloadThumbnailFailure:message:errorCode:)] && [_metadataNet.action isEqualToString:actionDownloadThumbnail]) {
+ if ([self.delegate respondsToSelector:@selector(downloadThumbnailSuccessFailure:message:errorCode:)] && [_metadataNet.action isEqualToString:actionDownloadThumbnail]) {
if (errorCode == 503)
- [self.delegate downloadThumbnailFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate downloadThumbnailSuccessFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate downloadThumbnailFailure:_metadataNet message:[CCError manageErrorOC:response.statusCode error:error] errorCode:errorCode];
+ [self.delegate downloadThumbnailSuccessFailure:_metadataNet message:[CCError manageErrorOC:response.statusCode error:error] errorCode:errorCode];
}
[self complete];
@@ -212,6 +214,16 @@
[communication readFolder:_metadataNet.serverUrl depth:_metadataNet.depth withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(readFolderSuccessFailure:metadataFolder:metadatas:message:errorCode:)])
+ [self.delegate readFolderSuccessFailure:_metadataNet metadataFolder:nil metadatas:nil message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
NSMutableArray *metadatas = [NSMutableArray new];
BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:_metadataNet.serverUrl account:_metadataNet.account];
@@ -222,13 +234,13 @@
#ifndef EXTENSION
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
- [appDelegate messageNotification:@"Server error" description:@"Read Folder WebDAV : [items NULL] please fix" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"Server error" description:@"Read Folder WebDAV : [items NULL] please fix" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
#endif
dispatch_async(dispatch_get_main_queue(), ^{
- if ([self.delegate respondsToSelector:@selector(readFolderSuccess:metadataFolder:metadatas:)])
- [self.delegate readFolderSuccess:_metadataNet metadataFolder:nil metadatas:metadatas];
+ if ([self.delegate respondsToSelector:@selector(readFolderSuccessFailure:metadataFolder:metadatas:message:errorCode:)])
+ [self.delegate readFolderSuccessFailure:_metadataNet metadataFolder:nil metadatas:metadatas message:nil errorCode:0];
});
[self complete];
@@ -272,8 +284,8 @@
if (!directoryIDFolder) {
dispatch_async(dispatch_get_main_queue(), ^{
- if ([self.delegate respondsToSelector:@selector(readFolderSuccess:metadataFolder:metadatas:)])
- [self.delegate readFolderSuccess:_metadataNet metadataFolder:metadataFolder metadatas:metadatas];
+ if ([self.delegate respondsToSelector:@selector(readFolderSuccessFailure:metadataFolder:metadatas:message:errorCode:)])
+ [self.delegate readFolderSuccessFailure:_metadataNet metadataFolder:metadataFolder metadatas:metadatas message:nil errorCode:0];
});
}
metadataFolder = [CCUtility trasformedOCFileToCCMetadata:itemDtoFolder fileName:[_metadataNet.serverUrl lastPathComponent] serverUrl:serverUrlFolder directoryID:directoryIDFolder autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:_metadataNet.account directoryUser:directoryUser isFolderEncrypted:isFolderEncrypted];
@@ -310,8 +322,7 @@
if ([itemDto.etag length] == 0) {
#ifndef EXTENSION
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-
- [appDelegate messageNotification:@"Server error" description:@"Metadata fileID absent, record excluded, please fix" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"Server error" description:@"Metadata fileID absent, record excluded, please fix" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
#endif
continue;
}
@@ -322,8 +333,8 @@
dispatch_async(dispatch_get_main_queue(), ^{
- if ([self.delegate respondsToSelector:@selector(readFolderSuccess:metadataFolder:metadatas:)])
- [self.delegate readFolderSuccess:_metadataNet metadataFolder:metadataFolder metadatas:metadatas];
+ if ([self.delegate respondsToSelector:@selector(readFolderSuccessFailure:metadataFolder:metadatas:message:errorCode:)])
+ [self.delegate readFolderSuccessFailure:_metadataNet metadataFolder:metadataFolder metadatas:metadatas message:nil errorCode:0];
});
});
@@ -336,12 +347,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(readFolderFailure:message:errorCode:)]) {
+ if ([self.delegate respondsToSelector:@selector(readFolderSuccessFailure:metadataFolder:metadatas:message:errorCode:)]) {
if (errorCode == 503)
- [self.delegate readFolderFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate readFolderSuccessFailure:_metadataNet metadataFolder:nil metadatas:nil message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate readFolderFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
+ [self.delegate readFolderSuccessFailure:_metadataNet metadataFolder:nil metadatas:nil message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
}
// Request trusted certificated
@@ -381,6 +392,16 @@
[communication search:path folder:folder fileName: [NSString stringWithFormat:@"%%%@%%", _metadataNet.fileName] depth:_metadataNet.depth dateLastModified:dateLastModified contentType:_metadataNet.contentType withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(searchSuccessFailure:metadatas:message:errorCode:)])
+ [self.delegate searchSuccessFailure:_metadataNet metadatas:nil message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
NSMutableArray *metadatas = [NSMutableArray new];
BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
@@ -408,8 +429,7 @@
if ([itemDto.etag length] == 0) {
#ifndef EXTENSION
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-
- [appDelegate messageNotification:@"Server error" description:@"Metadata fileID absent, record excluded, please fix" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"Server error" description:@"Metadata fileID absent, record excluded, please fix" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
#endif
continue;
}
@@ -423,19 +443,19 @@
serverUrl = [CCUtility stringAppendServerUrl:[_activeUrl stringByAppendingString:webDAV] addFileName:serverUrl];
if (itemDto.isDirectory) {
- // Add / update Directory
- (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:[NSString stringWithFormat:@"%@/%@", serverUrl, fileName]].directoryID;
+ directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:[NSString stringWithFormat:@"%@/%@", serverUrl, fileName]].directoryID;
+ } else {
+ directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrl];
}
isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:_metadataNet.account];
- directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrl];
[metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl directoryID:directoryID autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:_metadataNet.account directoryUser:directoryUser isFolderEncrypted:isFolderEncrypted]];
}
dispatch_async(dispatch_get_main_queue(), ^{
- if ([self.delegate respondsToSelector:@selector(searchSuccess:metadatas:)])
- [self.delegate searchSuccess:_metadataNet metadatas:metadatas];
+ if ([self.delegate respondsToSelector:@selector(searchSuccessFailure:metadatas:message:errorCode:)])
+ [self.delegate searchSuccessFailure:_metadataNet metadatas:metadatas message:nil errorCode:0];
});
});
@@ -449,12 +469,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(searchFailure:message:errorCode:)]) {
+ if ([self.delegate respondsToSelector:@selector(searchSuccessFailure:metadatas:message:errorCode:)]) {
if (errorCode == 503)
- [self.delegate searchFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate searchSuccessFailure:_metadataNet metadatas:nil message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate searchFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
+ [self.delegate searchSuccessFailure:_metadataNet metadatas:nil message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
}
// Request trusted certificated
@@ -480,8 +500,18 @@
[communication settingFavoriteServer:path andFileOrFolderPath:_metadataNet.fileName favorite:[_metadataNet.options boolValue] withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token) {
- if ([self.delegate respondsToSelector:@selector(settingFavoriteSuccess:)])
- [self.delegate settingFavoriteSuccess:_metadataNet];
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(settingFavoriteSuccessFailure:message:errorCode:)])
+ [self.delegate settingFavoriteSuccessFailure:_metadataNet message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
+ if ([self.delegate respondsToSelector:@selector(settingFavoriteSuccessFailure:message:errorCode:)])
+ [self.delegate settingFavoriteSuccessFailure:_metadataNet message:nil errorCode:0];
[self complete];
@@ -492,12 +522,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(settingFavoriteFailure:message:errorCode:)]) {
+ if ([self.delegate respondsToSelector:@selector(settingFavoriteSuccessFailure:message:errorCode:)]) {
if (errorCode == 503)
- [self.delegate settingFavoriteFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate settingFavoriteSuccessFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate settingFavoriteFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
+ [self.delegate settingFavoriteSuccessFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
}
// Request trusted certificated
@@ -524,6 +554,16 @@
[communication listingFavorites:path folder:folder withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(listingFavoritesSuccessFailure:metadatas:message:errorCode:)])
+ [self.delegate listingFavoritesSuccessFailure:_metadataNet metadatas:nil message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
NSMutableArray *metadatas = [NSMutableArray new];
BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
@@ -544,54 +584,60 @@
}];
- for(OCFileDto *itemDto in items) {
-
- NSString *serverUrl, *directoryID;
- BOOL isFolderEncrypted;
-
- NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
-
- // Skip hidden files
- if (fileName.length > 0) {
- if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
+
+ for(OCFileDto *itemDto in items) {
+
+ NSString *serverUrl, *directoryID;
+ BOOL isFolderEncrypted;
+
+ NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
+
+ // Skip hidden files
+ if (fileName.length > 0) {
+ if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
+ continue;
+ } else
continue;
- } else
- continue;
-
- // ----- BUG #942 ---------
- if ([itemDto.etag length] == 0) {
+
+ // ----- BUG #942 ---------
+ if ([itemDto.etag length] == 0) {
#ifndef EXTENSION
- AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-
- [appDelegate messageNotification:@"Server error" description:@"Metadata fileID absent, record excluded, please fix" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+ [appDelegate messageNotification:@"Server error" description:@"Metadata fileID absent, record excluded, please fix" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
#endif
- continue;
- }
- // ------------------------
-
- serverUrl = [itemDto.filePath stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@/files/%@", dav, _activeUserID] withString:@""];
- if ([serverUrl hasPrefix:@"/"])
- serverUrl = [serverUrl substringFromIndex:1];
- if ([serverUrl hasSuffix:@"/"])
- serverUrl = [serverUrl substringToIndex:[serverUrl length] - 1];
- serverUrl = [CCUtility stringAppendServerUrl:[_activeUrl stringByAppendingString:webDAV] addFileName:serverUrl];
-
- if (itemDto.isDirectory) {
- // Add / update Directory
- (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:[NSString stringWithFormat:@"%@/%@", serverUrl, fileName]].directoryID;
+ continue;
+ }
+ // ------------------------
+
+ serverUrl = [itemDto.filePath stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@/files/%@", dav, _activeUserID] withString:@""];
+ if ([serverUrl hasPrefix:@"/"])
+ serverUrl = [serverUrl substringFromIndex:1];
+ if ([serverUrl hasSuffix:@"/"])
+ serverUrl = [serverUrl substringToIndex:[serverUrl length] - 1];
+ serverUrl = [CCUtility stringAppendServerUrl:[_activeUrl stringByAppendingString:webDAV] addFileName:serverUrl];
+
+ if (itemDto.isDirectory) {
+ directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:[NSString stringWithFormat:@"%@/%@", serverUrl, fileName]].directoryID;
+ } else {
+ directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrl];
+ }
+
+ isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:_metadataNet.account];
+
+ [metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl directoryID:directoryID autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:_metadataNet.account directoryUser:directoryUser isFolderEncrypted:isFolderEncrypted]];
}
- isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:_metadataNet.account];
- directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrl];
-
- [metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl directoryID:directoryID autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:_metadataNet.account directoryUser:directoryUser isFolderEncrypted:isFolderEncrypted]];
- }
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if ([self.delegate respondsToSelector:@selector(listingFavoritesSuccessFailure:metadatas:message:errorCode:)])
+ [self.delegate listingFavoritesSuccessFailure:_metadataNet metadatas:metadatas message:nil errorCode:0];
+ });
- if ([self.delegate respondsToSelector:@selector(listingFavoritesSuccess:metadatas:)])
- [self.delegate listingFavoritesSuccess:_metadataNet metadatas:metadatas];
+ });
[self complete];
+
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
NSInteger errorCode = response.statusCode;
@@ -599,12 +645,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(listingFavoritesFailure:message:errorCode:)]) {
+ if ([self.delegate respondsToSelector:@selector(listingFavoritesSuccessFailure:metadatas:message:errorCode:)]) {
if (errorCode == 503)
- [self.delegate listingFavoritesFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate listingFavoritesSuccessFailure:_metadataNet metadatas:nil message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate listingFavoritesFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
+ [self.delegate listingFavoritesSuccessFailure:_metadataNet metadatas:nil message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
}
// Request trusted certificated
@@ -632,13 +678,23 @@
[communication createFolder:nameFolderURL onCommunication:communication withForbiddenCharactersSupported:YES successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(createFolderSuccessFailure:message:errorCode:)])
+ [self.delegate createFolderSuccessFailure:_metadataNet message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
NSDictionary *fields = [response allHeaderFields];
_metadataNet.fileID = [CCUtility removeForbiddenCharactersFileSystem:[fields objectForKey:@"OC-FileId"]];
_metadataNet.date = [CCUtility dateEnUsPosixFromCloud:[fields objectForKey:@"Date"]];
- if ([self.delegate respondsToSelector:@selector(createFolderSuccess:)])
- [self.delegate createFolderSuccess:_metadataNet];
+ if ([self.delegate respondsToSelector:@selector(createFolderSuccessFailure:message:errorCode:)])
+ [self.delegate createFolderSuccessFailure:_metadataNet message:nil errorCode:0];
[self complete];
@@ -655,8 +711,8 @@
if (errorCode == 0)
errorCode = error.code;
- if ([self.delegate respondsToSelector:@selector(createFolderFailure:message:errorCode:)])
- [self.delegate createFolderFailure:_metadataNet message:message errorCode:errorCode];
+ if ([self.delegate respondsToSelector:@selector(createFolderSuccessFailure:message:errorCode:)])
+ [self.delegate createFolderSuccessFailure:_metadataNet message:message errorCode:errorCode];
// Request trusted certificated
if ([error code] == NSURLErrorServerCertificateUntrusted)
@@ -679,12 +735,12 @@
}
// Error
- if ([self.delegate respondsToSelector:@selector(createFolderFailure:message:errorCode:)]) {
+ if ([self.delegate respondsToSelector:@selector(createFolderSuccessFailure:message:errorCode:)]) {
if (error.code == 503)
- [self.delegate createFolderFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:error.code];
+ [self.delegate createFolderSuccessFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:error.code];
else
- [self.delegate createFolderFailure:_metadataNet message:message errorCode:error.code];
+ [self.delegate createFolderSuccessFailure:_metadataNet message:message errorCode:error.code];
}
[self complete];
@@ -706,6 +762,16 @@
[communication deleteFileOrFolder:serverFileUrl onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(deleteFileOrFolderSuccessFailure:message:errorCode:)])
+ [self.delegate deleteFileOrFolderSuccessFailure:_metadataNet message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
if ([_metadataNet.selector rangeOfString:selectorDelete].location != NSNotFound && [self.delegate respondsToSelector:@selector(deleteFileOrFolderSuccessFailure:message:errorCode:)])
[self.delegate deleteFileOrFolderSuccessFailure:_metadataNet message:@"" errorCode:0];
@@ -822,8 +888,17 @@
[communication readFile:fileName onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
+ // Test active account
tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
- BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:fileName account:_metadataNet.account];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(readFileSuccessFailure:metadata:message:errorCode:)])
+ [self.delegate readFileSuccessFailure:_metadataNet metadata:nil message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
+ BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:_metadataNet.serverUrl account:_metadataNet.account];
if ([recordAccount.account isEqualToString:_metadataNet.account] && [items count] > 0) {
@@ -841,13 +916,13 @@
metadata = [CCUtility trasformedOCFileToCCMetadata:itemDto fileName:_metadataNet.fileName serverUrl:_metadataNet.serverUrl directoryID:directoryID autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:_metadataNet.account directoryUser:directoryUser isFolderEncrypted:isFolderEncrypted];
- if([self.delegate respondsToSelector:@selector(readFileSuccess:metadata:)])
- [self.delegate readFileSuccess:_metadataNet metadata:metadata];
+ if([self.delegate respondsToSelector:@selector(readFileSuccessFailure:metadata:message:errorCode:)])
+ [self.delegate readFileSuccessFailure:_metadataNet metadata:metadata message:nil errorCode:0];
} else {
- if([self.delegate respondsToSelector:@selector(readFileFailure:message:errorCode:)])
- [self.delegate readFileFailure:_metadataNet message:@"Directory not found" errorCode:0];
+ if([self.delegate respondsToSelector:@selector(readFileSuccessFailure:metadata:message:errorCode:)])
+ [self.delegate readFileSuccessFailure:_metadataNet metadata:nil message:@"Directory not found" errorCode:k_CCErrorInternalError];
}
}
@@ -857,10 +932,10 @@
#ifndef EXTENSION
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
- [appDelegate messageNotification:@"Server error" description:@"Read File WebDAV : [items NULL] please fix" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"Server error" description:@"Read File WebDAV : [items NULL] please fix" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
#endif
- if([self.delegate respondsToSelector:@selector(readFileFailure:message:errorCode:)])
- [self.delegate readFileFailure:_metadataNet message:@"Read File WebDAV : [items NULL] please fix" errorCode:0];
+ if([self.delegate respondsToSelector:@selector(readFileSuccessFailure:metadata:message:errorCode:)])
+ [self.delegate readFileSuccessFailure:_metadataNet metadata:nil message:@"Read File WebDAV : [items NULL] please fix" errorCode:k_CCErrorInternalError];
}
[self complete];
@@ -876,12 +951,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(readFileFailure:message:errorCode:)] && [recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(readFileSuccessFailure:metadata:message:errorCode:)] && [recordAccount.account isEqualToString:_metadataNet.account]) {
if (errorCode == 503)
- [self.delegate readFileFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate readFileSuccessFailure:_metadataNet metadata:nil message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate readFileFailure:_metadataNet message:[CCError manageErrorOC:response.statusCode error:error] errorCode:errorCode];
+ [self.delegate readFileSuccessFailure:_metadataNet metadata:nil message:[CCError manageErrorOC:response.statusCode error:error] errorCode:errorCode];
}
// Request trusted certificated
@@ -907,12 +982,20 @@
[communication readSharedByServer:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(shareFailure:message:errorCode:)])
+ [self.delegate shareFailure:_metadataNet message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
BOOL openWindow = NO;
[appDelegate.sharesID removeAllObjects];
- tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
-
if ([recordAccount.account isEqualToString:_metadataNet.account]) {
for (OCSharedDto *item in items)
@@ -1153,6 +1236,16 @@
[communication getSharePermissionsFile:fileName onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *permissions, NSString *redirectedServer) {
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(getSharePermissionsFileFailure:message:errorCode:)])
+ [self.delegate getSharePermissionsFileFailure:_metadataNet message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
if([self.delegate respondsToSelector:@selector(getSharePermissionsFileSuccess:permissions:)])
[self.delegate getSharePermissionsFileSuccess:_metadataNet permissions:permissions];
@@ -1194,8 +1287,18 @@
[communication getActivityServer:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfActivity, NSString *redirectedServer) {
- if ([self.delegate respondsToSelector:@selector(getActivityServerSuccess:listOfActivity:)])
- [self.delegate getActivityServerSuccess:_metadataNet listOfActivity:listOfActivity];
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(getActivityServerSuccessFailure:listOfActivity:message:errorCode:)])
+ [self.delegate getActivityServerSuccessFailure:_metadataNet listOfActivity:nil message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
+ if ([self.delegate respondsToSelector:@selector(getActivityServerSuccessFailure:listOfActivity:message:errorCode:)])
+ [self.delegate getActivityServerSuccessFailure:_metadataNet listOfActivity:listOfActivity message:nil errorCode:0];
[self complete];
@@ -1206,12 +1309,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(getActivityServerFailure:message:errorCode:)]) {
+ if ([self.delegate respondsToSelector:@selector(getActivityServerSuccessFailure:listOfActivity:message:errorCode:)]) {
if (errorCode == 503)
- [self.delegate getActivityServerFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate getActivityServerSuccessFailure:_metadataNet listOfActivity:nil message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate getActivityServerFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
+ [self.delegate getActivityServerSuccessFailure:_metadataNet listOfActivity:nil message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
}
// Request trusted certificated
@@ -1235,8 +1338,18 @@
[communication getExternalSitesServer:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfExternalSites, NSString *redirectedServer) {
- if ([self.delegate respondsToSelector:@selector(getExternalSitesServerSuccess:listOfExternalSites:)])
- [self.delegate getExternalSitesServerSuccess:_metadataNet listOfExternalSites:listOfExternalSites];
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(getExternalSitesServerSuccessFailure:listOfExternalSites:message:errorCode:)])
+ [self.delegate getExternalSitesServerSuccessFailure:_metadataNet listOfExternalSites:nil message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
+ if ([self.delegate respondsToSelector:@selector(getExternalSitesServerSuccessFailure:listOfExternalSites:message:errorCode:)])
+ [self.delegate getExternalSitesServerSuccessFailure:_metadataNet listOfExternalSites:listOfExternalSites message:nil errorCode:0];
[self complete];
@@ -1247,12 +1360,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(getExternalSitesServerFailure:message:errorCode:)]) {
+ if ([self.delegate respondsToSelector:@selector(getExternalSitesServerSuccessFailure:listOfExternalSites:message:errorCode:)]) {
if (errorCode == 503)
- [self.delegate getExternalSitesServerFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate getExternalSitesServerSuccessFailure:_metadataNet listOfExternalSites:nil message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate getExternalSitesServerFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
+ [self.delegate getExternalSitesServerSuccessFailure:_metadataNet listOfExternalSites:nil message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
}
// Request trusted certificated
@@ -1317,8 +1430,18 @@
[communication getNotificationServer:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfNotifications, NSString *redirectedServer) {
- if ([self.delegate respondsToSelector:@selector(getNotificationServerSuccess:listOfNotifications:)])
- [self.delegate getNotificationServerSuccess:_metadataNet listOfNotifications:listOfNotifications];
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(getNotificationServerSuccessFailure:listOfNotifications:message:errorCode:)])
+ [self.delegate getNotificationServerSuccessFailure:_metadataNet listOfNotifications:nil message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
+ if ([self.delegate respondsToSelector:@selector(getNotificationServerSuccessFailure:listOfNotifications:message:errorCode:)])
+ [self.delegate getNotificationServerSuccessFailure:_metadataNet listOfNotifications:listOfNotifications message:nil errorCode:0];
[self complete];
@@ -1329,12 +1452,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(getNotificationServerFailure:message:errorCode:)]) {
+ if ([self.delegate respondsToSelector:@selector(getNotificationServerSuccessFailure:listOfNotifications:message:errorCode:)]) {
if (errorCode == 503)
- [self.delegate getNotificationServerFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate getNotificationServerSuccessFailure:_metadataNet listOfNotifications:nil message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate getNotificationServerFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
+ [self.delegate getNotificationServerSuccessFailure:_metadataNet listOfNotifications:nil message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
}
// Request trusted certificated
@@ -1359,8 +1482,18 @@
[communication setNotificationServer:_metadataNet.serverUrl type:type onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
- if ([self.delegate respondsToSelector:@selector(setNotificationServerSuccess:)])
- [self.delegate setNotificationServerSuccess:_metadataNet];
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(setNotificationServerSuccessFailure:message:errorCode:)])
+ [self.delegate setNotificationServerSuccessFailure:_metadataNet message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
+ if ([self.delegate respondsToSelector:@selector(setNotificationServerSuccessFailure:message:errorCode:)])
+ [self.delegate setNotificationServerSuccessFailure:_metadataNet message:nil errorCode:0];
[self complete];
@@ -1371,12 +1504,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(setNotificationServerFailure:message:errorCode:)]) {
+ if ([self.delegate respondsToSelector:@selector(setNotificationServerSuccessFailure:message:errorCode:)]) {
if (errorCode == 503)
- [self.delegate setNotificationServerFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate setNotificationServerSuccessFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate setNotificationServerFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
+ [self.delegate setNotificationServerSuccessFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
}
// Request trusted certificated
@@ -1481,8 +1614,18 @@
[communication getUserProfileServer:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, OCUserProfile *userProfile, NSString *redirectedServer) {
- if ([self.delegate respondsToSelector:@selector(getUserProfileSuccess:userProfile:)])
- [self.delegate getUserProfileSuccess:_metadataNet userProfile:userProfile];
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(getUserProfileSuccessFailure:userProfile:message:errorCode:)])
+ [self.delegate getUserProfileSuccessFailure:_metadataNet userProfile:nil message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
+ if ([self.delegate respondsToSelector:@selector(getUserProfileSuccessFailure:userProfile:message:errorCode:)])
+ [self.delegate getUserProfileSuccessFailure:_metadataNet userProfile:userProfile message:nil errorCode:0];
[self complete];
@@ -1493,12 +1636,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(getUserProfileFailure:message:errorCode:)]) {
+ if ([self.delegate respondsToSelector:@selector(getUserProfileSuccessFailure:userProfile:message:errorCode:)]) {
if (errorCode == 503)
- [self.delegate getUserProfileFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate getUserProfileSuccessFailure:_metadataNet userProfile:nil message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate getUserProfileFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
+ [self.delegate getUserProfileSuccessFailure:_metadataNet userProfile:nil message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
}
// Request trusted certificated
@@ -1521,9 +1664,19 @@
[communication setUserAgent:[CCUtility getUserAgent]];
[communication getCapabilitiesOfServer:[_activeUrl stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, OCCapabilities *capabilities, NSString *redirectedServer) {
-
- if ([self.delegate respondsToSelector:@selector(getCapabilitiesOfServerSuccess:capabilities:)])
- [self.delegate getCapabilitiesOfServerSuccess:_metadataNet capabilities:capabilities];
+
+ // Test active account
+ tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
+ if (![recordAccount.account isEqualToString:_metadataNet.account]) {
+ if ([self.delegate respondsToSelector:@selector(getCapabilitiesOfServerSuccessFailure:capabilities:message:errorCode:)])
+ [self.delegate getCapabilitiesOfServerSuccessFailure:_metadataNet capabilities:nil message:NSLocalizedStringFromTable(@"_error_user_not_available_", @"Error", nil) errorCode:k_CCErrorUserNotAvailble];
+
+ [self complete];
+ return;
+ }
+
+ if ([self.delegate respondsToSelector:@selector(getCapabilitiesOfServerSuccessFailure:capabilities:message:errorCode:)])
+ [self.delegate getCapabilitiesOfServerSuccessFailure:_metadataNet capabilities:capabilities message:nil errorCode:0];
[self complete];
@@ -1534,12 +1687,12 @@
errorCode = error.code;
// Error
- if ([self.delegate respondsToSelector:@selector(getCapabilitiesOfServerFailure:message:errorCode:)]) {
+ if ([self.delegate respondsToSelector:@selector(getCapabilitiesOfServerSuccessFailure:capabilities:message:errorCode:)]) {
if (errorCode == 503)
- [self.delegate getCapabilitiesOfServerFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
+ [self.delegate getCapabilitiesOfServerSuccessFailure:_metadataNet capabilities:nil message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
else
- [self.delegate getCapabilitiesOfServerFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
+ [self.delegate getCapabilitiesOfServerSuccessFailure:_metadataNet capabilities:nil message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
}
// Request trusted certificated
diff --git a/iOSClient/Notification/CCNotification.swift b/iOSClient/Notification/CCNotification.swift
index 21b6625f9..ec78915f3 100644
--- a/iOSClient/Notification/CCNotification.swift
+++ b/iOSClient/Notification/CCNotification.swift
@@ -46,9 +46,9 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
self.tableView.estimatedRowHeight = 50.0
// Register to receive notification reload data
- NotificationCenter.default.addObserver(self, selector: #selector(self.tableView.reloadData), name: Notification.Name("notificationReloadData"), object: nil)
+ NotificationCenter.default.addObserver(self, selector: #selector(self.reloadDatasource), name: Notification.Name("notificationReloadData"), object: nil)
- self.tableView.reloadData()
+ reloadDatasource()
}
override func didReceiveMemoryWarning() {
@@ -65,6 +65,10 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
// MARK: - Table
+ @objc func reloadDatasource() {
+ self.tableView.reloadData()
+ }
+
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
@@ -188,28 +192,30 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
// MARK: - Networking delegate
- func setNotificationServerFailure(_ metadataNet: CCMetadataNet!, message: String!, errorCode: Int) {
-
- appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
- }
-
- func setNotificationServerSuccess(_ metadataNet: CCMetadataNet!) {
+ func setNotificationServerSuccessFailure(_ metadataNet: CCMetadataNet!, message: String!, errorCode: Int) {
// Check Active Account
if (metadataNet.account != appDelegate.activeAccount) {
return
}
- let listOfNotifications = appDelegate.listOfNotifications as NSArray as! [OCNotifications]
-
- if let index = listOfNotifications.index(where: {$0.idNotification == Int(metadataNet.assetLocalIdentifier)}) {
- appDelegate.listOfNotifications.removeObject(at: index)
- }
-
- self.tableView.reloadData()
-
- if appDelegate.listOfNotifications.count == 0 {
- viewClose()
+ if (errorCode == 0) {
+
+ let listOfNotifications = appDelegate.listOfNotifications as NSArray as! [OCNotifications]
+
+ if let index = listOfNotifications.index(where: {$0.idNotification == Int(metadataNet.assetLocalIdentifier)}) {
+ appDelegate.listOfNotifications.removeObject(at: index)
+ }
+
+ reloadDatasource()
+
+ if appDelegate.listOfNotifications.count == 0 {
+ viewClose()
+ }
+
+ } else {
+
+ appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
}
}
@@ -235,7 +241,7 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
let pathFileName = (self.appDelegate.directoryUser) + "/" + fileName
try data.write(to: URL(fileURLWithPath: pathFileName), options: .atomic)
- self.tableView.reloadData()
+ self.reloadDatasource()
} catch {
print(error)
}
diff --git a/iOSClient/PeekPop/CCPeekPop.m b/iOSClient/PeekPop/CCPeekPop.m
index cee421686..c99e19087 100644
--- a/iOSClient/PeekPop/CCPeekPop.m
+++ b/iOSClient/PeekPop/CCPeekPop.m
@@ -90,30 +90,27 @@
#pragma mark ==== Download Thumbnail ====
#pragma --------------------------------------------------------------------------------------------
-- (void)downloadThumbnailSuccess:(CCMetadataNet *)metadataNet
+- (void)downloadThumbnailSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
// Check Active Account
if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
return;
- UIImage *image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.pvw",appDelegate.directoryUser, _metadata.fileID]];
-
- _imagePreview.image = image;
-
- _imagePreview.contentMode = UIViewContentModeScaleToFill;
-
- self.preferredContentSize = CGSizeMake(image.size.width, image.size.height);
-}
-
-- (void)downloadThumbnailFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
- [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
-
- [self dismissViewControllerAnimated:YES completion:nil];
+ if (errorCode == 0) {
+
+ UIImage *image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.pvw",appDelegate.directoryUser, _metadata.fileID]];
+
+ _imagePreview.image = image;
+ _imagePreview.contentMode = UIViewContentModeScaleToFill;
+
+ self.preferredContentSize = CGSizeMake(image.size.width, image.size.height);
+
+ } else {
+
+ [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+
+ [self dismissViewControllerAnimated:YES completion:nil];
+ }
}
- (void)downloadThumbnail:(tableMetadata *)metadata
diff --git a/iOSClient/Photos/CCPhotos.h b/iOSClient/Photos/CCPhotos.h
index e932dd4de..563a0e525 100644
--- a/iOSClient/Photos/CCPhotos.h
+++ b/iOSClient/Photos/CCPhotos.h
@@ -40,10 +40,10 @@
@interface CCPhotos: UICollectionViewController <UICollectionViewDataSource, UICollectionViewDelegate, UIActionSheetDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate, OCNetworkingDelegate>
@property (nonatomic, weak) CCDetail *detailViewController;
-@property (nonatomic, strong) NSString *directoryStartDatasource;
- (void)downloadFileSuccessFailure:(NSString *)fileName fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl selector:(NSString *)selector selectorPost:(NSString *)selectorPost errorMessage:(NSString *)errorMessage errorCode:(NSInteger)errorCode;
-- (void)reloadDatasourceForced;
+- (void)reloadDatasource;
+- (void)searchPhotoVideo;
@end
diff --git a/iOSClient/Photos/CCPhotos.m b/iOSClient/Photos/CCPhotos.m
index f26020db8..debbd4d2d 100644
--- a/iOSClient/Photos/CCPhotos.m
+++ b/iOSClient/Photos/CCPhotos.m
@@ -38,12 +38,13 @@
NSMutableArray *_selectedMetadatas;
NSUInteger _numSelectedMetadatas;
- NSDate *_dateReadDataSource;
CCSectionDataSourceMetadata *_sectionDataSource;
CCHud *_hud;
TOScrollBar *_scrollBar;
+
+ BOOL _isSearchMode;
}
@end
@@ -104,7 +105,7 @@
_scrollBar.handleWidth = 20;
_scrollBar.handleMinimiumHeight = 20;
_scrollBar.trackWidth = 0;
- _scrollBar.edgeInset = 12;
+ _scrollBar.edgeInset = 12;
}
// Apparirà
@@ -119,7 +120,6 @@
// Plus Button
[appDelegate plusButtonVisibile:true];
-
[self reloadDatasource];
}
@@ -285,13 +285,20 @@
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
{
- NSString *text = [NSString stringWithFormat:@"\n%@", NSLocalizedString(@"_tutorial_photo_view_", nil)];
+ NSString *text;
+
+ if (_isSearchMode) {
+ text = [NSString stringWithFormat:@"\n%@", NSLocalizedString(@"_search_in_progress_", nil)];
+ } else {
+ text = [NSString stringWithFormat:@"\n%@", NSLocalizedString(@"_tutorial_photo_view_", nil)];
+ }
NSDictionary *attributes = @{NSFontAttributeName:[UIFont boldSystemFontOfSize:20.0f], NSForegroundColorAttributeName:[UIColor lightGrayColor]};
return [[NSAttributedString alloc] initWithString:text attributes:attributes];
}
+/*
- (NSAttributedString *)descriptionForEmptyDataSet:(UIScrollView *)scrollView
{
NSMutableParagraphStyle *paragraph = [NSMutableParagraphStyle new];
@@ -310,6 +317,7 @@
return [[NSAttributedString alloc] initWithString:text attributes:attributes];
}
+
- (UIImage *)buttonImageForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state
{
tableAccount *account = [[NCManageDatabase sharedInstance] getAccountActive];
@@ -331,6 +339,7 @@
[navigationController setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:navigationController animated:YES completion:nil];
}
+*/
#pragma --------------------------------------------------------------------------------------------
#pragma mark ===== openSelectedFiles =====
@@ -446,12 +455,12 @@
} else {
- [self reloadDatasourceForced];
+ [self reloadDatasource];
}
} else {
- [self reloadDatasourceForced];
+ [self reloadDatasource];
}
}
}
@@ -498,18 +507,21 @@
#pragma mark ==== Download Thumbnail Delegate ====
#pragma --------------------------------------------------------------------------------------------
-- (void)downloadThumbnailSuccess:(CCMetadataNet *)metadataNet
+- (void)downloadThumbnailSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
// Check Active Account
if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
return;
- NSIndexPath *indexPath = [_sectionDataSource.fileIDIndexPath objectForKey:metadataNet.fileID];
-
- if ([self indexPathIsValid:indexPath]) {
-
- if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", appDelegate.directoryUser, metadataNet.fileID]])
- [self.collectionView reloadItemsAtIndexPaths:@[indexPath]];
+ if (errorCode == 0) {
+
+ NSIndexPath *indexPath = [_sectionDataSource.fileIDIndexPath objectForKey:metadataNet.fileID];
+
+ if ([self indexPathIsValid:indexPath]) {
+
+ if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", appDelegate.directoryUser, metadataNet.fileID]])
+ [self.collectionView reloadItemsAtIndexPaths:@[indexPath]];
+ }
}
}
@@ -520,40 +532,80 @@
}
#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Collection ====
+#pragma mark ==== readPhotoVideo ====
#pragma --------------------------------------------------------------------------------------------
-- (void)reloadDatasourceForced
+- (void)searchSuccessFailure:(CCMetadataNet *)metadataNet metadatas:(NSArray *)metadatas message:(NSString *)message errorCode:(NSInteger)errorCode
{
- [CCSectionMetadata removeAllObjectsSectionDataSource:_sectionDataSource];
- _dateReadDataSource = nil;
- [self reloadDatasource];
+ // Check Active Account
+ if (![metadataNet.account isEqualToString:appDelegate.activeAccount]) {
+ _isSearchMode = NO;
+ return;
+ }
+
+ if (errorCode == 0) {
+
+ // Update date
+ [[NCManageDatabase sharedInstance] setAccountDateSearchContentTypeImageVideo:[NSDate date]];
+
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
+
+ BOOL isUpdate = [[NCManageDatabase sharedInstance] updateTableMetadatasContentTypeImageVideo:metadatas];
+
+ if (isUpdate) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self reloadDatasource];
+ });
+ }
+
+ _isSearchMode = NO;
+ });
+
+ } else {
+ _isSearchMode = NO;
+ }
}
-- (void)reloadDatasource
-{
+- (void)searchPhotoVideo
+{
// test
- if (appDelegate.activeAccount.length == 0)
+ if (appDelegate.activeAccount.length == 0 || _isSearchMode)
return;
- _directoryStartDatasource = [[NCManageDatabase sharedInstance] getAccountAutoUploadPath:appDelegate.activeUrl];
- NSDate *dateDateRecordDirectory = nil;
+ // WAITING FOR d:creationdate
+ //
+ // tableAccount *account = [[NCManageDatabase sharedInstance] getAccountActive];
+ // account.dateSearchContentTypeImageVideo
- NSArray *directories = [[NCManageDatabase sharedInstance] getTablesDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl BEGINSWITH %@", appDelegate.activeAccount, _directoryStartDatasource] sorted:@"dateReadDirectory" ascending:false];
- if ([directories count] > 0) {
- tableDirectory *directory = [directories objectAtIndex:0];
- dateDateRecordDirectory = directory.dateReadDirectory;
- }
+ [[CCActions sharedInstance] search:@"" fileName:@"" depth:@"infinity" date:[NSDate distantPast] contenType:@[@"image/%", @"video/%"] selector:selectorSearchContentType delegate:self];
- if ([dateDateRecordDirectory compare:_dateReadDataSource] == NSOrderedDescending || dateDateRecordDirectory == nil || _dateReadDataSource == nil) {
+ _isSearchMode = YES;
+}
+
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark ==== Collection ====
+#pragma --------------------------------------------------------------------------------------------
- NSLog(@"[LOG] Photos rebuild Data Source serverUrl : %@", _directoryStartDatasource);
+- (void)reloadDatasource
+{
+ @synchronized(self) {
+ // test
+ if (appDelegate.activeAccount.length == 0)
+ return;
+
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- _dateReadDataSource = [NSDate date];
- NSArray *results = [[NCManageDatabase sharedInstance] getTableMetadatasPhotosWithServerUrl:_directoryStartDatasource];
- _sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:results listProgressMetadata:nil e2eEncryptions:nil groupByField:@"date" activeAccount:appDelegate.activeAccount];
+ NSArray *metadatasDBImageVideo = [[NCManageDatabase sharedInstance] getTableMetadatasContentTypeImageVideo];
+ CCSectionDataSourceMetadata *tempSectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:metadatasDBImageVideo listProgressMetadata:nil groupByField:@"date" activeAccount:appDelegate.activeAccount];
- [self reloadCollection];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ // OPTIMIZED
+ if (tempSectionDataSource.totalSize != _sectionDataSource.totalSize || tempSectionDataSource.files != _sectionDataSource.files) {
+ _sectionDataSource = [tempSectionDataSource copy];
+ [self reloadCollection];
+ }
+ });
+ });
}
}
@@ -605,7 +657,8 @@
UILabel *titleLabel = (UILabel *)[headerView viewWithTag:100];
titleLabel.textColor = [UIColor blackColor];
- titleLabel.text = [CCUtility getTitleSectionDate:[_sectionDataSource.sections objectAtIndex:indexPath.section]];
+ if (_sectionDataSource.sections.count > indexPath.section)
+ titleLabel.text = [CCUtility getTitleSectionDate:[_sectionDataSource.sections objectAtIndex:indexPath.section]];
return headerView;
}
@@ -648,11 +701,20 @@
} else {
+ tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND directoryID = %@", appDelegate.activeAccount, metadata.directoryID]];
+
// Thumbnail not present
- imageView.image = [UIImage imageNamed:@"file_photo"];
-
- if (metadata.thumbnailExists)
- [[CCActions sharedInstance] downloadTumbnail:metadata delegate:self];
+ if (directory.e2eEncrypted) {
+
+ imageView.image = [UIImage imageNamed:@"file_photo_encrypted"];
+
+ } else {
+
+ imageView.image = [UIImage imageNamed:@"file_photo"];
+
+ if (metadata.thumbnailExists)
+ [[CCActions sharedInstance] downloadTumbnail:metadata delegate:self];
+ }
}
// Cheched
@@ -692,9 +754,10 @@
- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath
{
+ // test
if (_cellEditing == NO)
return;
-
+
NSArray *metadatasForKey = [_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:indexPath.section]];
if ([metadatasForKey count] > indexPath.row) {
diff --git a/iOSClient/Settings/CCAdvanced.m b/iOSClient/Settings/CCAdvanced.m
index cbba215a3..89c3f1a21 100644
--- a/iOSClient/Settings/CCAdvanced.m
+++ b/iOSClient/Settings/CCAdvanced.m
@@ -309,7 +309,7 @@
} else {
- [appDelegate messageNotification:@"_error_" description:@"Impossible create file body" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"_error_" description:@"Impossible create file body" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
}
}
@@ -362,7 +362,7 @@
[self emptyUserDirectoryUser:appDelegate.activeUser url:appDelegate.activeUrl removeIco:removeIco];
- [self emptyLocalDirectory];
+ [self emptyDocumentsDirectory];
NSArray* tmpDirectory = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:NSTemporaryDirectory() error:NULL];
for (NSString *file in tmpDirectory)
@@ -537,20 +537,6 @@
[[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@", dirIniziale, file] error:nil];
}
-- (void)emptyDocumentsDirectory
-{
- NSString *file;
- NSString *dirIniziale;
-
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
- dirIniziale = [paths objectAtIndex:0];
-
- NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtPath:dirIniziale];
-
- while (file = [enumerator nextObject])
- [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@", dirIniziale, file] error:nil];
-}
-
- (void)emptyUserDirectoryUser:(NSString *)user url:(NSString *)url removeIco:(BOOL)removeIco
{
NSString *file;
@@ -572,12 +558,12 @@
}
}
-- (void)emptyLocalDirectory
+- (void)emptyDocumentsDirectory
{
NSString *file;
NSString *dirIniziale;
- dirIniziale = [CCUtility getDirectoryLocal];
+ dirIniziale = [CCUtility getDirectoryDocuments];
NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtPath:dirIniziale];
diff --git a/iOSClient/Settings/CCSettings.m b/iOSClient/Settings/CCSettings.m
index dd0bca2a6..c59d915c9 100644
--- a/iOSClient/Settings/CCSettings.m
+++ b/iOSClient/Settings/CCSettings.m
@@ -404,7 +404,7 @@
}
}
- [appDelegate.activeFavorites readListingFavorites];
+ [appDelegate.activeFavorites listingFavorites];
}
#pragma --------------------------------------------------------------------------------------------
diff --git a/iOSClient/Settings/NCEndToEndInitialize.swift b/iOSClient/Settings/NCEndToEndInitialize.swift
index 86bda326e..ea55a9814 100644
--- a/iOSClient/Settings/NCEndToEndInitialize.swift
+++ b/iOSClient/Settings/NCEndToEndInitialize.swift
@@ -168,7 +168,7 @@ class NCEndToEndInitialize : NSObject, OCNetworkingDelegate {
guard let privateKey = (NCEndToEndEncryption.sharedManager().decryptPrivateKey(metadataNet.key, passphrase: passphrase, publicKey: publicKey)) else {
- self.appDelegate.messageNotification("E2E decrypt privateKey", description: "Serious internal error to decrypt Private Key", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: 0)
+ self.appDelegate.messageNotification("E2E decrypt privateKey", description: "Serious internal error to decrypt Private Key", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: Int(k_CCErrorInternalError))
return
}
diff --git a/iOSClient/Settings/NCManageEndToEndEncryption.m b/iOSClient/Settings/NCManageEndToEndEncryption.m
index 5be28dacc..eb432a325 100644
--- a/iOSClient/Settings/NCManageEndToEndEncryption.m
+++ b/iOSClient/Settings/NCManageEndToEndEncryption.m
@@ -348,7 +348,7 @@
- (void)deleteEndToEndPrivateKeyFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
- [appDelegate messageNotification:@"E2E delete privateKey" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"E2E delete privateKey" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
}
- (void)deleteEndToEndPublicKeySuccess:(CCMetadataNet *)metadataNet
@@ -358,7 +358,7 @@
- (void)deleteEndToEndPublicKeyFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
- [appDelegate messageNotification:@"E2E delete publicKey" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+ [appDelegate messageNotification:@"E2E delete publicKey" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
}
#pragma --------------------------------------------------------------------------------------------
diff --git a/iOSClient/Shares/NCShares.m b/iOSClient/Shares/NCShares.m
index 8a9d73a9f..e1db06b93 100644
--- a/iOSClient/Shares/NCShares.m
+++ b/iOSClient/Shares/NCShares.m
@@ -143,25 +143,28 @@
#pragma mark ==== Download Thumbnail <Delegate> ====
#pragma --------------------------------------------------------------------------------------------
-- (void)downloadThumbnailSuccess:(CCMetadataNet *)metadataNet
+- (void)downloadThumbnailSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
- [self reloadDatasource];
+ if (errorCode == 0) {
+
+ [self reloadDatasource];
+ }
}
#pragma --------------------------------------------------------------------------------------------
#pragma mark ==== Read File <Delegate> ====
#pragma --------------------------------------------------------------------------------------------
-- (void)readFileFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
-{
- NSLog(@"[LOG] Read file failure error %d, %@", (int)errorCode, message);
-}
-
-- (void)readFileSuccess:(CCMetadataNet *)metadataNet metadata:(tableMetadata *)metadata
+- (void)readFileSuccessFailure:(CCMetadataNet *)metadataNet metadata:(tableMetadata *)metadata message:(NSString *)message errorCode:(NSInteger)errorCode
{
- (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
-
- [self reloadDatasource];
+ if (errorCode == 0) {
+
+ (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+ [self reloadDatasource];
+
+ } else {
+ NSLog(@"[LOG] Read file failure error %d, %@", (int)errorCode, message);
+ }
}
#pragma --------------------------------------------------------------------------------------------
diff --git a/iOSClient/Supporting Files/cs-CZ.lproj/Error.strings b/iOSClient/Supporting Files/cs-CZ.lproj/Error.strings
index 5785354f6..d0003ee80 100644
--- a/iOSClient/Supporting Files/cs-CZ.lproj/Error.strings
+++ b/iOSClient/Supporting Files/cs-CZ.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings b/iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
index a7241bc03..5842af525 100644
--- a/iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/de.lproj/Error.strings b/iOSClient/Supporting Files/de.lproj/Error.strings
index da4519dfa..05907d550 100644
--- a/iOSClient/Supporting Files/de.lproj/Error.strings
+++ b/iOSClient/Supporting Files/de.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/de.lproj/Localizable.strings b/iOSClient/Supporting Files/de.lproj/Localizable.strings
index 684521e8d..9736dd63e 100644
--- a/iOSClient/Supporting Files/de.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/de.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/en-GB.lproj/Error.strings b/iOSClient/Supporting Files/en-GB.lproj/Error.strings
index 23bf1ecf3..8c70ab461 100644
--- a/iOSClient/Supporting Files/en-GB.lproj/Error.strings
+++ b/iOSClient/Supporting Files/en-GB.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/en-GB.lproj/Localizable.strings b/iOSClient/Supporting Files/en-GB.lproj/Localizable.strings
index 1ae3ebe21..900497d3e 100644
--- a/iOSClient/Supporting Files/en-GB.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/en-GB.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/en.lproj/Error.strings b/iOSClient/Supporting Files/en.lproj/Error.strings
index 64e8123a6..669f45738 100644
--- a/iOSClient/Supporting Files/en.lproj/Error.strings
+++ b/iOSClient/Supporting Files/en.lproj/Error.strings
@@ -51,5 +51,6 @@
"_ssl_connection_error_" = "Connection SSL error, try again";
"_bad_request_" = "Bad request";
"_webdav_locked_" = "WebDAV Locked : The resource that is being accessed is locked";
+"_error_user_not_available_" = "The user is no longer available";
diff --git a/iOSClient/Supporting Files/en.lproj/Localizable.strings b/iOSClient/Supporting Files/en.lproj/Localizable.strings
index e73df04f7..3ab07d671 100644
--- a/iOSClient/Supporting Files/en.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/en.lproj/Localizable.strings
@@ -396,7 +396,7 @@
"_direct_sharee_title_" = "Share";
"_direct_sharee_footer_" = "If you already know the name, enter it, then select the share type and press 'Done' to confirm";
"_direct_sharee_" = "Enter the username…";
-"_user_sharee_footer_" = "Tap to change privileges";
+"_user_sharee_footer_" = "Tap to change permissions";
"_share_type_title_" = "Type of share";
"_share_type_user_" = "User";
"_share_type_group_" = "Group";
diff --git a/iOSClient/Supporting Files/es-419.lproj/Error.strings b/iOSClient/Supporting Files/es-419.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-419.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-419.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-419.lproj/Localizable.strings b/iOSClient/Supporting Files/es-419.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-419.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-419.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-CL.lproj/Error.strings b/iOSClient/Supporting Files/es-CL.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-CL.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-CL.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-CL.lproj/Localizable.strings b/iOSClient/Supporting Files/es-CL.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-CL.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-CL.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-CO.lproj/Error.strings b/iOSClient/Supporting Files/es-CO.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-CO.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-CO.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-CO.lproj/Localizable.strings b/iOSClient/Supporting Files/es-CO.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-CO.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-CO.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-CR.lproj/Error.strings b/iOSClient/Supporting Files/es-CR.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-CR.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-CR.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-CR.lproj/Localizable.strings b/iOSClient/Supporting Files/es-CR.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-CR.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-CR.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-DO.lproj/Error.strings b/iOSClient/Supporting Files/es-DO.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-DO.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-DO.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-DO.lproj/Localizable.strings b/iOSClient/Supporting Files/es-DO.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-DO.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-DO.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-EC.lproj/Error.strings b/iOSClient/Supporting Files/es-EC.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-EC.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-EC.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-EC.lproj/Localizable.strings b/iOSClient/Supporting Files/es-EC.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-EC.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-EC.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-GT.lproj/Error.strings b/iOSClient/Supporting Files/es-GT.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-GT.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-GT.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-GT.lproj/Localizable.strings b/iOSClient/Supporting Files/es-GT.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-GT.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-GT.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-HN.lproj/Error.strings b/iOSClient/Supporting Files/es-HN.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-HN.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-HN.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-HN.lproj/Localizable.strings b/iOSClient/Supporting Files/es-HN.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-HN.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-HN.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-MX.lproj/Error.strings b/iOSClient/Supporting Files/es-MX.lproj/Error.strings
index 25840363f..4765892f5 100644
--- a/iOSClient/Supporting Files/es-MX.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-MX.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-MX.lproj/Localizable.strings b/iOSClient/Supporting Files/es-MX.lproj/Localizable.strings
index b1e454464..743b242c8 100644
--- a/iOSClient/Supporting Files/es-MX.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-MX.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-NI.lproj/Error.strings b/iOSClient/Supporting Files/es-NI.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-NI.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-NI.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-NI.lproj/Localizable.strings b/iOSClient/Supporting Files/es-NI.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-NI.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-NI.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-PA.lproj/Error.strings b/iOSClient/Supporting Files/es-PA.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-PA.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-PA.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-PA.lproj/Localizable.strings b/iOSClient/Supporting Files/es-PA.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-PA.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-PA.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-PE.lproj/Error.strings b/iOSClient/Supporting Files/es-PE.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-PE.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-PE.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-PE.lproj/Localizable.strings b/iOSClient/Supporting Files/es-PE.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-PE.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-PE.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-PR.lproj/Error.strings b/iOSClient/Supporting Files/es-PR.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-PR.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-PR.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-PR.lproj/Localizable.strings b/iOSClient/Supporting Files/es-PR.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-PR.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-PR.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-PY.lproj/Error.strings b/iOSClient/Supporting Files/es-PY.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-PY.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-PY.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-PY.lproj/Localizable.strings b/iOSClient/Supporting Files/es-PY.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-PY.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-PY.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-SV.lproj/Error.strings b/iOSClient/Supporting Files/es-SV.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-SV.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-SV.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-SV.lproj/Localizable.strings b/iOSClient/Supporting Files/es-SV.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-SV.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-SV.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-UY.lproj/Error.strings b/iOSClient/Supporting Files/es-UY.lproj/Error.strings
index b666ba7a6..200d5f4e6 100644
--- a/iOSClient/Supporting Files/es-UY.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es-UY.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es-UY.lproj/Localizable.strings b/iOSClient/Supporting Files/es-UY.lproj/Localizable.strings
index e3fa4635b..ae637b853 100644
--- a/iOSClient/Supporting Files/es-UY.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es-UY.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es.lproj/Error.strings b/iOSClient/Supporting Files/es.lproj/Error.strings
index 47c505f1d..2921b17a4 100644
--- a/iOSClient/Supporting Files/es.lproj/Error.strings
+++ b/iOSClient/Supporting Files/es.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es.lproj/Intro.strings b/iOSClient/Supporting Files/es.lproj/Intro.strings
index 7e9b83224..06e4f2b5b 100644
--- a/iOSClient/Supporting Files/es.lproj/Intro.strings
+++ b/iOSClient/Supporting Files/es.lproj/Intro.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/es.lproj/Localizable.strings b/iOSClient/Supporting Files/es.lproj/Localizable.strings
index c3a16c729..fb667a9c9 100644
--- a/iOSClient/Supporting Files/es.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/es.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/fr.lproj/Error.strings b/iOSClient/Supporting Files/fr.lproj/Error.strings
index 90a00d1cd..45855ff9e 100644
--- a/iOSClient/Supporting Files/fr.lproj/Error.strings
+++ b/iOSClient/Supporting Files/fr.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/fr.lproj/Localizable.strings b/iOSClient/Supporting Files/fr.lproj/Localizable.strings
index c77471a20..7e72201a5 100644
--- a/iOSClient/Supporting Files/fr.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/fr.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/hu.lproj/Error.strings b/iOSClient/Supporting Files/hu.lproj/Error.strings
index 4ad919dc3..020d3b452 100644
--- a/iOSClient/Supporting Files/hu.lproj/Error.strings
+++ b/iOSClient/Supporting Files/hu.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/hu.lproj/Localizable.strings b/iOSClient/Supporting Files/hu.lproj/Localizable.strings
index e4f9329b5..c62bd7474 100644
--- a/iOSClient/Supporting Files/hu.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/hu.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/is.lproj/Error.strings b/iOSClient/Supporting Files/is.lproj/Error.strings
index 5a979d185..671edce0e 100644
--- a/iOSClient/Supporting Files/is.lproj/Error.strings
+++ b/iOSClient/Supporting Files/is.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/is.lproj/Localizable.strings b/iOSClient/Supporting Files/is.lproj/Localizable.strings
index ed3a84761..05ec776a5 100644
--- a/iOSClient/Supporting Files/is.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/is.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/it.lproj/Error.strings b/iOSClient/Supporting Files/it.lproj/Error.strings
index c5ec196d6..887cd8cf2 100644
--- a/iOSClient/Supporting Files/it.lproj/Error.strings
+++ b/iOSClient/Supporting Files/it.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/it.lproj/Localizable.strings b/iOSClient/Supporting Files/it.lproj/Localizable.strings
index d3fc39045..a9b54ab63 100644
--- a/iOSClient/Supporting Files/it.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/it.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/ka-GE.lproj/Error.strings b/iOSClient/Supporting Files/ka-GE.lproj/Error.strings
index 1bc9a9729..24ac00038 100644
--- a/iOSClient/Supporting Files/ka-GE.lproj/Error.strings
+++ b/iOSClient/Supporting Files/ka-GE.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/ka-GE.lproj/Localizable.strings b/iOSClient/Supporting Files/ka-GE.lproj/Localizable.strings
index 2ad6c513d..9ba2ebe79 100644
--- a/iOSClient/Supporting Files/ka-GE.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/ka-GE.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/ko.lproj/Error.strings b/iOSClient/Supporting Files/ko.lproj/Error.strings
index 4a85c4cb5..4f38607fa 100644
--- a/iOSClient/Supporting Files/ko.lproj/Error.strings
+++ b/iOSClient/Supporting Files/ko.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/ko.lproj/Localizable.strings b/iOSClient/Supporting Files/ko.lproj/Localizable.strings
index e3a7b1410..52f483399 100644
--- a/iOSClient/Supporting Files/ko.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/ko.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/nb-NO.lproj/Error.strings b/iOSClient/Supporting Files/nb-NO.lproj/Error.strings
index 8f13e3a03..599120296 100644
--- a/iOSClient/Supporting Files/nb-NO.lproj/Error.strings
+++ b/iOSClient/Supporting Files/nb-NO.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/nb-NO.lproj/Localizable.strings b/iOSClient/Supporting Files/nb-NO.lproj/Localizable.strings
index 5eb854ec5..5c0b4c809 100644
--- a/iOSClient/Supporting Files/nb-NO.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/nb-NO.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/nl.lproj/Error.strings b/iOSClient/Supporting Files/nl.lproj/Error.strings
index c38e5e186..426e86a41 100644
--- a/iOSClient/Supporting Files/nl.lproj/Error.strings
+++ b/iOSClient/Supporting Files/nl.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/nl.lproj/Localizable.strings b/iOSClient/Supporting Files/nl.lproj/Localizable.strings
index 57c47b1fe..0a7155217 100644
--- a/iOSClient/Supporting Files/nl.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/nl.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/pl.lproj/Error.strings b/iOSClient/Supporting Files/pl.lproj/Error.strings
index deaa1f0ef..a1b0f01c5 100644
--- a/iOSClient/Supporting Files/pl.lproj/Error.strings
+++ b/iOSClient/Supporting Files/pl.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/pl.lproj/Localizable.strings b/iOSClient/Supporting Files/pl.lproj/Localizable.strings
index 23e286831..4329ca350 100644
--- a/iOSClient/Supporting Files/pl.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/pl.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/pt-BR.lproj/Error.strings b/iOSClient/Supporting Files/pt-BR.lproj/Error.strings
index 10bce4187..421a8b537 100644
--- a/iOSClient/Supporting Files/pt-BR.lproj/Error.strings
+++ b/iOSClient/Supporting Files/pt-BR.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/pt-BR.lproj/Localizable.strings b/iOSClient/Supporting Files/pt-BR.lproj/Localizable.strings
index 88b0526b1..cb04cc23d 100644
--- a/iOSClient/Supporting Files/pt-BR.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/pt-BR.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/pt_PT.lproj/BKPasscodeView.strings b/iOSClient/Supporting Files/pt-PT.lproj/BKPasscodeView.strings
index e3ffaacb2..e3ffaacb2 100644
--- a/iOSClient/Supporting Files/pt_PT.lproj/BKPasscodeView.strings
+++ b/iOSClient/Supporting Files/pt-PT.lproj/BKPasscodeView.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/pt_PT.lproj/CTAssetsPicker.strings b/iOSClient/Supporting Files/pt-PT.lproj/CTAssetsPicker.strings
index 16bc54bb3..16bc54bb3 100644
--- a/iOSClient/Supporting Files/pt_PT.lproj/CTAssetsPicker.strings
+++ b/iOSClient/Supporting Files/pt-PT.lproj/CTAssetsPicker.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/pt_PT.lproj/Error.strings b/iOSClient/Supporting Files/pt-PT.lproj/Error.strings
index 1e7c8c754..fcfb08893 100644
--- a/iOSClient/Supporting Files/pt_PT.lproj/Error.strings
+++ b/iOSClient/Supporting Files/pt-PT.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/pt_PT.lproj/InfoPlist.strings b/iOSClient/Supporting Files/pt-PT.lproj/InfoPlist.strings
index b54e131a1..b54e131a1 100644
--- a/iOSClient/Supporting Files/pt_PT.lproj/InfoPlist.strings
+++ b/iOSClient/Supporting Files/pt-PT.lproj/InfoPlist.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/pt_PT.lproj/Intro.strings b/iOSClient/Supporting Files/pt-PT.lproj/Intro.strings
index 526cd1825..526cd1825 100644
--- a/iOSClient/Supporting Files/pt_PT.lproj/Intro.strings
+++ b/iOSClient/Supporting Files/pt-PT.lproj/Intro.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/pt_PT.lproj/Localizable.strings b/iOSClient/Supporting Files/pt-PT.lproj/Localizable.strings
index ca8323d81..293bd14a7 100644
--- a/iOSClient/Supporting Files/pt_PT.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/pt-PT.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/pt_PT.lproj/SwiftWebVC.strings b/iOSClient/Supporting Files/pt-PT.lproj/SwiftWebVC.strings
index 6303605fd..6303605fd 100644
--- a/iOSClient/Supporting Files/pt_PT.lproj/SwiftWebVC.strings
+++ b/iOSClient/Supporting Files/pt-PT.lproj/SwiftWebVC.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/ru.lproj/Error.strings b/iOSClient/Supporting Files/ru.lproj/Error.strings
index 098ef1394..2e2b74da7 100644
--- a/iOSClient/Supporting Files/ru.lproj/Error.strings
+++ b/iOSClient/Supporting Files/ru.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/ru.lproj/Localizable.strings b/iOSClient/Supporting Files/ru.lproj/Localizable.strings
index 44ffacf70..13367e998 100644
--- a/iOSClient/Supporting Files/ru.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/ru.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/sk-SK.lproj/Error.strings b/iOSClient/Supporting Files/sk-SK.lproj/Error.strings
index fee3f450c..a06f9e6a2 100644
--- a/iOSClient/Supporting Files/sk-SK.lproj/Error.strings
+++ b/iOSClient/Supporting Files/sk-SK.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/sk-SK.lproj/Localizable.strings b/iOSClient/Supporting Files/sk-SK.lproj/Localizable.strings
index c491bea8b..583041a55 100644
--- a/iOSClient/Supporting Files/sk-SK.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/sk-SK.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/sr.lproj/Error.strings b/iOSClient/Supporting Files/sr.lproj/Error.strings
index edcc18899..dcb3f7761 100644
--- a/iOSClient/Supporting Files/sr.lproj/Error.strings
+++ b/iOSClient/Supporting Files/sr.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/sr.lproj/Localizable.strings b/iOSClient/Supporting Files/sr.lproj/Localizable.strings
index 6ec79c41f..acd10a9ad 100644
--- a/iOSClient/Supporting Files/sr.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/sr.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/sv.lproj/Error.strings b/iOSClient/Supporting Files/sv.lproj/Error.strings
index d863adffb..095cac1c5 100644
--- a/iOSClient/Supporting Files/sv.lproj/Error.strings
+++ b/iOSClient/Supporting Files/sv.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/sv.lproj/Localizable.strings b/iOSClient/Supporting Files/sv.lproj/Localizable.strings
index 896575932..8b047ef34 100644
--- a/iOSClient/Supporting Files/sv.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/sv.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/tr.lproj/Error.strings b/iOSClient/Supporting Files/tr.lproj/Error.strings
index 4e9769d3e..57be45eeb 100644
--- a/iOSClient/Supporting Files/tr.lproj/Error.strings
+++ b/iOSClient/Supporting Files/tr.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/tr.lproj/Localizable.strings b/iOSClient/Supporting Files/tr.lproj/Localizable.strings
index 9279e5732..e30101bbe 100644
--- a/iOSClient/Supporting Files/tr.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/tr.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/zh-Hans.lproj/Error.strings b/iOSClient/Supporting Files/zh-Hans.lproj/Error.strings
index ae905bb7a..1a72baffd 100644
--- a/iOSClient/Supporting Files/zh-Hans.lproj/Error.strings
+++ b/iOSClient/Supporting Files/zh-Hans.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/zh-Hans.lproj/Localizable.strings b/iOSClient/Supporting Files/zh-Hans.lproj/Localizable.strings
index b4b143e1c..ed61a52ac 100644
--- a/iOSClient/Supporting Files/zh-Hans.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/zh-Hans.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/zh-Hant-TW.lproj/Error.strings b/iOSClient/Supporting Files/zh-Hant-TW.lproj/Error.strings
index 4a246124c..be2d4cb42 100644
--- a/iOSClient/Supporting Files/zh-Hant-TW.lproj/Error.strings
+++ b/iOSClient/Supporting Files/zh-Hant-TW.lproj/Error.strings
Binary files differ
diff --git a/iOSClient/Supporting Files/zh-Hant-TW.lproj/Localizable.strings b/iOSClient/Supporting Files/zh-Hant-TW.lproj/Localizable.strings
index 83e449c49..7c7165611 100644
--- a/iOSClient/Supporting Files/zh-Hant-TW.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/zh-Hant-TW.lproj/Localizable.strings
Binary files differ
diff --git a/iOSClient/Synchronize/CCSynchronize.m b/iOSClient/Synchronize/CCSynchronize.m
index 1d1f41446..8c61ab344 100644
--- a/iOSClient/Synchronize/CCSynchronize.m
+++ b/iOSClient/Synchronize/CCSynchronize.m
@@ -79,31 +79,30 @@
NSLog(@"[LOG] %@ directory : %@", selector, serverUrl);
}
-- (void)readFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
+// MULTI THREAD
+- (void)readFolderSuccessFailure:(CCMetadataNet *)metadataNet metadataFolder:(tableMetadata *)metadataFolder metadatas:(NSArray *)metadatas message:(NSString *)message errorCode:(NSInteger)errorCode
{
// Check Active Account
if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
return;
- // Folder not present, remove it
- if (errorCode == 404) {
+ // ERROR
+ if (errorCode != 0) {
- [[NCManageDatabase sharedInstance] deleteDirectoryAndSubDirectoryWithServerUrl:metadataNet.serverUrl];
- [appDelegate.activeMain reloadDatasource:metadataNet.serverUrl];
+ // Folder not present, remove it
+ if (errorCode == 404) {
+
+ [[NCManageDatabase sharedInstance] deleteDirectoryAndSubDirectoryWithServerUrl:metadataNet.serverUrl];
+ [appDelegate.activeMain reloadDatasource:metadataNet.serverUrl];
+ }
+
+ return;
}
-}
-
-// MULTI THREAD
-- (void)readFolderSuccess:(CCMetadataNet *)metadataNet metadataFolder:(tableMetadata *)metadataFolder metadatas:(NSArray *)metadatas
-{
+
// Add/update self Folder
if (!metadataFolder || !metadatas || [metadatas count] == 0)
return;
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
-
// Add metadata and update etag Directory
(void)[[NCManageDatabase sharedInstance] addMetadata:metadataFolder];
[[NCManageDatabase sharedInstance] setDirectoryWithServerUrl:metadataNet.serverUrl serverUrlTo:nil etag:metadataFolder.etag fileID:metadataFolder.fileID encrypted:metadataFolder.e2eEncrypted];
@@ -256,67 +255,65 @@
[appDelegate addNetworkingOperationQueue:appDelegate.netQueue delegate:self metadataNet:metadataNet];
}
-- (void)readFileFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
+- (void)readFileSuccessFailure:(CCMetadataNet *)metadataNet metadata:(tableMetadata *)metadata message:(NSString *)message errorCode:(NSInteger)errorCode
{
// Check Active Account
if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
return;
- // Selector : selectorReadFile, selectorReadFileWithDownload
- if ([metadataNet.selector isEqualToString:selectorReadFile] || [metadataNet.selector isEqualToString:selectorReadFileWithDownload]) {
-
- // File not present, remove it
- if (errorCode == 404) {
-
- [[NCManageDatabase sharedInstance] deleteLocalFileWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", metadataNet.fileID]];
- [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", metadataNet.account, metadataNet.fileID] clearDateReadDirectoryID:nil];
-
- NSString *serverUrl = [[NCManageDatabase sharedInstance] getServerUrl:metadataNet.directoryID];
- if (serverUrl)
- [appDelegate.activeMain reloadDatasource:serverUrl];
- }
- }
-}
-
-- (void)readFileSuccess:(CCMetadataNet *)metadataNet metadata:(tableMetadata *)metadata
-{
- // Check Active Account
- if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
- return;
+ if (errorCode == 0) {
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
+
+ // Selector : selectorReadFile, selectorReadFileWithDownload
+ if ([metadataNet.selector isEqualToString:selectorReadFile] || [metadataNet.selector isEqualToString:selectorReadFileWithDownload]) {
+
+ BOOL withDownload = NO;
+
+ if ([metadataNet.selector isEqualToString:selectorReadFileWithDownload])
+ withDownload = YES;
+
+ //Add/Update Metadata
+ tableMetadata *addMetadata = [[NCManageDatabase sharedInstance] addMetadata:metadata];
+
+ if (addMetadata)
+ [self verifyChangeMedatas:[[NSArray alloc] initWithObjects:addMetadata, nil] serverUrl:metadataNet.serverUrl account:appDelegate.activeAccount withDownload:withDownload];
+ }
+
+ // Selector : selectorReadFileReloadFolder, selectorReadFileFolderWithDownload
+ if ([metadataNet.selector isEqualToString:selectorReadFileFolder] || [metadataNet.selector isEqualToString:selectorReadFileFolderWithDownload]) {
+
+ NSString *serverUrl = [CCUtility stringAppendServerUrl:metadataNet.serverUrl addFileName:metadataNet.fileName];
+ tableDirectory *tableDirectory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", metadataNet.account, serverUrl]];
+
+ // Verify changed etag
+ if (![tableDirectory.etag isEqualToString:metadata.etag] && tableDirectory) {
+
+ if ([metadataNet.selector isEqualToString:selectorReadFileFolder])
+ [self readFolder:serverUrl selector:selectorReadFolder];
+ if ([metadataNet.selector isEqualToString:selectorReadFileFolderWithDownload])
+ [self readFolder:serverUrl selector:selectorReadFolderWithDownload];
+ }
+ }
+ });
+
+ } else {
// Selector : selectorReadFile, selectorReadFileWithDownload
if ([metadataNet.selector isEqualToString:selectorReadFile] || [metadataNet.selector isEqualToString:selectorReadFileWithDownload]) {
-
- BOOL withDownload = NO;
-
- if ([metadataNet.selector isEqualToString:selectorReadFileWithDownload])
- withDownload = YES;
-
- //Add/Update Metadata
- tableMetadata *addMetadata = [[NCManageDatabase sharedInstance] addMetadata:metadata];
- if (addMetadata)
- [self verifyChangeMedatas:[[NSArray alloc] initWithObjects:addMetadata, nil] serverUrl:metadataNet.serverUrl account:appDelegate.activeAccount withDownload:withDownload];
- }
-
- // Selector : selectorReadFileReloadFolder, selectorReadFileFolderWithDownload
- if ([metadataNet.selector isEqualToString:selectorReadFileFolder] || [metadataNet.selector isEqualToString:selectorReadFileFolderWithDownload]) {
-
- NSString *serverUrl = [CCUtility stringAppendServerUrl:metadataNet.serverUrl addFileName:metadataNet.fileName];
- tableDirectory *tableDirectory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", metadataNet.account, serverUrl]];
-
- // Verify changed etag
- if (![tableDirectory.etag isEqualToString:metadata.etag] && tableDirectory) {
+ // File not present, remove it
+ if (errorCode == 404) {
- if ([metadataNet.selector isEqualToString:selectorReadFileFolder])
- [self readFolder:serverUrl selector:selectorReadFolder];
- if ([metadataNet.selector isEqualToString:selectorReadFileFolderWithDownload])
- [self readFolder:serverUrl selector:selectorReadFolderWithDownload];
+ [[NCManageDatabase sharedInstance] deleteLocalFileWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", metadataNet.fileID]];
+ [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", metadataNet.account, metadataNet.fileID] clearDateReadDirectoryID:nil];
+
+ NSString *serverUrl = [[NCManageDatabase sharedInstance] getServerUrl:metadataNet.directoryID];
+ if (serverUrl)
+ [appDelegate.activeMain reloadDatasource:serverUrl];
}
}
- });
+ }
}
#pragma --------------------------------------------------------------------------------------------
diff --git a/iOSClient/Text/NCText.swift b/iOSClient/Text/NCText.swift
index d097a54c0..e5126fda9 100644
--- a/iOSClient/Text/NCText.swift
+++ b/iOSClient/Text/NCText.swift
@@ -84,6 +84,7 @@ class NCText: UIViewController, UITextViewDelegate {
textView.becomeFirstResponder()
textView.delegate = self
textView.selectedTextRange = textView.textRange(from: textView.beginningOfDocument, to: textView.beginningOfDocument)
+ //textView.font = UIFont(name: "NameOfTheFont", size: 20)
textViewDidChange(textView)
}
@@ -164,7 +165,7 @@ class NCText: UIViewController, UITextViewDelegate {
})
} else {
- self.appDelegate.messageNotification("_error_", description: "_error_creation_file_", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.info, errorCode: 0)
+ self.appDelegate.messageNotification("_error_", description: "_error_creation_file_", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: Int(k_CCErrorInternalError))
}
} else {
diff --git a/iOSClient/Transfers/CCTransfers.m b/iOSClient/Transfers/CCTransfers.m
index 8eea2b698..cd277c2cf 100644
--- a/iOSClient/Transfers/CCTransfers.m
+++ b/iOSClient/Transfers/CCTransfers.m
@@ -293,17 +293,20 @@
#pragma mark - ==== download Thumbnail ====
#pragma --------------------------------------------------------------------------------------------
-- (void)downloadThumbnailSuccess:(CCMetadataNet *)metadataNet
+- (void)downloadThumbnailSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
{
// Check Active Account
if (![metadataNet.account isEqualToString:appDelegate.activeAccount])
return;
- NSIndexPath *indexPath = [_sectionDataSource.fileIDIndexPath objectForKey:metadataNet.fileID];
-
- if (indexPath && [[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", appDelegate.directoryUser, metadataNet.fileID]]) {
+ if (errorCode == 0) {
+
+ NSIndexPath *indexPath = [_sectionDataSource.fileIDIndexPath objectForKey:metadataNet.fileID];
- [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
+ if (indexPath && [[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", appDelegate.directoryUser, metadataNet.fileID]]) {
+
+ [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
+ }
}
}
@@ -319,7 +322,7 @@
NSArray *recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND ((session CONTAINS 'upload') OR (session CONTAINS 'download'))", appDelegate.activeAccount] sorted:@"sessionTaskIdentifier" ascending:YES];
- _sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:appDelegate.listProgressMetadata e2eEncryptions:nil groupByField:@"session" activeAccount:appDelegate.activeAccount];
+ _sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:appDelegate.listProgressMetadata groupByField:@"session" activeAccount:appDelegate.activeAccount];
[_tableView reloadData];
}
diff --git a/iOSClient/Utility/CCUtility.h b/iOSClient/Utility/CCUtility.h
index 15f8d956c..247f6f036 100644
--- a/iOSClient/Utility/CCUtility.h
+++ b/iOSClient/Utility/CCUtility.h
@@ -164,7 +164,7 @@
+ (NSString *)getHomeServerUrlActiveUrl:(NSString *)activeUrl;
+ (NSString *)getDirectoryActiveUser:(NSString *)activeUser activeUrl:(NSString *)activeUrl;
+ (NSString *)getOLDDirectoryActiveUser:(NSString *)activeUser activeUrl:(NSString *)activeUrl;
-+ (NSString *)getDirectoryLocal;
++ (NSString *)getDirectoryDocuments;
+ (NSString *)getDirectoryAudio;
+ (NSString *)getDirectoryCerificates;
+ (NSString *)getTitleSectionDate:(NSDate *)date;
diff --git a/iOSClient/Utility/CCUtility.m b/iOSClient/Utility/CCUtility.m
index 7ca0673c2..c9e41c3c1 100644
--- a/iOSClient/Utility/CCUtility.m
+++ b/iOSClient/Utility/CCUtility.m
@@ -424,7 +424,15 @@
+ (BOOL)getFormatCompatibility
{
- return [[UICKeyChainStore stringForKey:@"formatCompatibility" service:k_serviceShareKeyChain] boolValue];
+ NSString *valueString = [UICKeyChainStore stringForKey:@"formatCompatibility" service:k_serviceShareKeyChain];
+
+ // Default TRUE
+ if (valueString == nil) {
+ [self setFormatCompatibility:YES];
+ return true;
+ }
+
+ return [valueString boolValue];
}
+ (void)setFormatCompatibility:(BOOL)set
@@ -775,8 +783,8 @@
return dirUserBaseUrl;
}
-// Return the path of directory Local -> NSDocumentDirectory
-+ (NSString *)getDirectoryLocal
+// Return the path of directory Documents -> NSDocumentDirectory
++ (NSString *)getDirectoryDocuments
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);