Browse Source

Merge branch 'Coherence' into new-design

Signed-off-by: Philippe Weidmann <philippe.weidmann@infomaniak.com>

# Conflicts:
#	Cartfile.resolved
#	iOSClient/AppDelegate.m
#	iOSClient/Main/CCMain.m
Philippe Weidmann 4 years ago
parent
commit
721b4ceb86
100 changed files with 1304 additions and 1443 deletions
  1. 1 1
      Cartfile.resolved
  2. 3 3
      File Provider Extension/FileProviderData.swift
  3. 2 2
      File Provider Extension/FileProviderDomain.swift
  4. 0 14
      File Provider Extension/FileProviderExtension-Bridging-Header.h
  5. 1 10
      File Provider Extension/FileProviderExtension.swift
  6. 7 1
      File Provider Extension/FileProviderItem.swift
  7. 36 180
      Nextcloud.xcodeproj/project.pbxproj
  8. 0 31
      Notification Service Extension/Info.plist
  9. 0 14
      Notification Service Extension/Notification Service Extension.entitlements
  10. 0 9
      Notification Service Extension/Notification_Service_Extension-Bridging-Header.h
  11. 1 3
      Share/NCSelectDestination.m
  12. 3 8
      Share/ShareViewController.m
  13. 2 0
      iOSClient/AppDelegate.h
  14. 121 16
      iOSClient/AppDelegate.m
  15. 3 15
      iOSClient/AutoUpload/NCAutoUpload.m
  16. 1 1
      iOSClient/CCGlobal.h
  17. 72 3
      iOSClient/Database/NCManageDatabase.swift
  18. 3 5
      iOSClient/Favorites/CCFavorites.m
  19. 2 2
      iOSClient/Library/OCCommunicationLib/OCCommunication.m
  20. 2 1
      iOSClient/Library/XLForm/XL/Cell/XLFormPickerCell.m
  21. 0 1
      iOSClient/Main/CCMain+Swift.swift
  22. 65 110
      iOSClient/Main/CCMain.m
  23. 5 7
      iOSClient/Main/CCMore.swift
  24. 10 2
      iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift
  25. 159 50
      iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift
  26. 8 8
      iOSClient/Main/Create cloud/NCCreateFormUploadConflictCell.xib
  27. 51 11
      iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift
  28. 0 268
      iOSClient/Main/Create cloud/NCCreateFormUploadFileText.swift
  29. 33 37
      iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift
  30. 52 33
      iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift
  31. 41 52
      iOSClient/Main/Menu/AppDelegate+Menu.swift
  32. 17 13
      iOSClient/Main/Menu/CCFavorites+Menu.swift
  33. 53 37
      iOSClient/Main/Menu/CCMain+Menu.swift
  34. 39 56
      iOSClient/Main/Menu/NCDetailNavigationController+Menu.swift
  35. 1 5
      iOSClient/Main/Menu/NCMainMenuTableViewController.swift
  36. 1 6
      iOSClient/Main/Menu/NCMenuPanelController.swift
  37. 51 40
      iOSClient/Main/NCDetailViewController.swift
  38. 26 24
      iOSClient/Main/NCMainCommon.swift
  39. 11 5
      iOSClient/Main/NCMasterNavigationController.swift
  40. 4 4
      iOSClient/Main/NCPhotosPickerViewController.swift
  41. 2 2
      iOSClient/Media/NCMedia.swift
  42. 41 19
      iOSClient/Networking/CCNetworking.m
  43. 47 156
      iOSClient/Networking/NCNetworking.swift
  44. 220 0
      iOSClient/Networking/NCNetworkingE2EE.swift
  45. 33 104
      iOSClient/Networking/NCNetworkingEndToEnd.m
  46. 16 5
      iOSClient/Networking/NCNetworkingNotificationCenter.swift
  47. 10 4
      iOSClient/Networking/OCNetworking.m
  48. 4 10
      iOSClient/Offline/NCOffline.swift
  49. 1 1
      iOSClient/PeekPop/CCPeekPop.h
  50. 3 3
      iOSClient/PeekPop/CCPeekPop.m
  51. 1 4
      iOSClient/RichWorkspace/NCViewerRichWorkspaceWebView.swift
  52. 0 8
      iOSClient/ScanDocument/ScanCollectionView.swift
  53. 1 1
      iOSClient/Security/NCEndToEndEncryption.m
  54. 8 1
      iOSClient/Security/NCEndToEndMetadata.swift
  55. 1 5
      iOSClient/Select/NCSelect.swift
  56. 18 13
      iOSClient/Settings/CCSettings.m
  57. 1 4
      iOSClient/Share/NCShare.swift
  58. 2 6
      iOSClient/Share/NCShareCommon.swift
  59. 1 1
      iOSClient/Shares/NCShares.m
  60. BIN
      iOSClient/Supporting Files/af.lproj/Localizable.strings
  61. BIN
      iOSClient/Supporting Files/ar.lproj/Localizable.strings
  62. BIN
      iOSClient/Supporting Files/ast.lproj/Localizable.strings
  63. BIN
      iOSClient/Supporting Files/az.lproj/Localizable.strings
  64. BIN
      iOSClient/Supporting Files/be.lproj/Localizable.strings
  65. BIN
      iOSClient/Supporting Files/bg_BG.lproj/Localizable.strings
  66. BIN
      iOSClient/Supporting Files/bn_BD.lproj/Localizable.strings
  67. BIN
      iOSClient/Supporting Files/bs.lproj/Localizable.strings
  68. BIN
      iOSClient/Supporting Files/ca.lproj/Localizable.strings
  69. BIN
      iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
  70. BIN
      iOSClient/Supporting Files/cy_GB.lproj/Localizable.strings
  71. BIN
      iOSClient/Supporting Files/da.lproj/Localizable.strings
  72. BIN
      iOSClient/Supporting Files/de.lproj/Localizable.strings
  73. BIN
      iOSClient/Supporting Files/el.lproj/Localizable.strings
  74. BIN
      iOSClient/Supporting Files/en-GB.lproj/Localizable.strings
  75. 7 8
      iOSClient/Supporting Files/en.lproj/Localizable.strings
  76. BIN
      iOSClient/Supporting Files/eo.lproj/Localizable.strings
  77. BIN
      iOSClient/Supporting Files/es-419.lproj/Localizable.strings
  78. BIN
      iOSClient/Supporting Files/es-AR.lproj/Localizable.strings
  79. BIN
      iOSClient/Supporting Files/es-CL.lproj/Localizable.strings
  80. BIN
      iOSClient/Supporting Files/es-CO.lproj/Localizable.strings
  81. BIN
      iOSClient/Supporting Files/es-CR.lproj/Localizable.strings
  82. BIN
      iOSClient/Supporting Files/es-DO.lproj/Localizable.strings
  83. BIN
      iOSClient/Supporting Files/es-EC.lproj/Localizable.strings
  84. BIN
      iOSClient/Supporting Files/es-GT.lproj/Localizable.strings
  85. BIN
      iOSClient/Supporting Files/es-HN.lproj/Localizable.strings
  86. BIN
      iOSClient/Supporting Files/es-MX.lproj/Localizable.strings
  87. BIN
      iOSClient/Supporting Files/es-NI.lproj/Localizable.strings
  88. BIN
      iOSClient/Supporting Files/es-PA.lproj/Localizable.strings
  89. BIN
      iOSClient/Supporting Files/es-PE.lproj/Localizable.strings
  90. BIN
      iOSClient/Supporting Files/es-PR.lproj/Localizable.strings
  91. BIN
      iOSClient/Supporting Files/es-PY.lproj/Localizable.strings
  92. BIN
      iOSClient/Supporting Files/es-SV.lproj/Localizable.strings
  93. BIN
      iOSClient/Supporting Files/es-UY.lproj/Localizable.strings
  94. BIN
      iOSClient/Supporting Files/es.lproj/Localizable.strings
  95. BIN
      iOSClient/Supporting Files/et_EE.lproj/Localizable.strings
  96. BIN
      iOSClient/Supporting Files/eu.lproj/Localizable.strings
  97. BIN
      iOSClient/Supporting Files/fa.lproj/Localizable.strings
  98. BIN
      iOSClient/Supporting Files/fi-FI.lproj/Localizable.strings
  99. BIN
      iOSClient/Supporting Files/fr.lproj/Localizable.strings
  100. BIN
      iOSClient/Supporting Files/gl.lproj/Localizable.strings

+ 1 - 1
Cartfile.resolved

@@ -16,7 +16,7 @@ github "krzyzanowskim/OpenSSL" "1.0.218"
 github "malcommac/SwiftRichString" "3.7.1"
 github "marinofaggiana/AFNetworking" "2967678c3e0e98c9b8d7e06222ad12d1f49c26f2"
 github "marinofaggiana/KTVHTTPCache" "2.0.2"
-github "nextcloud/ios-communication-library" "19bc2a6a8980cc5a0db5002ff72d3d5817a3252f"
+github "nextcloud/ios-communication-library" "29dd07d6c8cb8c8d551683160c663def50d17143"
 github "realm/realm-cocoa" "v4.4.1"
 github "rechsteiner/Parchment" "v1.7.0"
 github "scenee/FloatingPanel" "v1.7.4"

+ 3 - 3
File Provider Extension/FileProviderData.swift

@@ -84,7 +84,7 @@ class fileProviderData: NSObject {
             homeServerUrl = CCUtility.getHomeServerUrlActiveUrl(tableAccount.url)
             
             NCCommunicationCommon.sharedInstance.setup(user: accountUser, userId: accountUserID, password: accountPassword, url: accountUrl, userAgent: CCUtility.getUserAgent(), capabilitiesGroup: NCBrandOptions.sharedInstance.capabilitiesGroups, nextcloudVersion: capabilities.versionMajor, delegate: NCNetworking.sharedInstance)
-            NCNetworking.sharedInstance.setup(account: tableAccount.account, delegate: providerExtension as? NCNetworkingDelegate)
+            NCNetworking.sharedInstance.delegate = providerExtension as? NCNetworkingDelegate
             
             return true
         }
@@ -107,7 +107,7 @@ class fileProviderData: NSObject {
                 homeServerUrl = CCUtility.getHomeServerUrlActiveUrl(tableAccount.url)
                 
                 NCCommunicationCommon.sharedInstance.setup(user: accountUser, userId: accountUserID, password: accountPassword, url: accountUrl, userAgent: CCUtility.getUserAgent(), capabilitiesGroup: NCBrandOptions.sharedInstance.capabilitiesGroups, nextcloudVersion: capabilities.versionMajor, delegate: NCNetworking.sharedInstance)
-                NCNetworking.sharedInstance.setup(account: tableAccount.account, delegate: providerExtension as? NCNetworkingDelegate)
+                NCNetworking.sharedInstance.delegate = providerExtension as? NCNetworkingDelegate
 
                 foundAccount = true
             }
@@ -136,7 +136,7 @@ class fileProviderData: NSObject {
                 homeServerUrl = CCUtility.getHomeServerUrlActiveUrl(tableAccount.url)
                 
                 NCCommunicationCommon.sharedInstance.setup(user: accountUser, userId: accountUserID, password: accountPassword, url: accountUrl, userAgent: CCUtility.getUserAgent(), capabilitiesGroup: NCBrandOptions.sharedInstance.capabilitiesGroups, nextcloudVersion: capabilities.versionMajor, delegate: NCNetworking.sharedInstance)
-                NCNetworking.sharedInstance.setup(account: tableAccount.account, delegate: providerExtension as? NCNetworkingDelegate)
+                NCNetworking.sharedInstance.delegate = providerExtension as? NCNetworkingDelegate
                 
                 foundAccount = true
             }

+ 2 - 2
File Provider Extension/FileProviderDomain.swift

@@ -29,7 +29,7 @@ class FileProviderDomain: NSObject {
         return instance
     }()
 
-    @available(iOS 11.0, *) @objc func registerDomain() {
+    @objc func registerDomain() {
         
         NSFileProviderManager.getDomainsWithCompletionHandler { (fileProviderDomain, error) in
             
@@ -70,7 +70,7 @@ class FileProviderDomain: NSObject {
         }
     }
     
-    @available(iOS 11.0, *) @objc func removeAllDomain() {
+    @objc func removeAllDomain() {
         
         NSFileProviderManager.getDomainsWithCompletionHandler { (fileProviderDomain, error) in
             

+ 0 - 14
File Provider Extension/FileProviderExtension-Bridging-Header.h

@@ -21,19 +21,5 @@
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
-#import "CCNetworking.h"
-#import "OCNetworking.h"
 #import "CCGlobal.h"
-#import "CCHud.h"
-#import "BKPasscodeViewController.h"
-#import "CCBKPasscode.h"
 #import "CCUtility.h"
-#import "NCEndToEndEncryption.h"
-#import "NCNetworkingEndToEnd.h"
-#import "OCActivity.h"
-#import "OCUserProfile.h"
-#import "OCCapabilities.h"
-#import "OCExternalSites.h"
-#import "OCSharedDto.h"
-#import "HCFeatures.h"
-#import "NCComments.h"

+ 1 - 10
File Provider Extension/FileProviderExtension.swift

@@ -309,7 +309,6 @@ class FileProviderExtension: NSFileProviderExtension {
             
                 var size = 0 as Double
                 var error: NSError?
-                let metadata = tableMetadata()
                 
                 guard let tableDirectory = fileProviderUtility.sharedInstance.getTableDirectoryFromParentItemIdentifier(parentItemIdentifier, account: fileProviderData.sharedInstance.account, homeServerUrl: fileProviderData.sharedInstance.homeServerUrl) else {
                     completionHandler(nil, NSFileProviderError(.noSuchItem))
@@ -342,18 +341,10 @@ class FileProviderExtension: NSFileProviderExtension {
                 
                 fileURL.stopAccessingSecurityScopedResource()
                                 
-                metadata.account = fileProviderData.sharedInstance.account
-                metadata.date = NSDate()
-                metadata.directory = false
-                metadata.etag = ""
-                metadata.fileName = fileName
-                metadata.fileNameView = fileName
-                metadata.ocId = ocIdTemp
-                metadata.serverUrl = tableDirectory.serverUrl
+                let metadata = NCManageDatabase.sharedInstance.createMetadata(account: fileProviderData.sharedInstance.account, fileName: fileName, ocId: ocIdTemp, serverUrl: tableDirectory.serverUrl, url: "", contentType: "")
                 metadata.session = k_upload_session_extension
                 metadata.size = size
                 metadata.status = Int(k_metadataStatusInUpload)
-                CCUtility.insertTypeFileIconName(fileName, metadata: metadata)
                 
                 guard let metadataForUpload = NCManageDatabase.sharedInstance.addMetadata(metadata) else {
                     completionHandler(nil, NSFileProviderError(.noSuchItem))

+ 7 - 1
File Provider Extension/FileProviderItem.swift

@@ -22,6 +22,7 @@
 //
 
 import FileProvider
+import NCCommunication
 
 class FileProviderItem: NSObject, NSFileProviderItem {
 
@@ -41,7 +42,12 @@ class FileProviderItem: NSObject, NSFileProviderItem {
     }
     
     var typeIdentifier: String {
-        return CCUtility.insertTypeFileIconName(metadata.fileNameView, metadata: metadata)
+        let results = NCCommunicationCommon.sharedInstance.getInternalContenType(fileName: metadata.fileNameView, contentType: "", directory: metadata.directory)
+        metadata.contentType = results.contentType
+        metadata.iconName = results.iconName
+        metadata.typeFile = results.typeFile
+        
+        return results.typeIdentifier
     }
     
     var contentModificationDate: Date? {

+ 36 - 180
Nextcloud.xcodeproj/project.pbxproj

@@ -9,19 +9,9 @@
 /* Begin PBXBuildFile section */
 		2C1D5D7523E2DE3300334ABB /* NCDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB41ED5A87C00B7EAD4 /* NCDatabase.swift */; };
 		2C1D5D7623E2DE3300334ABB /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */; };
-		2C1D5D7723E2DE5F00334ABB /* CCUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F7053E3D1C639DF500741EA5 /* CCUtility.m */; };
-		2C1D5D7823E2DE6A00334ABB /* CCGraphics.m in Sources */ = {isa = PBXBuildFile; fileRef = F76C3B841C6388BC00DC4301 /* CCGraphics.m */; };
 		2C1D5D7923E2DE9100334ABB /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; };
-		2C1D5D7A23E2DEBF00334ABB /* HCFeatures.m in Sources */ = {isa = PBXBuildFile; fileRef = F781996822636BFA00EBDF6A /* HCFeatures.m */; };
-		2C1D5D7B23E2DED200334ABB /* NCComments.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B6ACDA22FC2D15008AB646 /* NCComments.m */; };
 		2C33C48223E2C475005F963B /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C33C48123E2C475005F963B /* NotificationService.swift */; };
 		2C33C48623E2C475005F963B /* Notification Service Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 2C33C47F23E2C475005F963B /* Notification Service Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
-		2C59AC5823E2DFEE00733BE8 /* OCUserProfile.m in Sources */ = {isa = PBXBuildFile; fileRef = F700227D1EC4C9100080073F /* OCUserProfile.m */; };
-		2C59AC5923E2E00F00733BE8 /* OCActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022671EC4C9100080073F /* OCActivity.m */; };
-		2C59AC5A23E2E01A00733BE8 /* OCCapabilities.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022691EC4C9100080073F /* OCCapabilities.m */; };
-		2C59AC5B23E2E02700733BE8 /* OCExternalSites.m in Sources */ = {isa = PBXBuildFile; fileRef = F700226E1EC4C9100080073F /* OCExternalSites.m */; };
-		2C59AC5C23E2E03400733BE8 /* OCSharedDto.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022791EC4C9100080073F /* OCSharedDto.m */; };
-		2CB7D1C923E2E40B00376EF9 /* NCUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70BFC7320E0FA7C00C67599 /* NCUtility.swift */; };
 		2CB7D1CA23E2EDCB00376EF9 /* NCPushNotificationEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F72D1005210B6882009C96B7 /* NCPushNotificationEncryption.m */; };
 		3704EB2A23D5A58400455C5B /* NCMenu.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3704EB2923D5A58400455C5B /* NCMenu.storyboard */; };
 		371B5A2E23D0B04500FAFAE9 /* NCMainMenuTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 371B5A2D23D0B04500FAFAE9 /* NCMainMenuTableViewController.swift */; };
@@ -95,9 +85,6 @@
 		F70BFC7520E0FA7D00C67599 /* NCUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70BFC7320E0FA7C00C67599 /* NCUtility.swift */; };
 		F70CAE3A1F8CF31A008125FD /* NCEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F70CAE391F8CF31A008125FD /* NCEndToEndEncryption.m */; };
 		F70CEF5623E9C7E50007035B /* UIColor+adjust.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70CEF5523E9C7E50007035B /* UIColor+adjust.swift */; };
-		F70CEF5723E9C7E50007035B /* UIColor+adjust.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70CEF5523E9C7E50007035B /* UIColor+adjust.swift */; };
-		F70CEF5823E9C7E50007035B /* UIColor+adjust.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70CEF5523E9C7E50007035B /* UIColor+adjust.swift */; };
-		F70CEF5923E9C7E50007035B /* UIColor+adjust.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70CEF5523E9C7E50007035B /* UIColor+adjust.swift */; };
 		F70F2BA5225F2D8900EBB73E /* ZIPFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F70F2BA4225F2D8900EBB73E /* ZIPFoundation.framework */; };
 		F710D1F52405770F00A6033D /* NCViewerPDF.swift in Sources */ = {isa = PBXBuildFile; fileRef = F710D1F42405770F00A6033D /* NCViewerPDF.swift */; };
 		F710D1F724057C9400A6033D /* NCDetailNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F710D1F624057C9400A6033D /* NCDetailNavigationController.swift */; };
@@ -126,9 +113,6 @@
 		F7169A1E1EE590930086BD69 /* NCSharesCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7169A1B1EE590930086BD69 /* NCSharesCell.xib */; };
 		F716FE7823795E5000FABE50 /* NCCommunication.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F716FE7723795E5000FABE50 /* NCCommunication.framework */; settings = {ATTRIBUTES = (Required, ); }; };
 		F716FE7A23795EC500FABE50 /* FileProviderExtension+NetworkingDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F716FE7923795EC500FABE50 /* FileProviderExtension+NetworkingDelegate.swift */; };
-		F720FA9C242CA3EC00AA988A /* UIImage+fixedOrientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+fixedOrientation.swift */; };
-		F720FA9D242CA3ED00AA988A /* UIImage+fixedOrientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+fixedOrientation.swift */; };
-		F720FA9E242CA3ED00AA988A /* UIImage+fixedOrientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+fixedOrientation.swift */; };
 		F7226EDC1EE4089300EBECB1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7226EDB1EE4089300EBECB1 /* Main.storyboard */; };
 		F722814323C8C34500C41898 /* NCRichWorkspace.xib in Resources */ = {isa = PBXBuildFile; fileRef = F722814223C8C34500C41898 /* NCRichWorkspace.xib */; };
 		F72382C02295856A005B8A07 /* FirebaseMLVisionTextModel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F72382BB22958569005B8A07 /* FirebaseMLVisionTextModel.framework */; };
@@ -207,46 +191,12 @@
 		F73CC07C1E813DFF006E3047 /* BKTouchIDManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F73CC0661E813DFF006E3047 /* BKTouchIDManager.m */; };
 		F73CC07E1E813DFF006E3047 /* BKTouchIDSwitchView.m in Sources */ = {isa = PBXBuildFile; fileRef = F73CC0681E813DFF006E3047 /* BKTouchIDSwitchView.m */; };
 		F73CC07F1E813DFF006E3047 /* BKTouchIDSwitchView.m in Sources */ = {isa = PBXBuildFile; fileRef = F73CC0681E813DFF006E3047 /* BKTouchIDSwitchView.m */; };
-		F73D71621F2673C200E233EB /* NCText.swift in Sources */ = {isa = PBXBuildFile; fileRef = F73D71611F2673C200E233EB /* NCText.swift */; };
-		F73D71641F2674A400E233EB /* NCText.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F73D71631F2674A400E233EB /* NCText.storyboard */; };
 		F73F537F1E929C8500F8678D /* CCMore.swift in Sources */ = {isa = PBXBuildFile; fileRef = F73F537E1E929C8500F8678D /* CCMore.swift */; };
 		F7417DB3216CE925007D05F5 /* NCTrashSectionHeaderFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7417DB2216CE925007D05F5 /* NCTrashSectionHeaderFooter.swift */; };
 		F7421EAF2294044B00C4B7C1 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7421EAE2294044B00C4B7C1 /* Accelerate.framework */; };
 		F7434B3420E23FD700417916 /* NCDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB41ED5A87C00B7EAD4 /* NCDatabase.swift */; };
 		F7434B3620E23FE000417916 /* NCManageDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB51ED5A87C00B7EAD4 /* NCManageDatabase.swift */; };
-		F7434B3720E23FF200417916 /* NCUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70BFC7320E0FA7C00C67599 /* NCUtility.swift */; };
 		F7434B3820E2400600417916 /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; };
-		F7434B3A20E2403500417916 /* OCActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022671EC4C9100080073F /* OCActivity.m */; };
-		F7434B3B20E2403900417916 /* OCCapabilities.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022691EC4C9100080073F /* OCCapabilities.m */; };
-		F7434B3C20E2403D00417916 /* OCCommunication.m in Sources */ = {isa = PBXBuildFile; fileRef = F700226B1EC4C9100080073F /* OCCommunication.m */; };
-		F7434B3D20E2404300417916 /* OCExternalSites.m in Sources */ = {isa = PBXBuildFile; fileRef = F700226E1EC4C9100080073F /* OCExternalSites.m */; };
-		F7434B3E20E2404700417916 /* OCFileDto.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022701EC4C9100080073F /* OCFileDto.m */; };
-		F7434B3F20E2404B00417916 /* OCNotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022731EC4C9100080073F /* OCNotifications.m */; };
-		F7434B4020E2404E00417916 /* OCNotificationsAction.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022751EC4C9100080073F /* OCNotificationsAction.m */; };
-		F7434B4120E2405200417916 /* OCRichObjectStrings.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022771EC4C9100080073F /* OCRichObjectStrings.m */; };
-		F7434B4220E2405500417916 /* OCSharedDto.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022791EC4C9100080073F /* OCSharedDto.m */; };
-		F7434B4320E2405900417916 /* OCShareUser.m in Sources */ = {isa = PBXBuildFile; fileRef = F700227B1EC4C9100080073F /* OCShareUser.m */; };
-		F7434B4420E2405C00417916 /* OCUserProfile.m in Sources */ = {isa = PBXBuildFile; fileRef = F700227D1EC4C9100080073F /* OCUserProfile.m */; };
-		F7434B4B20E2408000417916 /* NSDate+ISO8601.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022801EC4C9100080073F /* NSDate+ISO8601.m */; };
-		F7434B4C20E2408300417916 /* NSDate+RFC1123.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022821EC4C9100080073F /* NSDate+RFC1123.m */; };
-		F7434B4D20E2408600417916 /* OCHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022841EC4C9100080073F /* OCHTTPRequestOperation.m */; };
-		F7434B4E20E2408A00417916 /* OCWebDAVClient.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022861EC4C9100080073F /* OCWebDAVClient.m */; };
-		F7434B5120E2409500417916 /* OCXMLServerErrorsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F700228D1EC4C9100080073F /* OCXMLServerErrorsParser.m */; };
-		F7434B5220E2409900417916 /* OCXMLShareByLinkParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F700228F1EC4C9100080073F /* OCXMLShareByLinkParser.m */; };
-		F7434B5320E2409E00417916 /* OCXMLSharedParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022911EC4C9100080073F /* OCXMLSharedParser.m */; };
-		F7434B5420E240A300417916 /* NSString+Encode.m in Sources */ = {isa = PBXBuildFile; fileRef = F700229D1EC4C9100080073F /* NSString+Encode.m */; };
-		F7434B5520E240A900417916 /* UtilsFramework.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022A01EC4C9100080073F /* UtilsFramework.m */; };
-		F7434B5620E2412900417916 /* CCError.m in Sources */ = {isa = PBXBuildFile; fileRef = F76C3B881C638A4C00DC4301 /* CCError.m */; };
-		F7434B5820E241B100417916 /* CCNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = F732BA041D76CE1500E9878B /* CCNetworking.m */; };
-		F7434B5920E241B600417916 /* OCNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = F74D3DBE1BAC1941000BAE4B /* OCNetworking.m */; };
-		F7434B5A20E241BB00417916 /* NCNetworkingEndToEnd.m in Sources */ = {isa = PBXBuildFile; fileRef = F74E432520B5547700C2E54C /* NCNetworkingEndToEnd.m */; };
-		F7434B5B20E241D100417916 /* NCEndToEndMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F878AD1FB9E3B900599E4F /* NCEndToEndMetadata.swift */; };
-		F7434B5C20E241D500417916 /* NCEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F70CAE391F8CF31A008125FD /* NCEndToEndEncryption.m */; };
-		F7434B5D20E241E800417916 /* CCUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F7053E3D1C639DF500741EA5 /* CCUtility.m */; };
-		F7434B5E20E241EC00417916 /* CCGraphics.m in Sources */ = {isa = PBXBuildFile; fileRef = F76C3B841C6388BC00DC4301 /* CCGraphics.m */; };
-		F7434B6020E2445200417916 /* CCExifGeo.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A54C351C6267B500E2C8BF /* CCExifGeo.m */; };
-		F7434B6220E249F700417916 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; };
-		F7434B6320E249FB00417916 /* NSString+TruncateToWidth.m in Sources */ = {isa = PBXBuildFile; fileRef = F73049B91CB567F000C7C320 /* NSString+TruncateToWidth.m */; };
 		F745B251222D871800346520 /* QRCodeReader.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F745B250222D871800346520 /* QRCodeReader.framework */; };
 		F745B253222D88AE00346520 /* NCLoginQRCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = F745B252222D88AE00346520 /* NCLoginQRCode.swift */; };
 		F747BA1F22354D2000971601 /* NCCreateFormUploadVoiceNote.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F747BA1E22354D2000971601 /* NCCreateFormUploadVoiceNote.storyboard */; };
@@ -273,7 +223,6 @@
 		F758B460212C56A400515F55 /* ScanCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F758B45F212C56A400515F55 /* ScanCollectionView.swift */; };
 		F75A9EE623796C6F0044CFCE /* NCNetworking.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75A9EE523796C6F0044CFCE /* NCNetworking.swift */; };
 		F75A9EE723796C6F0044CFCE /* NCNetworking.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75A9EE523796C6F0044CFCE /* NCNetworking.swift */; };
-		F75A9EE823796C6F0044CFCE /* NCNetworking.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75A9EE523796C6F0044CFCE /* NCNetworking.swift */; };
 		F75AC2431F1F62450073EC19 /* NCManageAutoUploadFileName.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75AC2421F1F62450073EC19 /* NCManageAutoUploadFileName.swift */; };
 		F75ADF451DC75FFE008A7347 /* CCLogin.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F75ADF441DC75FFE008A7347 /* CCLogin.storyboard */; };
 		F75B0ABD244C4DBB00E58DCA /* NCNetworkingNotificationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75B0ABC244C4DBB00E58DCA /* NCNetworkingNotificationCenter.swift */; };
@@ -325,7 +274,6 @@
 		F765608B23BF80A400765969 /* SwiftEntryKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F765608A23BF80A400765969 /* SwiftEntryKit.framework */; };
 		F765608F23BF813600765969 /* NCContentPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F765608E23BF813500765969 /* NCContentPresenter.swift */; };
 		F765609023BF813600765969 /* NCContentPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F765608E23BF813500765969 /* NCContentPresenter.swift */; };
-		F765609123BF813600765969 /* NCContentPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F765608E23BF813500765969 /* NCContentPresenter.swift */; };
 		F76673ED22C901F6007ED366 /* FileProviderDomain.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76673EC22C901F5007ED366 /* FileProviderDomain.swift */; };
 		F76673EE22C901F6007ED366 /* FileProviderDomain.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76673EC22C901F5007ED366 /* FileProviderDomain.swift */; };
 		F76673F022C90434007ED366 /* FileProviderUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76673EF22C90433007ED366 /* FileProviderUtility.swift */; };
@@ -389,13 +337,17 @@
 		F77B0F8A1D118A16002130FE /* CCCellMain.xib in Resources */ = {isa = PBXBuildFile; fileRef = F70211F61BAC56E9003FC03E /* CCCellMain.xib */; };
 		F77B0F8C1D118A16002130FE /* CCCellMainTransfer.xib in Resources */ = {isa = PBXBuildFile; fileRef = F70211F91BAC56E9003FC03E /* CCCellMainTransfer.xib */; };
 		F77D49A91DC238E500CDC568 /* loading.gif in Resources */ = {isa = PBXBuildFile; fileRef = F77D49A71DC238E500CDC568 /* loading.gif */; };
-		F77EB6281EC08036003F814F /* CCExifGeo.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A54C351C6267B500E2C8BF /* CCExifGeo.m */; };
 		F78071091EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; };
 		F780710A1EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; };
 		F781996922636BFA00EBDF6A /* HCFeatures.m in Sources */ = {isa = PBXBuildFile; fileRef = F781996822636BFA00EBDF6A /* HCFeatures.m */; };
 		F781996A22636BFA00EBDF6A /* HCFeatures.m in Sources */ = {isa = PBXBuildFile; fileRef = F781996822636BFA00EBDF6A /* HCFeatures.m */; };
-		F781996B22636BFA00EBDF6A /* HCFeatures.m in Sources */ = {isa = PBXBuildFile; fileRef = F781996822636BFA00EBDF6A /* HCFeatures.m */; };
 		F78295311F962EFA00A572F5 /* NCEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F70CAE391F8CF31A008125FD /* NCEndToEndEncryption.m */; };
+		F785EE9D246196DF00B3F945 /* NCNetworkingE2EE.swift in Sources */ = {isa = PBXBuildFile; fileRef = F785EE9C246196DF00B3F945 /* NCNetworkingE2EE.swift */; };
+		F785EE9E2461A09900B3F945 /* NCNetworking.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75A9EE523796C6F0044CFCE /* NCNetworking.swift */; };
+		F785EEA32461A23C00B3F945 /* CCExifGeo.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A54C351C6267B500E2C8BF /* CCExifGeo.m */; };
+		F785EEA42461A4A600B3F945 /* NCUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70BFC7320E0FA7C00C67599 /* NCUtility.swift */; };
+		F785EEA52461A4CF00B3F945 /* CCUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F7053E3D1C639DF500741EA5 /* CCUtility.m */; };
+		F785EEA62461A4FB00B3F945 /* CCUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F7053E3D1C639DF500741EA5 /* CCUtility.m */; };
 		F787704F22E7019900F287A9 /* NCShareLinkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F787704E22E7019900F287A9 /* NCShareLinkCell.xib */; };
 		F78A18B623CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78A18B523CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift */; };
 		F78A18B823CDE2B300F681F3 /* NCViewerRichWorkspace.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78A18B723CDE2B300F681F3 /* NCViewerRichWorkspace.swift */; };
@@ -444,10 +396,8 @@
 		F7B4F1CB1F44356F00B53B42 /* NCUchardet.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B4F1C81F44356F00B53B42 /* NCUchardet.m */; };
 		F7B6ACD622FC2BD4008AB646 /* NCXMLCommentsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B6ACD422FC2BD3008AB646 /* NCXMLCommentsParser.m */; };
 		F7B6ACD722FC2BD4008AB646 /* NCXMLCommentsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B6ACD422FC2BD3008AB646 /* NCXMLCommentsParser.m */; };
-		F7B6ACD822FC2BD4008AB646 /* NCXMLCommentsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B6ACD422FC2BD3008AB646 /* NCXMLCommentsParser.m */; };
 		F7B6ACDB22FC2D15008AB646 /* NCComments.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B6ACDA22FC2D15008AB646 /* NCComments.m */; };
 		F7B6ACDC22FC2D15008AB646 /* NCComments.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B6ACDA22FC2D15008AB646 /* NCComments.m */; };
-		F7B6ACDD22FC2D15008AB646 /* NCComments.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B6ACDA22FC2D15008AB646 /* NCComments.m */; };
 		F7B7504B2397D38F004E13EC /* UIImage+fixedOrientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+fixedOrientation.swift */; };
 		F7BAADC81ED5A87C00B7EAD4 /* NCDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB41ED5A87C00B7EAD4 /* NCDatabase.swift */; };
 		F7BAADC91ED5A87C00B7EAD4 /* NCDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7BAADB41ED5A87C00B7EAD4 /* NCDatabase.swift */; };
@@ -463,6 +413,7 @@
 		F7C40C122199BA620004137E /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40C112199BA620004137E /* RealmSwift.framework */; };
 		F7C525A01E3B48B700FFE02C /* CCNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C5259F1E3B48B700FFE02C /* CCNotification.swift */; };
 		F7C525A21E3B6DA800FFE02C /* CCNotification.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7C525A11E3B6DA800FFE02C /* CCNotification.storyboard */; };
+		F7C7B489245EBA4100D93E60 /* NCViewerQuickLook.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */; };
 		F7C9555321F0C4CA0024296E /* NCActivity.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7C9555221F0C4CA0024296E /* NCActivity.storyboard */; };
 		F7C9555521F0C5470024296E /* NCActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C9555421F0C5470024296E /* NCActivity.swift */; };
 		F7CA1ED020E7E3FE002CC65E /* UIImage+PKDownloadButton.m in Sources */ = {isa = PBXBuildFile; fileRef = F7CA1EBC20E7E3FE002CC65E /* UIImage+PKDownloadButton.m */; };
@@ -477,7 +428,6 @@
 		F7D1612023CF19E30039EBBF /* NCViewerRichWorkspace.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7D1611F23CF19E30039EBBF /* NCViewerRichWorkspace.storyboard */; };
 		F7D2D127230804E000FD3ED7 /* NCXMLListParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F7D2D126230804E000FD3ED7 /* NCXMLListParser.m */; };
 		F7D2D128230804E000FD3ED7 /* NCXMLListParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F7D2D126230804E000FD3ED7 /* NCXMLListParser.m */; };
-		F7D2D129230804E000FD3ED7 /* NCXMLListParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F7D2D126230804E000FD3ED7 /* NCXMLListParser.m */; };
 		F7D4B6852295663D000C2C86 /* GoogleAppMeasurement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7D4B67D2295663D000C2C86 /* GoogleAppMeasurement.framework */; };
 		F7D4B6862295663D000C2C86 /* FirebaseCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7D4B67E2295663D000C2C86 /* FirebaseCore.framework */; };
 		F7D4B6872295663D000C2C86 /* FirebaseAnalytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7D4B67F2295663D000C2C86 /* FirebaseAnalytics.framework */; };
@@ -494,18 +444,14 @@
 		F7D4B69A2295666E000C2C86 /* FirebaseMLCommon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7D4B6932295666E000C2C86 /* FirebaseMLCommon.framework */; };
 		F7D4B69B2295666E000C2C86 /* GoogleMobileVision.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7D4B6942295666E000C2C86 /* GoogleMobileVision.framework */; };
 		F7D6650720FF341600BFBA9E /* NCMainCommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D6650620FF341600BFBA9E /* NCMainCommon.swift */; };
-		F7D91AAA23FBDED60038FC09 /* NCContentPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F765608E23BF813500765969 /* NCContentPresenter.swift */; };
 		F7DBC37C23325E02001A85BA /* NCAppConfigView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DBC37B23325E01001A85BA /* NCAppConfigView.swift */; };
 		F7DBC37F23325E2E001A85BA /* NCXMLGetAppPasswordParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F7DBC37E23325E2E001A85BA /* NCXMLGetAppPasswordParser.m */; };
 		F7DBC38023325E2E001A85BA /* NCXMLGetAppPasswordParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F7DBC37E23325E2E001A85BA /* NCXMLGetAppPasswordParser.m */; };
-		F7DBC38123325E2E001A85BA /* NCXMLGetAppPasswordParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F7DBC37E23325E2E001A85BA /* NCXMLGetAppPasswordParser.m */; };
 		F7DBD82C23E46A4700ECB7C6 /* MarkdownKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7DBD82B23E46A4700ECB7C6 /* MarkdownKit.framework */; };
 		F7DFAA8A22E22EF100FC4527 /* NCShareLinkMenuView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7DFAA8922E22EF100FC4527 /* NCShareLinkMenuView.xib */; };
 		F7DFB7E0219C312D00680748 /* NCRichDocumentTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7DF219C312D00680748 /* NCRichDocumentTemplate.m */; };
 		F7DFB7E1219C312D00680748 /* NCRichDocumentTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7DF219C312D00680748 /* NCRichDocumentTemplate.m */; };
-		F7DFB7E2219C312D00680748 /* NCRichDocumentTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7DF219C312D00680748 /* NCRichDocumentTemplate.m */; };
 		F7DFB7F0219C5B8000680748 /* NCCreateFormUploadAssets.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7EF219C5B8000680748 /* NCCreateFormUploadAssets.swift */; };
-		F7DFB7F2219C5C0000680748 /* NCCreateFormUploadFileText.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7F1219C5C0000680748 /* NCCreateFormUploadFileText.swift */; };
 		F7DFB7F4219C5CA800680748 /* NCCreateFormUploadScanDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7F3219C5CA800680748 /* NCCreateFormUploadScanDocument.swift */; };
 		F7E09CE323E3088000FB3E9E /* NCMainRefreshControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E09CE223E3087F00FB3E9E /* NCMainRefreshControl.swift */; };
 		F7E09CE523E3088C00FB3E9E /* NCSplitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E09CE423E3088A00FB3E9E /* NCSplitViewController.swift */; };
@@ -520,7 +466,6 @@
 		F7F878AF1FB9E3B900599E4F /* NCEndToEndMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F878AD1FB9E3B900599E4F /* NCEndToEndMetadata.swift */; };
 		F7F8D71C1ED6183000E711F3 /* CCCellShareExt.m in Sources */ = {isa = PBXBuildFile; fileRef = F7F8D71A1ED6183000E711F3 /* CCCellShareExt.m */; };
 		F7F8D71D1ED6183000E711F3 /* CCCellShareExt.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7F8D71B1ED6183000E711F3 /* CCCellShareExt.xib */; };
-		F7FB1D3E215E191D00D669EA /* NCViewerDocumentWeb.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7FB1D3D215E191D00D669EA /* NCViewerDocumentWeb.swift */; };
 		F7FC7D561DC1F93800BB2C6A /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F7FC7D551DC1F93800BB2C6A /* libz.tbd */; };
 		F7FCFFD81D70798C000E6E29 /* CCPeekPop.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7FCFFD61D70798C000E6E29 /* CCPeekPop.storyboard */; };
 		F7FCFFE01D707B83000E6E29 /* CCPeekPop.m in Sources */ = {isa = PBXBuildFile; fileRef = F7FCFFDE1D707B83000E6E29 /* CCPeekPop.m */; };
@@ -551,26 +496,6 @@
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXCopyFilesBuildPhase section */
-		F736B556234DCF7C008A5C9F /* Embed Frameworks */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = "";
-			dstSubfolderSpec = 10;
-			files = (
-			);
-			name = "Embed Frameworks";
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		F736B559234DCF93008A5C9F /* Embed Frameworks */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = "";
-			dstSubfolderSpec = 10;
-			files = (
-			);
-			name = "Embed Frameworks";
-			runOnlyForDeploymentPostprocessing = 0;
-		};
 		F77B0F981D118A16002130FE /* Embed App Extensions */ = {
 			isa = PBXCopyFilesBuildPhase;
 			buildActionMask = 2147483647;
@@ -817,8 +742,6 @@
 		F73CC0661E813DFF006E3047 /* BKTouchIDManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKTouchIDManager.m; sourceTree = "<group>"; };
 		F73CC0671E813DFF006E3047 /* BKTouchIDSwitchView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKTouchIDSwitchView.h; sourceTree = "<group>"; };
 		F73CC0681E813DFF006E3047 /* BKTouchIDSwitchView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKTouchIDSwitchView.m; sourceTree = "<group>"; };
-		F73D71611F2673C200E233EB /* NCText.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCText.swift; sourceTree = "<group>"; };
-		F73D71631F2674A400E233EB /* NCText.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCText.storyboard; sourceTree = "<group>"; };
 		F73F537E1E929C8500F8678D /* CCMore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CCMore.swift; sourceTree = "<group>"; };
 		F7417DB2216CE925007D05F5 /* NCTrashSectionHeaderFooter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCTrashSectionHeaderFooter.swift; sourceTree = "<group>"; };
 		F7421EAE2294044B00C4B7C1 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
@@ -1024,6 +947,7 @@
 		F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSNotificationCenter+MainThread.m"; sourceTree = "<group>"; };
 		F781996722636BFA00EBDF6A /* HCFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HCFeatures.h; sourceTree = "<group>"; };
 		F781996822636BFA00EBDF6A /* HCFeatures.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HCFeatures.m; sourceTree = "<group>"; };
+		F785EE9C246196DF00B3F945 /* NCNetworkingE2EE.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCNetworkingE2EE.swift; sourceTree = "<group>"; };
 		F787704E22E7019900F287A9 /* NCShareLinkCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareLinkCell.xib; sourceTree = "<group>"; };
 		F78A18B523CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerRichWorkspaceWebView.swift; sourceTree = "<group>"; };
 		F78A18B723CDE2B300F681F3 /* NCViewerRichWorkspace.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerRichWorkspace.swift; sourceTree = "<group>"; };
@@ -1130,6 +1054,7 @@
 		F7C525A11E3B6DA800FFE02C /* CCNotification.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = CCNotification.storyboard; path = Notification/CCNotification.storyboard; sourceTree = "<group>"; };
 		F7C742C01E7BD01F00D9C973 /* iOSClient.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = iOSClient.entitlements; sourceTree = "<group>"; };
 		F7C742D01E7BD35B00D9C973 /* Share.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Share.entitlements; sourceTree = "<group>"; };
+		F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerQuickLook.swift; sourceTree = "<group>"; };
 		F7C8C1901B482CEA0048180E /* CCGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGlobal.h; sourceTree = "<group>"; };
 		F7C9555221F0C4CA0024296E /* NCActivity.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCActivity.storyboard; sourceTree = "<group>"; };
 		F7C9555421F0C5470024296E /* NCActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivity.swift; sourceTree = "<group>"; };
@@ -1190,7 +1115,6 @@
 		F7DFB7DE219C312D00680748 /* NCRichDocumentTemplate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NCRichDocumentTemplate.h; sourceTree = "<group>"; };
 		F7DFB7DF219C312D00680748 /* NCRichDocumentTemplate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NCRichDocumentTemplate.m; sourceTree = "<group>"; };
 		F7DFB7EF219C5B8000680748 /* NCCreateFormUploadAssets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCreateFormUploadAssets.swift; sourceTree = "<group>"; };
-		F7DFB7F1219C5C0000680748 /* NCCreateFormUploadFileText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCreateFormUploadFileText.swift; sourceTree = "<group>"; };
 		F7DFB7F3219C5CA800680748 /* NCCreateFormUploadScanDocument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCreateFormUploadScanDocument.swift; sourceTree = "<group>"; };
 		F7E09CE223E3087F00FB3E9E /* NCMainRefreshControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCMainRefreshControl.swift; sourceTree = "<group>"; };
 		F7E09CE423E3088A00FB3E9E /* NCSplitViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCSplitViewController.swift; sourceTree = "<group>"; };
@@ -1210,7 +1134,6 @@
 		F7F8D7191ED6183000E711F3 /* CCCellShareExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCCellShareExt.h; sourceTree = "<group>"; };
 		F7F8D71A1ED6183000E711F3 /* CCCellShareExt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCCellShareExt.m; sourceTree = "<group>"; };
 		F7F8D71B1ED6183000E711F3 /* CCCellShareExt.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CCCellShareExt.xib; sourceTree = "<group>"; };
-		F7FB1D3D215E191D00D669EA /* NCViewerDocumentWeb.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerDocumentWeb.swift; sourceTree = "<group>"; };
 		F7FC7D551DC1F93800BB2C6A /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
 		F7FCFFD61D70798C000E6E29 /* CCPeekPop.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = CCPeekPop.storyboard; sourceTree = "<group>"; };
 		F7FCFFDD1D707B83000E6E29 /* CCPeekPop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPeekPop.h; sourceTree = "<group>"; };
@@ -1697,20 +1620,12 @@
 			path = BKPasscodeView;
 			sourceTree = "<group>";
 		};
-		F73D71561F26739100E233EB /* Text */ = {
-			isa = PBXGroup;
-			children = (
-				F73D71611F2673C200E233EB /* NCText.swift */,
-				F73D71631F2674A400E233EB /* NCText.storyboard */,
-			);
-			path = Text;
-			sourceTree = "<group>";
-		};
 		F74D3DB81BAC1941000BAE4B /* Networking */ = {
 			isa = PBXGroup;
 			children = (
 				F755BD9A20594AC7008C5FBB /* NCService.swift */,
 				F75A9EE523796C6F0044CFCE /* NCNetworking.swift */,
+				F785EE9C246196DF00B3F945 /* NCNetworkingE2EE.swift */,
 				F75B0ABC244C4DBB00E58DCA /* NCNetworkingNotificationCenter.swift */,
 				F732BA031D76CE1500E9878B /* CCNetworking.h */,
 				F732BA041D76CE1500E9878B /* CCNetworking.m */,
@@ -2019,7 +1934,7 @@
 				F72D404823D2082500A97FD0 /* NCViewerNextcloudText.swift */,
 				F76D3CEF2428B3DD005DFA87 /* NCViewerPDF */,
 				F790110D21415BF600D7B136 /* NCViewerRichdocument.swift */,
-				F7FB1D3D215E191D00D669EA /* NCViewerDocumentWeb.swift */,
+				F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */,
 				F79630ED215527D40015EEA5 /* NCViewerVideo.swift */,
 			);
 			path = Viewer;
@@ -2353,7 +2268,6 @@
 				F704B5E62430C06700632F5F /* NCCreateFormUploadConflictCell.xib */,
 				F7651A8823A2A3F2001403D2 /* NCCreateFormUploadDocuments.storyboard */,
 				F7651A8923A2A3F2001403D2 /* NCCreateFormUploadDocuments.swift */,
-				F7DFB7F1219C5C0000680748 /* NCCreateFormUploadFileText.swift */,
 				F7DFB7F3219C5CA800680748 /* NCCreateFormUploadScanDocument.swift */,
 				F747BA1E22354D2000971601 /* NCCreateFormUploadVoiceNote.storyboard */,
 				F7020FCD2233D7F700B7297D /* NCCreateFormUploadVoiceNote.swift */,
@@ -2448,7 +2362,6 @@
 				F728CE741BF6322C00E69702 /* Share */,
 				F7169A161EE590930086BD69 /* Shares */,
 				F7B0C0CA1EE7E7750033AC24 /* Synchronize */,
-				F73D71561F26739100E233EB /* Text */,
 				F7E9C41320F4CA870040CF18 /* Transfers */,
 				F78F74322163753B00C2ADAD /* Trash */,
 				F70784811A2C8A0D00AC9FFF /* UploadFromOtherUpp */,
@@ -2590,7 +2503,6 @@
 				F71459B51D12E3B700CAFEEC /* Sources */,
 				F7145A141D12E3B700CAFEEC /* Frameworks */,
 				F7145A181D12E3B700CAFEEC /* Resources */,
-				F736B556234DCF7C008A5C9F /* Embed Frameworks */,
 			);
 			buildRules = (
 			);
@@ -2608,7 +2520,6 @@
 				F771E3CC20E2392D00AFB62D /* Sources */,
 				F771E3CD20E2392D00AFB62D /* Frameworks */,
 				F771E3CE20E2392D00AFB62D /* Resources */,
-				F736B559234DCF93008A5C9F /* Embed Frameworks */,
 			);
 			buildRules = (
 			);
@@ -2805,7 +2716,6 @@
 				F78F74342163757000C2ADAD /* NCTrash.storyboard in Resources */,
 				F79A65C32191D90F00FF6DCC /* NCSelect.storyboard in Resources */,
 				F7169A1E1EE590930086BD69 /* NCSharesCell.xib in Resources */,
-				F73D71641F2674A400E233EB /* NCText.storyboard in Resources */,
 				F7226EDC1EE4089300EBECB1 /* Main.storyboard in Resources */,
 				F7632FBF21832F8700721B71 /* NCTrashSectionHeaderMenu.xib in Resources */,
 				F739513A221B127F00D986C8 /* NCSectionMediaHeader.xib in Resources */,
@@ -2939,24 +2849,12 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				F785EEA52461A4CF00B3F945 /* CCUtility.m in Sources */,
 				2C1D5D7923E2DE9100334ABB /* NCBrand.swift in Sources */,
-				2CB7D1C923E2E40B00376EF9 /* NCUtility.swift in Sources */,
-				F70CEF5923E9C7E50007035B /* UIColor+adjust.swift in Sources */,
-				2C59AC5A23E2E01A00733BE8 /* OCCapabilities.m in Sources */,
-				2C1D5D7723E2DE5F00334ABB /* CCUtility.m in Sources */,
 				2C1D5D7523E2DE3300334ABB /* NCDatabase.swift in Sources */,
-				2C1D5D7823E2DE6A00334ABB /* CCGraphics.m in Sources */,
-				2C59AC5B23E2E02700733BE8 /* OCExternalSites.m in Sources */,
 				2C1D5D7623E2DE3300334ABB /* NCManageDatabase.swift in Sources */,
-				F720FA9E242CA3ED00AA988A /* UIImage+fixedOrientation.swift in Sources */,
-				F7D91AAA23FBDED60038FC09 /* NCContentPresenter.swift in Sources */,
 				2C33C48223E2C475005F963B /* NotificationService.swift in Sources */,
-				2C59AC5C23E2E03400733BE8 /* OCSharedDto.m in Sources */,
-				2C59AC5923E2E00F00733BE8 /* OCActivity.m in Sources */,
 				2CB7D1CA23E2EDCB00376EF9 /* NCPushNotificationEncryption.m in Sources */,
-				2C1D5D7B23E2DED200334ABB /* NCComments.m in Sources */,
-				2C59AC5823E2DFEE00733BE8 /* OCUserProfile.m in Sources */,
-				2C1D5D7A23E2DEBF00334ABB /* HCFeatures.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2967,12 +2865,12 @@
 				F71459B81D12E3B700CAFEEC /* CCError.m in Sources */,
 				F73CC0701E813DFF006E3047 /* BKPasscodeInputView.m in Sources */,
 				F71459BA1D12E3B700CAFEEC /* NSString+TruncateToWidth.m in Sources */,
+				F785EEA32461A23C00B3F945 /* CCExifGeo.m in Sources */,
 				F71459BC1D12E3B700CAFEEC /* Reachability.m in Sources */,
 				F71459BD1D12E3B700CAFEEC /* UIImage+animatedGIF.m in Sources */,
 				F73CC06D1E813DFF006E3047 /* BKPasscodeField.m in Sources */,
 				F70022C01EC4C9100080073F /* OCFileDto.m in Sources */,
 				F71459C21D12E3B700CAFEEC /* ShareViewController.m in Sources */,
-				F77EB6281EC08036003F814F /* CCExifGeo.m in Sources */,
 				F73CC0731E813DFF006E3047 /* BKPasscodeLockScreenManager.m in Sources */,
 				F7E87CC3241A559E005E8C6F /* NCNetworkingEndToEnd.m in Sources */,
 				F73CC06A1E813DFF006E3047 /* BKPasscodeDummyViewController.m in Sources */,
@@ -3005,7 +2903,6 @@
 				F75A9EE723796C6F0044CFCE /* NCNetworking.swift in Sources */,
 				F70022E71EC4C9100080073F /* OCXMLServerErrorsParser.m in Sources */,
 				F781996A22636BFA00EBDF6A /* HCFeatures.m in Sources */,
-				F720FA9C242CA3EC00AA988A /* UIImage+fixedOrientation.swift in Sources */,
 				F70022C91EC4C9100080073F /* OCRichObjectStrings.m in Sources */,
 				F70022C31EC4C9100080073F /* OCNotifications.m in Sources */,
 				F71459F71D12E3B700CAFEEC /* CCGraphics.m in Sources */,
@@ -3020,7 +2917,6 @@
 				F7145A041D12E3B700CAFEEC /* CCloadItemData.swift in Sources */,
 				F73CC07F1E813DFF006E3047 /* BKTouchIDSwitchView.m in Sources */,
 				F76B3CCF1EAE01BD00921AC9 /* NCBrand.swift in Sources */,
-				F70CEF5723E9C7E50007035B /* UIColor+adjust.swift in Sources */,
 				F73CC0761E813DFF006E3047 /* BKPasscodeViewController.m in Sources */,
 				F70022D21EC4C9100080073F /* OCUserProfile.m in Sources */,
 				F70022C61EC4C9100080073F /* OCNotificationsAction.m in Sources */,
@@ -3033,60 +2929,21 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				F781996B22636BFA00EBDF6A /* HCFeatures.m in Sources */,
-				F7434B3C20E2403D00417916 /* OCCommunication.m in Sources */,
 				F771E3F720E239B500AFB62D /* FileProviderExtension+Actions.swift in Sources */,
-				F7434B3720E23FF200417916 /* NCUtility.swift in Sources */,
-				F7B6ACD822FC2BD4008AB646 /* NCXMLCommentsParser.m in Sources */,
-				F7434B5120E2409500417916 /* OCXMLServerErrorsParser.m in Sources */,
-				F7DFB7E2219C312D00680748 /* NCRichDocumentTemplate.m in Sources */,
-				F7434B3A20E2403500417916 /* OCActivity.m in Sources */,
-				F7434B6220E249F700417916 /* NSNotificationCenter+MainThread.m in Sources */,
-				F7434B3B20E2403900417916 /* OCCapabilities.m in Sources */,
-				F7434B4B20E2408000417916 /* NSDate+ISO8601.m in Sources */,
-				F7434B4C20E2408300417916 /* NSDate+RFC1123.m in Sources */,
-				F7434B5920E241B600417916 /* OCNetworking.m in Sources */,
-				F7434B5520E240A900417916 /* UtilsFramework.m in Sources */,
-				F75A9EE823796C6F0044CFCE /* NCNetworking.swift in Sources */,
-				F7434B4120E2405200417916 /* OCRichObjectStrings.m in Sources */,
 				F76673F022C90434007ED366 /* FileProviderUtility.swift in Sources */,
 				F7434B3420E23FD700417916 /* NCDatabase.swift in Sources */,
-				F7434B4020E2404E00417916 /* OCNotificationsAction.m in Sources */,
-				F7434B5320E2409E00417916 /* OCXMLSharedParser.m in Sources */,
-				F7434B4320E2405900417916 /* OCShareUser.m in Sources */,
-				F7434B5A20E241BB00417916 /* NCNetworkingEndToEnd.m in Sources */,
 				F76673EE22C901F6007ED366 /* FileProviderDomain.swift in Sources */,
 				F7434B3820E2400600417916 /* NCBrand.swift in Sources */,
-				F7434B6320E249FB00417916 /* NSString+TruncateToWidth.m in Sources */,
-				F7434B5620E2412900417916 /* CCError.m in Sources */,
-				F7434B5C20E241D500417916 /* NCEndToEndEncryption.m in Sources */,
-				F7434B3E20E2404700417916 /* OCFileDto.m in Sources */,
-				F7434B3D20E2404300417916 /* OCExternalSites.m in Sources */,
-				F7D2D129230804E000FD3ED7 /* NCXMLListParser.m in Sources */,
-				F7434B4420E2405C00417916 /* OCUserProfile.m in Sources */,
-				F7DBC38123325E2E001A85BA /* NCXMLGetAppPasswordParser.m in Sources */,
-				F7434B5E20E241EC00417916 /* CCGraphics.m in Sources */,
+				F785EE9E2461A09900B3F945 /* NCNetworking.swift in Sources */,
 				F771E3D320E2392D00AFB62D /* FileProviderExtension.swift in Sources */,
-				F70CEF5823E9C7E50007035B /* UIColor+adjust.swift in Sources */,
-				F7434B5B20E241D100417916 /* NCEndToEndMetadata.swift in Sources */,
-				F7B6ACDD22FC2D15008AB646 /* NCComments.m in Sources */,
-				F7434B5D20E241E800417916 /* CCUtility.m in Sources */,
-				F7434B5220E2409900417916 /* OCXMLShareByLinkParser.m in Sources */,
 				F771E3D520E2392D00AFB62D /* FileProviderItem.swift in Sources */,
 				F7434B3620E23FE000417916 /* NCManageDatabase.swift in Sources */,
 				F716FE7A23795EC500FABE50 /* FileProviderExtension+NetworkingDelegate.swift in Sources */,
+				F785EEA42461A4A600B3F945 /* NCUtility.swift in Sources */,
 				F771E3F320E239A600AFB62D /* FileProviderData.swift in Sources */,
 				F771E3D720E2392D00AFB62D /* FileProviderEnumerator.swift in Sources */,
-				F7434B4220E2405500417916 /* OCSharedDto.m in Sources */,
-				F720FA9D242CA3ED00AA988A /* UIImage+fixedOrientation.swift in Sources */,
-				F7434B3F20E2404B00417916 /* OCNotifications.m in Sources */,
-				F7434B6020E2445200417916 /* CCExifGeo.m in Sources */,
-				F7434B5420E240A300417916 /* NSString+Encode.m in Sources */,
-				F765609123BF813600765969 /* NCContentPresenter.swift in Sources */,
-				F7434B4E20E2408A00417916 /* OCWebDAVClient.m in Sources */,
 				F771E3F820E239B500AFB62D /* FileProviderExtension+Thumbnail.swift in Sources */,
-				F7434B4D20E2408600417916 /* OCHTTPRequestOperation.m in Sources */,
-				F7434B5820E241B100417916 /* CCNetworking.m in Sources */,
+				F785EEA62461A4FB00B3F945 /* CCUtility.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -3137,11 +2994,9 @@
 				F73F537F1E929C8500F8678D /* CCMore.swift in Sources */,
 				F73B4EF71F470D9100BBEE4B /* LangBulgarianModel.cpp in Sources */,
 				F79018B7240962C7007C9B6D /* NCViewerImageContentView.swift in Sources */,
-				F7FB1D3E215E191D00D669EA /* NCViewerDocumentWeb.swift in Sources */,
 				F78E7065219F096B006F23E4 /* NCAvatar.swift in Sources */,
 				F7DFB7F0219C5B8000680748 /* NCCreateFormUploadAssets.swift in Sources */,
 				F762CB0C1EACB66200B38484 /* XLFormSectionDescriptor.m in Sources */,
-				F7DFB7F2219C5C0000680748 /* NCCreateFormUploadFileText.swift in Sources */,
 				371B5A2E23D0B04500FAFAE9 /* NCMainMenuTableViewController.swift in Sources */,
 				F750374F1DBFA91A008FB480 /* NSArray+PureLayout.m in Sources */,
 				F77444F8222816D5000D5EB0 /* NCPhotosPickerViewController.swift in Sources */,
@@ -3190,6 +3045,7 @@
 				F7DFB7E0219C312D00680748 /* NCRichDocumentTemplate.m in Sources */,
 				F769454222E9F0EE000A798A /* NCShareLinkMenuView.swift in Sources */,
 				F73B4F0B1F470D9100BBEE4B /* nsGB2312Prober.cpp in Sources */,
+				F785EE9D246196DF00B3F945 /* NCNetworkingE2EE.swift in Sources */,
 				F762CAFE1EACB66200B38484 /* XLFormLeftRightSelectorCell.m in Sources */,
 				F77B0E301D118A16002130FE /* CCHud.m in Sources */,
 				F76673ED22C901F6007ED366 /* FileProviderDomain.swift in Sources */,
@@ -3232,7 +3088,6 @@
 				F7F878AE1FB9E3B900599E4F /* NCEndToEndMetadata.swift in Sources */,
 				F7DBC37C23325E02001A85BA /* NCAppConfigView.swift in Sources */,
 				F762CB141EACB66200B38484 /* XLFormRightImageButton.m in Sources */,
-				F73D71621F2673C200E233EB /* NCText.swift in Sources */,
 				F73B4EF81F470D9100BBEE4B /* LangDanishModel.cpp in Sources */,
 				F738143A240FE48D00404AC7 /* NCViewerImageCommon.swift in Sources */,
 				3781B9B023DB2B7E006B4B1D /* AppDelegate+Menu.swift in Sources */,
@@ -3332,6 +3187,7 @@
 				F75AC2431F1F62450073EC19 /* NCManageAutoUploadFileName.swift in Sources */,
 				F79630EE215527D40015EEA5 /* NCViewerVideo.swift in Sources */,
 				F7CA1ED620E7E3FE002CC65E /* CALayer+PKDownloadButtonAnimations.m in Sources */,
+				F7C7B489245EBA4100D93E60 /* NCViewerQuickLook.swift in Sources */,
 				F758B45E212C569D00515F55 /* ScanCell.swift in Sources */,
 				F781996922636BFA00EBDF6A /* HCFeatures.m in Sources */,
 				F70022FE1EC4C9100080073F /* UtilsFramework.m in Sources */,
@@ -3442,7 +3298,7 @@
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 35;
+				CURRENT_PROJECT_VERSION = 44;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -3468,7 +3324,7 @@
 				PRODUCT_BUNDLE_IDENTIFIER = "it.twsweb.Nextcloud.Notification-Service-Extension";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SKIP_INSTALL = YES;
-				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
+				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_NOTIFICATION_SERVICE";
 				SWIFT_OBJC_BRIDGING_HEADER = "Notification Service Extension/Notification_Service_Extension-Bridging-Header.h";
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
 				SWIFT_VERSION = 5.0;
@@ -3493,7 +3349,7 @@
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 35;
+				CURRENT_PROJECT_VERSION = 44;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -3518,7 +3374,7 @@
 				PRODUCT_BUNDLE_IDENTIFIER = "it.twsweb.Nextcloud.Notification-Service-Extension";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SKIP_INSTALL = YES;
-				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
+				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_NOTIFICATION_SERVICE";
 				SWIFT_OBJC_BRIDGING_HEADER = "Notification Service Extension/Notification_Service_Extension-Bridging-Header.h";
 				SWIFT_VERSION = 5.0;
 				TARGETED_DEVICE_FAMILY = "1,2";
@@ -3536,7 +3392,7 @@
 				CODE_SIGN_ENTITLEMENTS = iOSClient/Brand/Share.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 35;
+				CURRENT_PROJECT_VERSION = 44;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -3552,7 +3408,7 @@
 				);
 				HEADER_SEARCH_PATHS = "\"Libraries external\"/**";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/Share.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 10.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
 				LIBRARY_SEARCH_PATHS = "\"Libraries external\"/**";
 				MARKETING_VERSION = 3.0.0;
@@ -3560,7 +3416,7 @@
 				PRODUCT_BUNDLE_IDENTIFIER = it.twsweb.Nextcloud.Share;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SKIP_INSTALL = YES;
-				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
+				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_SHARE";
 				SWIFT_OBJC_BRIDGING_HEADER = "Share/Share-Bridging-Header.h";
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
 				SWIFT_VERSION = 5.0;
@@ -3580,7 +3436,7 @@
 				CODE_SIGN_ENTITLEMENTS = iOSClient/Brand/Share.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 35;
+				CURRENT_PROJECT_VERSION = 44;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -3596,7 +3452,7 @@
 				);
 				HEADER_SEARCH_PATHS = "\"Libraries external\"/**";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/Share.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 10.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
 				LIBRARY_SEARCH_PATHS = "\"Libraries external\"/**";
 				MARKETING_VERSION = 3.0.0;
@@ -3604,7 +3460,7 @@
 				PRODUCT_BUNDLE_IDENTIFIER = it.twsweb.Nextcloud.Share;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SKIP_INSTALL = YES;
-				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
+				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_SHARE";
 				SWIFT_OBJC_BRIDGING_HEADER = "Share/Share-Bridging-Header.h";
 				SWIFT_VERSION = 5.0;
 				TARGETED_DEVICE_FAMILY = "1,2";
@@ -3630,7 +3486,7 @@
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 35;
+				CURRENT_PROJECT_VERSION = 44;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -3654,7 +3510,7 @@
 				PRODUCT_BUNDLE_IDENTIFIER = "it.twsweb.Nextcloud.File-Provider-Extension";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SKIP_INSTALL = YES;
-				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
+				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_FILE_PROVIDER_EXTENSION";
 				SWIFT_OBJC_BRIDGING_HEADER = "File Provider Extension/FileProviderExtension-Bridging-Header.h";
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
 				SWIFT_VERSION = 5.0;
@@ -3680,7 +3536,7 @@
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 35;
+				CURRENT_PROJECT_VERSION = 44;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -3704,7 +3560,7 @@
 				PRODUCT_BUNDLE_IDENTIFIER = "it.twsweb.Nextcloud.File-Provider-Extension";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SKIP_INSTALL = YES;
-				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited)";
+				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_FILE_PROVIDER_EXTENSION";
 				SWIFT_OBJC_BRIDGING_HEADER = "File Provider Extension/FileProviderExtension-Bridging-Header.h";
 				SWIFT_VERSION = 5.0;
 				TARGETED_DEVICE_FAMILY = "1,2";
@@ -3722,7 +3578,7 @@
 				CODE_SIGN_ENTITLEMENTS = iOSClient/Brand/iOSClient.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 35;
+				CURRENT_PROJECT_VERSION = 44;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = YES;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -3737,7 +3593,7 @@
 				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
 				HEADER_SEARCH_PATHS = "$(PROJECT_DIR)\"/Libraries external/openssl\"";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/iOSClient.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 10.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
 				LIBRARY_SEARCH_PATHS = "";
 				MARKETING_VERSION = 3.0.0;
@@ -3769,7 +3625,7 @@
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 35;
+				CURRENT_PROJECT_VERSION = 44;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = YES;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -3783,7 +3639,7 @@
 				GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
 				HEADER_SEARCH_PATHS = "$(PROJECT_DIR)\"/Libraries external/openssl\"";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/iOSClient.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 10.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
 				LIBRARY_SEARCH_PATHS = "";
 				MARKETING_VERSION = 3.0.0;

+ 0 - 31
Notification Service Extension/Info.plist

@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>$(DEVELOPMENT_LANGUAGE)</string>
-	<key>CFBundleDisplayName</key>
-	<string>Notification Service Extension</string>
-	<key>CFBundleExecutable</key>
-	<string>$(EXECUTABLE_NAME)</string>
-	<key>CFBundleIdentifier</key>
-	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundleName</key>
-	<string>$(PRODUCT_NAME)</string>
-	<key>CFBundlePackageType</key>
-	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
-	<key>CFBundleShortVersionString</key>
-	<string>$(MARKETING_VERSION)</string>
-	<key>CFBundleVersion</key>
-	<string>$(CURRENT_PROJECT_VERSION)</string>
-	<key>NSExtension</key>
-	<dict>
-		<key>NSExtensionPointIdentifier</key>
-		<string>com.apple.usernotifications.service</string>
-		<key>NSExtensionPrincipalClass</key>
-		<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
-	</dict>
-</dict>
-</plist>

+ 0 - 14
Notification Service Extension/Notification Service Extension.entitlements

@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>com.apple.security.application-groups</key>
-	<array>
-		<string>group.it.twsweb.Crypto-Cloud</string>
-	</array>
-	<key>keychain-access-groups</key>
-	<array>
-		<string>$(AppIdentifierPrefix)it.twsweb.Crypto-Cloud</string>
-	</array>
-</dict>
-</plist>

+ 0 - 9
Notification Service Extension/Notification_Service_Extension-Bridging-Header.h

@@ -21,12 +21,3 @@
 
 #import "CCUtility.h"
 #import "NCPushNotificationEncryption.h"
-
-#import "OCActivity.h"
-#import "OCUserProfile.h"
-#import "OCCapabilities.h"
-#import "OCExternalSites.h"
-#import "OCSharedDto.h"
-
-#import "HCFeatures.h"
-#import "NCComments.h"

+ 1 - 3
Share/NCSelectDestination.m

@@ -53,9 +53,7 @@
         
         activeAccount = tableAccount.account;
         activeUrl = tableAccount.url;
-        
-        [[NCNetworking sharedInstance] setupWithAccount:activeAccount delegate:nil];
-        
+                
     } else {
         
         UIAlertController * alert= [UIAlertController alertControllerWithTitle:nil message:NSLocalizedString(@"_no_active_account_", nil) preferredStyle:UIAlertControllerStyleAlert];

+ 3 - 8
Share/ShareViewController.m

@@ -281,18 +281,13 @@
                
                 [CCUtility copyFileAtPath:fileNameLocal toPath:[CCUtility getDirectoryProviderStorageOcId:ocId fileNameView:fileNameForUpload]];
                
-                tableMetadata *metadata = [tableMetadata new];
-               
-                metadata.account = self.activeAccount;
+                tableMetadata *metadata = [[NCManageDatabase sharedInstance] createMetadataWithAccount:self.activeAccount fileName:fileNameForUpload ocId:ocId serverUrl:self.serverUrl url:@"" contentType:@""];
+                               
                 metadata.date = date;
                 metadata.etag = etag;
-                metadata.ocId = ocId;
-                metadata.fileName = fileNameForUpload;
-                metadata.fileNameView = fileNameForUpload;
                 metadata.serverUrl = self.serverUrl;
                 metadata.size = size;
-                (void)[CCUtility insertTypeFileIconName:fileNameForUpload metadata:metadata];
-               
+                
                 metadata = [[NCManageDatabase sharedInstance] addMetadata:metadata];
                 (void)[[NCManageDatabase sharedInstance] addLocalFileWithMetadata:metadata];
                

+ 2 - 0
iOSClient/AppDelegate.h

@@ -115,6 +115,8 @@
 
 @property (nonatomic) UIUserInterfaceStyle preferredUserInterfaceStyle API_AVAILABLE(ios(12.0));
 
+@property (nonatomic, strong) NSMutableArray *sessionPendingStatusInUpload;
+
 // Shares
 @property (nonatomic, strong) NSArray *shares;
 

+ 121 - 16
iOSClient/AppDelegate.m

@@ -109,8 +109,8 @@
     [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error:nil];
     // [[AVAudioSession sharedInstance] setActive:YES error:nil];
     [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
-    
-    
+
+
     // ProgressView Detail
     self.progressViewDetail = [[UIProgressView alloc] initWithProgressViewStyle: UIProgressViewStyleBar];
     
@@ -234,6 +234,9 @@
         [[NCService sharedInstance] middlewarePing];
     }
     
+    // verify task (download/upload) lost
+    [self verifyTaskLos];
+    
     // Brand
 #if defined(HC)
     tableAccount *account = [[NCManageDatabase sharedInstance] getAccountActive];
@@ -424,7 +427,6 @@
     self.activePassword = activePassword;
     tableCapabilities *capabilities = [[NCManageDatabase sharedInstance] getCapabilitesWithAccount:activeAccount];
 
-    [[NCNetworking sharedInstance] setupWithAccount:activeAccount delegate:nil];
     (void)[NCNetworkingNotificationCenter shared];
 
     [[NCCommunicationCommon sharedInstance] setupWithUser:activeUser userId:activeUserID password:activePassword url:activeUrl userAgent:[CCUtility getUserAgent] capabilitiesGroup:[NCBrandOptions sharedInstance].capabilitiesGroups nextcloudVersion:capabilities.versionMajor delegate:[NCNetworking sharedInstance]];
@@ -670,7 +672,7 @@
         [self.arrayDeleteMetadata removeObjectAtIndex:0];
         tableAccount *account = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", metadata.account]];
         if (account) {
-            [[NCNetworking sharedInstance] deleteMetadata:metadata user:account.user userID:account.userID password:[CCUtility getPassword:metadata.account] url:account.url completion:^(NSInteger errorCode, NSString *errorDescription) { }];
+            [[NCNetworking sharedInstance] deleteMetadata:metadata account:metadata.account user:account.user userID:account.userID password:[CCUtility getPassword:metadata.account] url:account.url completion:^(NSInteger errorCode, NSString *errorDescription) { }];
         } else {
             [self deleteFile:[NSNotification new]];
         }
@@ -826,11 +828,7 @@
 {
     UITabBarItem *item;
     NSLayoutConstraint *constraint;
-    CGFloat safeAreaBottom = 0;
-    
-    if (@available(iOS 11, *)) {
-        safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
-    }
+    CGFloat safeAreaBottom = safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
    
     // File
     item = [tabBarController.tabBar.items objectAtIndex: k_tabBarApplicationIndexFile];
@@ -993,6 +991,21 @@
     // Dark Mode
     [NCBrandColor.sharedInstance setDarkMode];
     
+    // Appearance
+    UINavigationBar.appearance.tintColor = NCBrandColor.sharedInstance.brandText;
+    UINavigationBar.appearance.barTintColor = NCBrandColor.sharedInstance.brand;
+    [UINavigationBar.appearance setBackgroundImage:[[NCUtility sharedInstance] fromColorWithColor:NCBrandColor.sharedInstance.brand] forBarMetrics: UIBarMetricsDefault];
+    UINavigationBar.appearance.titleTextAttributes = @{NSForegroundColorAttributeName : NCBrandColor.sharedInstance.brandText};
+    UINavigationBar.appearance.translucent = false;
+    // Refresh UIAppearance after application loaded
+    NSArray *windows = [UIApplication sharedApplication].windows;
+    for (UIWindow *window in windows) {
+        for (UIView *view in window.subviews) {
+            [view removeFromSuperview];
+            [window addSubview:view];
+        }
+    }
+    
     // View
     if (form) viewController.view.backgroundColor = NCBrandColor.sharedInstance.backgroundForm;
     else viewController.view.backgroundColor = NCBrandColor.sharedInstance.backgroundView;
@@ -1262,6 +1275,7 @@
     long counterDownload = 0, counterUpload = 0;
     NSUInteger sizeDownload = 0, sizeUpload = 0;
     NSMutableArray *uploaded = [NSMutableArray new];
+    NSPredicate *predicate;
     
     long maxConcurrentOperationDownloadUpload = k_maxConcurrentOperation;
     
@@ -1336,7 +1350,13 @@
             break;
         }
         
-        metadataForUpload = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"sessionSelector == %@ AND status == %d", selectorUploadFile, k_metadataStatusWaitUpload] sorted:@"date" ascending:YES];
+        if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
+            predicate = [NSPredicate predicateWithFormat:@"sessionSelector == %@ AND status == %d AND typeFile != %@", selectorUploadFile, k_metadataStatusWaitUpload, k_metadataTypeFile_video];
+        } else {
+            predicate = [NSPredicate predicateWithFormat:@"sessionSelector == %@ AND status == %d", selectorUploadFile, k_metadataStatusWaitUpload];
+        }
+                
+        metadataForUpload = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:predicate sorted:@"date" ascending:YES];
         
         // Verify modify file
         if ([uploaded containsObject:[NSString stringWithFormat:@"%@%@%@", metadataForUpload.account, metadataForUpload.serverUrl, metadataForUpload.fileName]]) {
@@ -1394,9 +1414,17 @@
     
     while (counterUpload < maxConcurrentOperationDownloadUpload) {
         
-        if (sizeUpload > k_maxSizeOperationUpload) { break; }
+        if (sizeUpload > k_maxSizeOperationUpload) {
+            break;
+        }
         
-        metadataForUpload = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"sessionSelector == %@ AND status == %d", selectorUploadAutoUpload, k_metadataStatusWaitUpload] sorted:@"date" ascending:YES];
+        if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
+            predicate = [NSPredicate predicateWithFormat:@"sessionSelector == %@ AND status == %d AND typeFile != %@", selectorUploadAutoUpload, k_metadataStatusWaitUpload, k_metadataTypeFile_video];
+        } else {
+            predicate = [NSPredicate predicateWithFormat:@"sessionSelector == %@ AND status == %d", selectorUploadAutoUpload, k_metadataStatusWaitUpload];
+        }
+        
+        metadataForUpload = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:predicate sorted:@"date" ascending:YES];
         if (metadataForUpload) {
             
             if ([CCUtility isFolderEncrypted:metadataForUpload.serverUrl e2eEncrypted:metadataForUpload.e2eEncrypted account:metadataForUpload.account]) {
@@ -1446,7 +1474,13 @@
                 break;
             }
             
-            metadataForUpload = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"sessionSelector == %@ AND status == %d", selectorUploadAutoUploadAll, k_metadataStatusWaitUpload] sorted:@"session" ascending:YES];
+            if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
+                predicate = [NSPredicate predicateWithFormat:@"sessionSelector == %@ AND status == %d AND typeFile != %@", selectorUploadAutoUploadAll, k_metadataStatusWaitUpload, k_metadataTypeFile_video];
+            } else {
+                predicate = [NSPredicate predicateWithFormat:@"sessionSelector == %@ AND status == %d", selectorUploadAutoUploadAll, k_metadataStatusWaitUpload];
+            }
+            
+            metadataForUpload = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:predicate sorted:@"session" ascending:YES];
             if (metadataForUpload) {
                 
                 if ([CCUtility isFolderEncrypted:metadataForUpload.serverUrl e2eEncrypted:metadataForUpload.e2eEncrypted account:metadataForUpload.account]) {
@@ -1495,6 +1529,21 @@
         }
     }
     
+    // Upload in pending
+    //
+    NSArray *metadatasInUpload = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"session != %@ AND status == %d AND sessionTaskIdentifier == 0", k_upload_session_extension, k_metadataStatusInUpload] sorted:nil ascending:true];
+    for (tableMetadata *metadata in metadatasInUpload) {
+        if ([self.sessionPendingStatusInUpload containsObject:metadata.ocId]) {
+            metadata.status = k_metadataStatusWaitUpload;
+            (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+        } else {
+            [self.sessionPendingStatusInUpload addObject:metadata.ocId];
+        }
+    }
+    if (metadatasInUpload.count == 0) {
+        [self.sessionPendingStatusInUpload removeAllObjects];
+    }
+    
     // Start Timer
     _timerProcessAutoDownloadUpload = [NSTimer scheduledTimerWithTimeInterval:k_timerProcessAutoDownloadUpload target:self selector:@selector(loadAutoDownloadUpload) userInfo:nil repeats:YES];
 }
@@ -1506,6 +1555,63 @@
     }
 }
 
+- (void)verifyTaskLos
+{
+    // DOWNLOAD
+    //
+    NSArray *matadatasInDownloading = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"status == %d", k_metadataStatusDownloading] sorted:nil ascending:true];
+    for (tableMetadata *metadata in matadatasInDownloading) {
+        
+        NSURLSession *session = [[CCNetworking sharedNetworking] getSessionfromSessionDescription:metadata.session];
+        
+        [session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
+            
+            NSURLSessionTask *findTask;
+            
+            for (NSURLSessionTask *task in downloadTasks) {
+                if (task.taskIdentifier == metadata.sessionTaskIdentifier) {
+                    findTask = task;
+                }
+            }
+            
+            if (!findTask) {
+                
+                metadata.sessionTaskIdentifier = k_taskIdentifierDone;
+                metadata.status = k_metadataStatusWaitDownload;
+                
+                (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+            }
+        }];
+    }
+
+    // UPLOAD
+    //
+    NSArray *metadatasUploading = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"session != %@ AND status == %d", k_upload_session_extension, k_metadataStatusUploading] sorted:nil ascending:true];
+    for (tableMetadata *metadata in metadatasUploading) {
+        
+        NSURLSession *session = [[CCNetworking sharedNetworking] getSessionfromSessionDescription:metadata.session];
+        
+        [session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
+            
+            NSURLSessionTask *findTask;
+            
+            for (NSURLSessionTask *task in uploadTasks) {
+                if (task.taskIdentifier == metadata.sessionTaskIdentifier) {
+                    findTask = task;
+                }
+            }
+            
+            if (!findTask) {
+                
+                metadata.sessionTaskIdentifier = k_taskIdentifierDone;
+                metadata.status = k_metadataStatusWaitUpload;
+                
+                (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
+            }
+        }];
+    }
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== OpenURL  =====
 #pragma --------------------------------------------------------------------------------------------
@@ -1604,10 +1710,9 @@
                                                 if ([path containsString:@"/"]) {
                                                     
                                                     // Push
-                                                    NSString *directoryName = [[path stringByDeletingLastPathComponent] lastPathComponent];
+                                                    NSString *fileName = [[path stringByDeletingLastPathComponent] lastPathComponent];
                                                     NSString *serverUrl = [CCUtility deletingLastPathComponentFromServerUrl:[NSString stringWithFormat:@"%@%@/%@", matchedAccount.url, k_webDAV, [path stringByDeletingLastPathComponent]]];
-                                                    tableMetadata *metadata = [CCUtility createMetadataWithAccount:matchedAccount.account date:[NSDate date] directory:NO ocId:[[NSUUID UUID] UUIDString] serverUrl:serverUrl fileName:directoryName etag:@"" size:0 status:k_metadataStatusNormal url:@"" contentType:@""];
-                                                    
+                                                    tableMetadata *metadata = [[NCManageDatabase sharedInstance] createMetadataWithAccount:matchedAccount.account fileName:fileName ocId:[[NSUUID UUID] UUIDString] serverUrl:serverUrl url:@"" contentType:@""];
                                                     [self.activeMain performSegueDirectoryWithControlPasscode:true metadata:metadata blinkFileNamePath:fileNamePath];
                                                     
                                                 } else {

+ 3 - 15
iOSClient/AutoUpload/NCAutoUpload.m

@@ -404,15 +404,9 @@
         tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileNameView == %@", appDelegate.activeAccount, serverUrl, fileName]];
         if (!metadata) {
         
-            tableMetadata *metadataForUpload = [tableMetadata new];
+            tableMetadata *metadataForUpload = [[NCManageDatabase sharedInstance] createMetadataWithAccount:appDelegate.activeAccount fileName:fileName ocId:[[NSUUID UUID] UUIDString] serverUrl:serverUrl url:@"" contentType:@""];
             
-            metadataForUpload.account = appDelegate.activeAccount;
             metadataForUpload.assetLocalIdentifier = asset.localIdentifier;
-            metadataForUpload.date = [NSDate new];
-            metadataForUpload.ocId = [CCUtility createMetadataIDFromAccount:appDelegate.activeAccount serverUrl:serverUrl fileNameView:fileName directory:false];
-            metadataForUpload.fileName = fileName;
-            metadataForUpload.fileNameView = fileName;
-            metadataForUpload.serverUrl = serverUrl;
             metadataForUpload.session = session;
             metadataForUpload.sessionSelector = selector;
             metadataForUpload.size = [[NCUtility sharedInstance] getFileSizeWithAsset:asset];
@@ -422,7 +416,7 @@
             if ((asset.mediaSubtypes == PHAssetMediaSubtypePhotoLive || asset.mediaSubtypes == PHAssetMediaSubtypePhotoLive+PHAssetMediaSubtypePhotoHDR) && CCUtility.getLivePhoto) {
                 
                 NSString *fileNameMove = [NSString stringWithFormat:@"%@.mov", fileName.stringByDeletingPathExtension];
-                NSString *ocId = [CCUtility createMetadataIDFromAccount:appDelegate.activeAccount serverUrl:serverUrl fileNameView:fileNameMove directory:false];
+                NSString *ocId = [[NSUUID UUID] UUIDString];
                 NSString *filePath = [CCUtility getDirectoryProviderStorageOcId:ocId fileNameView:fileNameMove];
                 
                 dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
@@ -431,14 +425,8 @@
                     if (url != nil) {
                         unsigned long long fileSize = [[[NSFileManager defaultManager] attributesOfItemAtPath:url.path error:nil] fileSize];
                         
-                        tableMetadata *metadataMOVForUpload = [tableMetadata new];
+                        tableMetadata *metadataMOVForUpload = [[NCManageDatabase sharedInstance] createMetadataWithAccount:appDelegate.activeAccount fileName:fileNameMove ocId:ocId serverUrl:serverUrl url:@"" contentType:@""];
                         
-                        metadataMOVForUpload.account = appDelegate.activeAccount;
-                        metadataMOVForUpload.date = [NSDate new];
-                        metadataMOVForUpload.ocId = ocId;
-                        metadataMOVForUpload.fileName = fileNameMove;
-                        metadataMOVForUpload.fileNameView = fileNameMove;
-                        metadataMOVForUpload.serverUrl = serverUrl;
                         metadataMOVForUpload.session = session;
                         metadataMOVForUpload.sessionSelector = selector;
                         metadataMOVForUpload.size = fileSize;

+ 1 - 1
iOSClient/CCGlobal.h

@@ -195,7 +195,7 @@
 #define selectorDownloadSynchronize                     @"downloadSynchronize"
 #define selectorLoadFileView                            @"loadFileView"
 #define selectorLoadFileViewFavorite                    @"loadFileViewFavorite"
-#define selectorLoadFileInternalView                    @"loadFileInternalView"
+#define selectorLoadFileQuickLook                       @"loadFileQuickLook"
 #define selectorLoadCopy                                @"loadCopy"
 #define selectorLoadOffline                             @"loadOffline"
 #define selectorOpenIn                                  @"openIn"

+ 72 - 3
iOSClient/Database/NCManageDatabase.swift

@@ -144,7 +144,9 @@ class NCManageDatabase: NSObject {
             } catch {
                 if let databaseFilePath = databaseFilePath {
                     do {
+                        #if !EXTENSION
                         NCContentPresenter.shared.messageNotification("_error_", description: "_database_corrupt_", delay: TimeInterval(k_dismissAfterSecondLong), type: NCContentPresenter.messageType.info, errorCode: 0)
+                        #endif
                         try FileManager.default.removeItem(at: databaseFilePath)
                     } catch {}
                 }
@@ -164,7 +166,9 @@ class NCManageDatabase: NSObject {
         } catch {
             if let databaseFilePath = databaseFilePath {
                 do {
+                    #if !EXTENSION
                     NCContentPresenter.shared.messageNotification("_error_", description: "_database_corrupt_", delay: TimeInterval(k_dismissAfterSecondLong), type: NCContentPresenter.messageType.info, errorCode: 0)
+                    #endif
                     try FileManager.default.removeItem(at: databaseFilePath)
                 } catch {}
             }
@@ -544,6 +548,7 @@ class NCManageDatabase: NSObject {
         }
     }
     
+    #if !EXTENSION
     @objc func setAccountUserProfile(_ userProfile: OCUserProfile, HCProperties: Bool) -> tableAccount? {
      
         let realm = try! Realm()
@@ -600,7 +605,9 @@ class NCManageDatabase: NSObject {
         
         return tableAccount.init(value: returnAccount)
     }
+    #endif
     
+    #if !EXTENSION
     @objc func setAccountHCFeatures(_ features: HCFeatures) -> tableAccount? {
         
         let realm = try! Realm()
@@ -652,6 +659,7 @@ class NCManageDatabase: NSObject {
         
         return tableAccount.init(value: returnAccount)
     }
+    #endif
     
     @objc func setAccountDateSearchContentTypeImageVideo(_ date: Date) {
         
@@ -723,6 +731,7 @@ class NCManageDatabase: NSObject {
     //MARK: -
     //MARK: Table Activity
 
+    #if !EXTENSION
     @objc func addActivity(_ listOfActivity: [OCActivity], account: String) {
     
         let realm = try! Realm()
@@ -808,6 +817,7 @@ class NCManageDatabase: NSObject {
             print("[LOG] Could not write to database: ", error)
         }
     }
+    #endif
     
     func getActivity(predicate: NSPredicate, filterFileId: String?) -> (all: [tableActivity], filter: [tableActivity]) {
         
@@ -884,6 +894,7 @@ class NCManageDatabase: NSObject {
     //MARK: -
     //MARK: Table Capabilities
     
+    #if !EXTENSION
     @objc func addCapabilities(_ capabilities: OCCapabilities, account: String) {
         
         let realm = try! Realm()
@@ -969,6 +980,7 @@ class NCManageDatabase: NSObject {
             print("[LOG] Could not write to database: ", error)
         }
     }
+    #endif
     
     @objc func getCapabilites(account: String) -> tableCapabilities? {
         
@@ -1046,6 +1058,7 @@ class NCManageDatabase: NSObject {
     //MARK: -
     //MARK: Table Comments
     
+    #if !EXTENSION
     @objc func addComments(_ listOfComments: [NCComments], account: String, objectId: String) {
         
         let realm = try! Realm()
@@ -1079,6 +1092,7 @@ class NCManageDatabase: NSObject {
             print("[LOG] Could not write to database: ", error)
         }
     }
+    #endif
     
     @objc func getComments(account: String, objectId: String) -> [tableComments] {
         
@@ -1672,6 +1686,7 @@ class NCManageDatabase: NSObject {
     //MARK: -
     //MARK: Table External Sites
     
+    #if !EXTENSION
     @objc func addExternalSites(_ externalSites: OCExternalSites, account: String) {
         
         let realm = try! Realm()
@@ -1695,7 +1710,8 @@ class NCManageDatabase: NSObject {
             print("[LOG] Could not write to database: ", error)
         }
     }
-
+    #endif
+    
     @objc func deleteExternalSites(account: String) {
         
         let realm = try! Realm()
@@ -1938,6 +1954,10 @@ class NCManageDatabase: NSObject {
         if isEncrypted || metadata.e2eEncrypted {
             if let tableE2eEncryption = NCManageDatabase.sharedInstance.getE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameIdentifier == %@", account, file.serverUrl, file.fileName)) {
                 metadata.fileNameView = tableE2eEncryption.fileName
+                let results = NCCommunicationCommon.sharedInstance.getInternalContenType(fileName: metadata.fileNameView, contentType: file.contentType, directory: file.directory)
+                metadata.contentType = results.contentType
+                metadata.iconName = results.iconName
+                metadata.typeFile = results.typeFile
             }
         }
         
@@ -1980,6 +2000,24 @@ class NCManageDatabase: NSObject {
         completion(metadataFolder, metadataFolders, metadatas)
     }
     
+    @objc func createMetadata(account: String, fileName: String, ocId: String, serverUrl: String, url: String, contentType: String) -> tableMetadata {
+        
+        let metadata = tableMetadata()
+        let results = NCCommunicationCommon.sharedInstance.getInternalContenType(fileName: fileName, contentType: contentType, directory: false)
+        
+        metadata.account = account
+        metadata.contentType = results.contentType
+        metadata.date = Date() as NSDate
+        metadata.iconName = results.iconName
+        metadata.ocId = ocId
+        metadata.fileName = fileName
+        metadata.fileNameView = fileName
+        metadata.serverUrl = serverUrl
+        metadata.typeFile = results.typeFile
+        metadata.url = url
+        return metadata
+    }
+    
     @discardableResult
     @objc func addMetadata(_ metadata: tableMetadata) -> tableMetadata? {
             
@@ -2261,7 +2299,34 @@ class NCManageDatabase: NSObject {
         // Update Date Read Directory
         setDateReadDirectory(serverUrl: serverUrl, account: account)
     }
-    
+   
+    @objc func setMetadataEncrypted(ocId: String, encrypted: Bool) {
+           
+        let realm = try! Realm()
+
+        realm.beginWrite()
+
+        guard let result = realm.objects(tableMetadata.self).filter("ocId == %@", ocId).first else {
+            realm.cancelWrite()
+            return
+        }
+           
+        result.e2eEncrypted = encrypted
+
+        let account = result.account
+        let serverUrl = result.serverUrl
+           
+        do {
+            try realm.commitWrite()
+        } catch let error {
+            print("[LOG] Could not write to database: ", error)
+            return
+        }
+           
+        // Update Date Read Directory
+        setDateReadDirectory(serverUrl: serverUrl, account: account)
+    }
+       
     @objc func setMetadataFileNameView(serverUrl: String, fileName: String, newFileNameView: String, account: String) {
         
         let realm = try! Realm()
@@ -2785,6 +2850,7 @@ class NCManageDatabase: NSObject {
     //MARK: -
     //MARK: Table Share
     
+    #if !EXTENSION
     @objc func addShare(account: String, activeUrl: String, items: [OCSharedDto]) -> [tableShare] {
         
         let realm = try! Realm()
@@ -2844,7 +2910,8 @@ class NCManageDatabase: NSObject {
         
         return self.getTableShares(account: account)
     }
-
+    #endif
+    
     @objc func getTableShares(account: String) -> [tableShare] {
         
         let realm = try! Realm()
@@ -2856,6 +2923,7 @@ class NCManageDatabase: NSObject {
         return Array(results.map { tableShare.init(value:$0) })
     }
     
+    #if !EXTENSION
     func getTableShares(metadata: tableMetadata) -> (firstShareLink: tableShare?,  share: [tableShare]?) {
         
         let realm = try! Realm()
@@ -2872,6 +2940,7 @@ class NCManageDatabase: NSObject {
             return(firstShareLink: firstShareLink, share: Array(results.map { tableShare.init(value:$0) }))
         }
     }
+    #endif
     
     func getTableShare(account: String, idRemoteShared: Int) -> tableShare? {
         

+ 3 - 5
iOSClient/Favorites/CCFavorites.m

@@ -350,10 +350,8 @@
         viewController.imageFile = cell.file.image;
         viewController.showOpenIn = true;
         viewController.showShare = false;
-        if ([metadata.typeFile isEqualToString: k_metadataTypeFile_document]) {
-            viewController.showOpenInternalViewer = true;
-        }
-        
+        viewController.showOpenQuickLook = [[NCUtility sharedInstance] isQuickLookDisplayableWithMetadata:metadata];
+       
         return viewController;
     }
     
@@ -409,7 +407,7 @@
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
     
     [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_delete_", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-        [[NCNetworking sharedInstance] deleteMetadata:metadata user:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl completion:^(NSInteger errorCode, NSString *errorDescription) { }];
+        [[NCNetworking sharedInstance] deleteMetadata:metadata account:appDelegate.activeAccount user:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl completion:^(NSInteger errorCode, NSString *errorDescription) { }];
     }]];
     
    

+ 2 - 2
iOSClient/Library/OCCommunicationLib/OCCommunication.m

@@ -2596,9 +2596,9 @@
             
             if (statusCode == kOCUserProfileAPISuccessful) {
                 
-                if ([data valueForKey:@"token"] && ![[data valueForKey:@"token"] isKindOfClass:[NSNull class]]) {
+                if ([data valueForKey:@"e2e-token"] && ![[data valueForKey:@"e2e-token"] isKindOfClass:[NSNull class]]) {
                     
-                    token = [data valueForKey:@"token"];
+                    token = [data valueForKey:@"e2e-token"];
                     successRequest(response, token, request.redirectedServer);
                     
                 } else {

+ 2 - 1
iOSClient/Library/XLForm/XL/Cell/XLFormPickerCell.m

@@ -25,6 +25,7 @@
 
 #import "UIView+XLFormAdditions.h"
 #import "XLFormPickerCell.h"
+#import "NCBridgeSwift.h"
 
 @interface XLFormPickerCell() <UIPickerViewDelegate, UIPickerViewDataSource>
 
@@ -103,7 +104,7 @@
     
     UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, pickerView.frame.size.width, 50)];
     label.backgroundColor = [UIColor clearColor];
-    label.textColor = [UIColor blackColor];
+    label.textColor = NCBrandColor.sharedInstance.textView;
     label.font = [UIFont systemFontOfSize:13];
     label.textAlignment = NSTextAlignmentCenter;
     [label setText:[self.rowDescriptor.selectorOptions objectAtIndex:row]];

+ 0 - 1
iOSClient/Main/CCMain+Swift.swift

@@ -11,7 +11,6 @@ import Foundation
 extension CCMain {
 
     @objc func updateNavBarShadow(_ scrollView: UIScrollView, force: Bool) {
-        print(scrollView.contentOffset.y)
         if (scrollView.contentOffset.y > self.viewRichWorkspace.topView.frame.size.height || self.searchController.isActive || force) {
             if #available(iOS 13.0, *) {
                 let navBarAppearance = UINavigationBarAppearance()

+ 65 - 110
iOSClient/Main/CCMain.m

@@ -34,7 +34,7 @@
 #import "NCNetworkingEndToEnd.h"
 #import "PKDownloadButton.h"
 
-@interface CCMain () <UITextViewDelegate, createFormUploadAssetsDelegate, MGSwipeTableCellDelegate, NCSelectDelegate, UITextFieldDelegate, UIAdaptivePresentationControllerDelegate, NCCreateFormUploadConflictDelegate>
+@interface CCMain () <UITextViewDelegate, createFormUploadAssetsDelegate, MGSwipeTableCellDelegate, NCSelectDelegate, UITextFieldDelegate, UIAdaptivePresentationControllerDelegate>
 {
     AppDelegate *appDelegate;
         
@@ -152,12 +152,10 @@
             
     // Load Rich Workspace
     self.viewRichWorkspace = [[[NSBundle mainBundle] loadNibNamed:@"NCRichWorkspace" owner:self options:nil] firstObject];
-    if (@available(iOS 11, *)) {
-        UITapGestureRecognizer *viewRichWorkspaceTapped = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(viewRichWorkspaceTapAction:)];
-        viewRichWorkspaceTapped.numberOfTapsRequired = 1;
-        viewRichWorkspaceTapped.delegate = self;
-        [self.viewRichWorkspace.richView addGestureRecognizer:viewRichWorkspaceTapped];
-    }
+    UITapGestureRecognizer *viewRichWorkspaceTapped = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(viewRichWorkspaceTapAction:)];
+    viewRichWorkspaceTapped.numberOfTapsRequired = 1;
+    viewRichWorkspaceTapped.delegate = self;
+    [self.viewRichWorkspace.richView addGestureRecognizer:viewRichWorkspaceTapped];
     
     self.sortButton = self.viewRichWorkspace.sortButton;
     heightSearchBar = self.viewRichWorkspace.topView.frame.size.height;
@@ -430,12 +428,10 @@
     [appDelegate pushNotification];
     
     // Registeration domain File Provider
-    if (@available(iOS 11, *) ) {
-        if (k_fileProvider_domain) {
-            [FileProviderDomain.sharedInstance registerDomain];
-        } else {
-            [FileProviderDomain.sharedInstance removeAllDomain];
-        }        
+    if (k_fileProvider_domain) {
+        [FileProviderDomain.sharedInstance registerDomain];
+    } else {
+        [FileProviderDomain.sharedInstance removeAllDomain];
     }
 }
 
@@ -578,7 +574,7 @@
     NSString *errorDescription = userInfo[@"errorDescription"];
     
     if (errorCode == 0) {
-        [self readFolder:self.serverUrl];
+        [self reloadDatasource:self.serverUrl ocId:nil action:k_action_NULL];
     } else {
         [[NCContentPresenter shared] messageNotification:@"_error_" description:errorDescription delay:k_dismissAfterSecond type:messageTypeError errorCode:errorCode];
     }
@@ -709,10 +705,6 @@
             [subview removeFromSuperview];
     }
     
-    if (@available(iOS 10, *)) {
-        self.tableView.refreshControl = nil;
-    }
-    
     refreshControl = nil;
 }
 
@@ -846,32 +838,37 @@
         [coordinator coordinateReadingItemAtURL:url options:NSFileCoordinatorReadingForUploading error:&error byAccessor:^(NSURL *newURL) {
             
             NSString *serverUrl = [appDelegate getTabBarControllerActiveServerUrl];
-            NSString *fileName =  [[NCUtility sharedInstance] createFileName:[url lastPathComponent] serverUrl:serverUrl account:appDelegate.activeAccount];
-            NSString *ocId = [CCUtility createMetadataIDFromAccount:appDelegate.activeAccount serverUrl:serverUrl fileNameView:fileName directory:false];
+            NSString *fileName =  [url lastPathComponent];
+            NSString *ocId = [[NSUUID UUID] UUIDString];
             NSData *data = [NSData dataWithContentsOfURL:newURL];
             
             if (data && error == nil) {
                 
                 if ([data writeToFile:[CCUtility getDirectoryProviderStorageOcId:ocId fileNameView:fileName] options:NSDataWritingAtomic error:&error]) {
                     
-                    tableMetadata *metadataForUpload = [tableMetadata new];
+                    tableMetadata *metadataForUpload = [[NCManageDatabase sharedInstance] createMetadataWithAccount:appDelegate.activeAccount fileName:fileName ocId:ocId serverUrl:serverUrl url:@"" contentType:@""];
                     
-                    metadataForUpload.account = appDelegate.activeAccount;
-                    metadataForUpload.date = [NSDate new];
-                    metadataForUpload.ocId = ocId;
-                    metadataForUpload.fileName = fileName;
-                    metadataForUpload.fileNameView = fileName;
-                    metadataForUpload.serverUrl = serverUrl;
                     metadataForUpload.session = k_upload_session;
                     metadataForUpload.sessionSelector = selectorUploadFile;
                     metadataForUpload.size = data.length;
                     metadataForUpload.status = k_metadataStatusWaitUpload;
                     
-                    [[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
-                    [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL];
+                    if ([[NCUtility sharedInstance] getMetadataConflictWithAccount:appDelegate.activeAccount serverUrl:serverUrl fileName:fileName] != nil) {
+                       
+                        NCCreateFormUploadConflict *conflict = [[UIStoryboard storyboardWithName:@"NCCreateFormUploadConflict" bundle:nil] instantiateInitialViewController];
+                        conflict.serverUrl = self.serverUrl;
+                        conflict.metadatasUploadInConflict = @[metadataForUpload];
                         
-                    [appDelegate startLoadAutoDownloadUpload];
-                    
+                        [self presentViewController:conflict animated:YES completion:nil];
+                        
+                    } else {
+                        
+                        [[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];
+                        [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL];
+                            
+                        [appDelegate startLoadAutoDownloadUpload];
+                    }
+
                 } else {
                                         
                     [[NCContentPresenter shared] messageNotification:@"_error_" description:error.description delay:k_dismissAfterSecond type:messageTypeError errorCode:error.code];
@@ -1046,9 +1043,7 @@
         viewController.imageFile = cell.file.image;
         viewController.showOpenIn = true;
         viewController.showShare = true;
-        if ([metadata.typeFile isEqualToString: k_metadataTypeFile_document]) {
-            viewController.showOpenInternalViewer = true;
-        }
+        viewController.showOpenQuickLook = [[NCUtility sharedInstance] isQuickLookDisplayableWithMetadata:metadata];
         
         return viewController;
     }
@@ -1124,9 +1119,9 @@
 
 - (void)uploadFileAsset:(NSArray *)assets urls:(NSArray *)urls serverUrl:(NSString *)serverUrl autoUploadPath:(NSString *)autoUploadPath useSubFolder:(BOOL)useSubFolder session:(NSString *)session
 {
-    NSMutableArray *metadatas = [NSMutableArray new];
+    NSMutableArray *metadatasNOConflict = [NSMutableArray new];
     NSMutableArray *metadatasMOV = [NSMutableArray new];
-    NSMutableArray *metadatasConflict = [NSMutableArray new];
+    NSMutableArray *metadatasUploadInConflict = [NSMutableArray new];
 
     for (PHAsset *asset in assets) {
         
@@ -1153,52 +1148,31 @@
             continue;
         
         // Prepare record metadata
-        tableMetadata *metadataForUpload = [tableMetadata new];
-
-        metadataForUpload.account = appDelegate.activeAccount;
+        tableMetadata *metadataForUpload = [[NCManageDatabase sharedInstance] createMetadataWithAccount:appDelegate.activeAccount fileName:fileName ocId:[[NSUUID UUID] UUIDString] serverUrl:serverUrl url:@"" contentType:@""];
+        
         metadataForUpload.assetLocalIdentifier = asset.localIdentifier;
-        metadataForUpload.date = [NSDate new];
-        metadataForUpload.ocId = [CCUtility createMetadataIDFromAccount:appDelegate.activeAccount serverUrl:serverUrl fileNameView:fileName directory:false];
-        metadataForUpload.fileName = fileName;
-        metadataForUpload.fileNameView = fileName;
-        metadataForUpload.serverUrl = serverUrl;
         metadataForUpload.session = session;
         metadataForUpload.sessionSelector = selectorUploadFile;
         metadataForUpload.size = [[NCUtility sharedInstance] getFileSizeWithAsset:asset];
         metadataForUpload.status = k_metadataStatusWaitUpload;
-        [CCUtility insertTypeFileIconName:fileName metadata:metadataForUpload];
-        
-        // verify exists conflict
-        NSString *fileNameExtension = [fileName pathExtension].lowercaseString;
-        NSString *fileNameWithoutExtension = [fileName stringByDeletingPathExtension];
-        NSString *fileNameConflict = fileName;
-        
-        if ([fileNameExtension isEqualToString:@"heic"] && [CCUtility getFormatCompatibility]) {
-            fileNameConflict = [fileNameWithoutExtension stringByAppendingString:@".jpg"];
-        }
-        tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileNameView == %@", appDelegate.activeAccount, serverUrl, fileNameConflict]];
-        if (metadata) {
-            [metadatasConflict addObject:metadataForUpload];
+                        
+        if ([[NCUtility sharedInstance] getMetadataConflictWithAccount:appDelegate.activeAccount serverUrl:serverUrl fileName:fileName] != nil) {
+            [metadatasUploadInConflict addObject:metadataForUpload];
         } else {
-            [metadatas addObject:metadataForUpload];
+            [metadatasNOConflict addObject:metadataForUpload];
         }
-                    
+        
         // Add Medtadata MOV LIVE PHOTO for upload
         if ((asset.mediaSubtypes == PHAssetMediaSubtypePhotoLive || asset.mediaSubtypes == PHAssetMediaSubtypePhotoLive+PHAssetMediaSubtypePhotoHDR) && CCUtility.getLivePhoto && urls.count == assets.count) {
                 
             NSUInteger index = [assets indexOfObject:asset];
             NSURL *url = [urls objectAtIndex:index];
-            tableMetadata *metadataMOVForUpload = [tableMetadata new];
             NSString *fileNameNoExt = [fileName stringByDeletingPathExtension];
             NSString *fileName = [NSString stringWithFormat:@"%@.mov", fileNameNoExt];
             unsigned long long fileSize = [[[NSFileManager defaultManager] attributesOfItemAtPath:url.path error:nil] fileSize];
 
-            metadataMOVForUpload.account = appDelegate.activeAccount;
-            metadataMOVForUpload.date = [NSDate new];
-            metadataMOVForUpload.ocId = [CCUtility createMetadataIDFromAccount:appDelegate.activeAccount serverUrl:serverUrl fileNameView:fileName directory:false];
-            metadataMOVForUpload.fileName = fileName;
-            metadataMOVForUpload.fileNameView = fileName;
-            metadataMOVForUpload.serverUrl = serverUrl;
+            tableMetadata *metadataMOVForUpload = [[NCManageDatabase sharedInstance] createMetadataWithAccount:appDelegate.activeAccount fileName:fileName ocId:[[NSUUID UUID] UUIDString] serverUrl:serverUrl url:@"" contentType:@""];
+            
             metadataMOVForUpload.session = session;
             metadataMOVForUpload.sessionSelector = selectorUploadFile;
             metadataMOVForUpload.size = fileSize;
@@ -1212,19 +1186,19 @@
     }
     
     // Verify if file(s) exists
-    if (metadatasConflict.count > 0) {
+    if (metadatasUploadInConflict.count > 0) {
         
         NCCreateFormUploadConflict *conflict = [[UIStoryboard storyboardWithName:@"NCCreateFormUploadConflict" bundle:nil] instantiateInitialViewController];
-        conflict.delegate = self;
-        conflict.metadatas = metadatas;
+        conflict.serverUrl = self.serverUrl;
+        conflict.metadatasNOConflict = metadatasNOConflict;
         conflict.metadatasMOV = metadatasMOV;
-        conflict.metadatasConflict = metadatasConflict;
+        conflict.metadatasUploadInConflict = metadatasUploadInConflict;
         
         [self presentViewController:conflict animated:YES completion:nil];
         
     } else {
         
-        [[NCManageDatabase sharedInstance] addMetadatas:metadatas];
+        [[NCManageDatabase sharedInstance] addMetadatas:metadatasNOConflict];
         [[NCManageDatabase sharedInstance] addMetadatas:metadatasMOV];
         
         [appDelegate startLoadAutoDownloadUpload];
@@ -1232,19 +1206,6 @@
     }
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== NCCreateFormUploadConflictDelegate ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)dismissCreateFormUploadConflictWithMetadatas:(NSArray *)metadatas
-{
-    if (metadatas.count > 0) {
-        [[NCManageDatabase sharedInstance] addMetadatas:metadatas];
-        
-        [appDelegate startLoadAutoDownloadUpload];
-        [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.serverUrl ocId:nil action:k_action_NULL];
-    }
-}
 
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ==== Read Folder ====
@@ -1490,7 +1451,7 @@
         [appDelegate.arrayDeleteMetadata addObject:self.metadata];
     }
     
-    [[NCNetworking sharedInstance] deleteMetadata:appDelegate.arrayDeleteMetadata.firstObject user:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl completion:^(NSInteger errorCode, NSString *errorDescription) { }];
+    [[NCNetworking sharedInstance] deleteMetadata:appDelegate.arrayDeleteMetadata.firstObject account:appDelegate.activeAccount user:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl completion:^(NSInteger errorCode, NSString *errorDescription) { }];
     [appDelegate.arrayDeleteMetadata removeObjectAtIndex:0];
         
     // End Select Table View
@@ -1699,7 +1660,7 @@
     
     tableMetadata *metadata = [[NCMainCommon sharedInstance] getMetadataFromSectionDataSourceIndexPath:indexPath sectionDataSource:sectionDataSource];
     
-    if (metadata) {
+    if (metadata && ![CCUtility isFolderEncrypted:self.serverUrl e2eEncrypted:metadata.e2eEncrypted account:appDelegate.activeAccount]) {
         [[NCMainCommon sharedInstance] openShareWithViewController:self metadata:metadata indexPage:1];
     }
 }
@@ -1711,7 +1672,7 @@
     
     tableMetadata *metadata = [[NCMainCommon sharedInstance] getMetadataFromSectionDataSourceIndexPath:indexPath sectionDataSource:sectionDataSource];
     
-    if (metadata) {
+    if (metadata && ![CCUtility isFolderEncrypted:self.serverUrl e2eEncrypted:metadata.e2eEncrypted account:appDelegate.activeAccount]) {
         [[NCMainCommon sharedInstance] openShareWithViewController:self metadata:metadata indexPage:2];
     }
 }
@@ -1855,9 +1816,7 @@
     CGFloat locationY = [theGestureRecognizer locationInView: self.navigationController.navigationBar].y;
     CGFloat safeAreaTop = 0;
     CGFloat offsetY = 35;
-    if (@available(iOS 11, *)) {
-        safeAreaTop = [UIApplication sharedApplication].delegate.window.safeAreaInsets.top / 2;
-    }
+    safeAreaTop = [UIApplication sharedApplication].delegate.window.safeAreaInsets.top / 2;
     rect.origin.y = locationY + safeAreaTop + offsetY;
     rect.size.height = rect.size.height - locationY - safeAreaTop - offsetY;
     
@@ -1909,9 +1868,7 @@
         
         if ([self indexPathIsValid:indexPath])
             self.metadata = [[NCMainCommon sharedInstance] getMetadataFromSectionDataSourceIndexPath:indexPath sectionDataSource:sectionDataSource];
-        else
-            self.metadata = nil;
-        
+       
         [self becomeFirstResponder];
         
         UIMenuController *menuController = [UIMenuController sharedMenuController];
@@ -1921,8 +1878,8 @@
         if ([NCBrandOptions sharedInstance].disable_openin_file == false) {
             [items addObject:[[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_open_in_", nil) action:@selector(openinTouchFile:)]];
         }
-        if ([self.metadata.typeFile isEqualToString: k_metadataTypeFile_document]) {
-            [items addObject:[[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_open_internal_view_", nil) action:@selector(openInternalViewerTouch:)]];
+        if ([[NCUtility sharedInstance] isQuickLookDisplayableWithMetadata:self.metadata]) {
+            [items addObject:[[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_open_quicklook_", nil) action:@selector(openQuickLookTouch:)]];
         }
         [items addObject:[[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_paste_file_", nil) action:@selector(pasteTouchFile:)]];
         [items addObject:[[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_paste_files_", nil) action:@selector(pasteTouchFiles:)]];
@@ -1947,7 +1904,7 @@
     // NO In Session mode (download/upload)
     // NO Template
     
-    if (@selector(copyTouchFile:) == action || @selector(openinTouchFile:) == action || @selector(openInternalViewerTouch:) == action) {
+    if (@selector(copyTouchFile:) == action || @selector(openinTouchFile:) == action || @selector(openQuickLookTouch:) == action) {
         
         if (_isSelectedMode == NO && self.metadata && !self.metadata.directory && self.metadata.status == k_metadataStatusNormal) return YES;
         else return NO;
@@ -2115,10 +2072,11 @@
     [[NCMainCommon sharedInstance] downloadOpenWithMetadata:self.metadata selector:selectorOpenIn];
 }
 
-/************************************ OPEN INTERNAL VIEWER ... ******************************/
-- (void)openInternalViewerTouch:(id)sender
+/************************************ OPEN QUICK LOOK ******************************/
+
+- (void)openQuickLookTouch:(id)sender
 {
-    [[NCMainCommon sharedInstance] downloadOpenWithMetadata:self.metadata selector:selectorLoadFileInternalView];
+    [[NCMainCommon sharedInstance] downloadOpenWithMetadata:self.metadata selector:selectorLoadFileQuickLook];
 }
 
 /************************************ PASTE ************************************/
@@ -2151,18 +2109,13 @@
             if ([CCUtility fileProviderStorageExists:metadata.ocId fileNameView:metadata.fileNameView]) {
                 
                 NSString *fileName = [[NCUtility sharedInstance] createFileName:metadata.fileNameView serverUrl:self.serverUrl account:appDelegate.activeAccount];
-                NSString *ocId = [CCUtility createMetadataIDFromAccount:appDelegate.activeAccount serverUrl:self.serverUrl fileNameView:fileName directory:false];
+                NSString *ocId = [[NSUUID UUID] UUIDString];
                 
                 [CCUtility copyFileAtPath:[CCUtility getDirectoryProviderStorageOcId:metadata.ocId fileNameView:metadata.fileNameView] toPath:[CCUtility getDirectoryProviderStorageOcId:ocId fileNameView:fileName]];
                     
-                tableMetadata *metadataForUpload = [tableMetadata new];
-                        
-                metadataForUpload.account = appDelegate.activeAccount;
-                metadataForUpload.date = [NSDate new];
-                metadataForUpload.ocId = ocId;
-                metadataForUpload.fileName = fileName;
-                metadataForUpload.fileNameView = fileName;
-                metadataForUpload.serverUrl = self.serverUrl;
+                // Prepare record metadata
+                tableMetadata *metadataForUpload = [[NCManageDatabase sharedInstance] createMetadataWithAccount:appDelegate.activeAccount fileName:fileName ocId:ocId serverUrl:self.serverUrl url:@"" contentType:@""];
+            
                 metadataForUpload.session = k_upload_session;
                 metadataForUpload.sessionSelector = selectorUploadFile;
                 metadataForUpload.size = metadata.size;
@@ -2884,8 +2837,10 @@
 - (void)setTableViewHeader
 {
     tableCapabilities *capabilities = [[NCManageDatabase sharedInstance] getCapabilitesWithAccount:appDelegate.activeAccount];
-  
-    if (capabilities.versionMajor < k_nextcloud_version_18_0 || self.richWorkspaceText.length == 0) {
+
+    NSString *trimmedRichWorkspaceText = [self.richWorkspaceText stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+
+    if (capabilities.versionMajor < k_nextcloud_version_18_0 || trimmedRichWorkspaceText.length == 0 ) {
                 
         [self.tableView.tableHeaderView setFrame:CGRectMake(self.tableView.tableHeaderView.frame.origin.x, self.tableView.tableHeaderView.frame.origin.y, self.tableView.frame.size.width, heightSearchBar)];
         

+ 5 - 7
iOSClient/Main/CCMore.swift

@@ -119,13 +119,11 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
         functionMenu.append(item)
         
         // ITEM : Scan
-        if #available(iOS 11.0, *) {
-            item = OCExternalSites.init()
-            item.name = "_scanned_images_"
-            item.icon = "scan"
-            item.url = "openStoryboardScan"
-            functionMenu.append(item)
-        }
+        item = OCExternalSites.init()
+        item.name = "_scanned_images_"
+        item.icon = "scan"
+        item.url = "openStoryboardScan"
+        functionMenu.append(item)
         
         // ITEM : Trash
         let capabilities = NCManageDatabase.sharedInstance.getCapabilites(account: appDelegate.activeAccount)

+ 10 - 2
iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift

@@ -49,7 +49,11 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
         if serverUrl == CCUtility.getHomeServerUrlActiveUrl(appDelegate.activeUrl) {
             titleServerUrl = "/"
         } else {
-            titleServerUrl = (serverUrl as NSString).lastPathComponent
+            if let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, serverUrl)) {
+                if let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "ocId == %@", tableDirectory.ocId)) {
+                    titleServerUrl = metadata.fileNameView
+                } else { titleServerUrl = (serverUrl as NSString).lastPathComponent }
+            } else { titleServerUrl = (serverUrl as NSString).lastPathComponent }
         }
         
         self.serverUrl = serverUrl
@@ -305,7 +309,11 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
             if serverUrl == CCUtility.getHomeServerUrlActiveUrl(appDelegate.activeUrl) {
                 self.titleServerUrl = "/"
             } else {
-                self.titleServerUrl = (serverUrl! as NSString).lastPathComponent
+                if let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, self.serverUrl)) {
+                    if let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "ocId == %@", tableDirectory.ocId)) {
+                        titleServerUrl = metadata.fileNameView
+                    } else { titleServerUrl = (self.serverUrl as NSString).lastPathComponent }
+                } else { titleServerUrl = (self.serverUrl as NSString).lastPathComponent }                
             }
             
             // Update

+ 159 - 50
iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift

@@ -24,7 +24,11 @@
 import Foundation
 
 @objc protocol NCCreateFormUploadConflictDelegate {
-    @objc func dismissCreateFormUploadConflict(metadatas: [tableMetadata])
+    @objc func dismissCreateFormUploadConflict(metadatas: [tableMetadata]?)
+}
+
+extension NCCreateFormUploadConflictDelegate {
+    func dismissCreateFormUploadConflict(metadatas: [tableMetadata]?) {}
 }
 
 @objc class NCCreateFormUploadConflict: UIViewController {
@@ -45,20 +49,24 @@ import Foundation
     
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
     
-    @objc var metadatas: [tableMetadata]
+    @objc var metadatasNOConflict: [tableMetadata]
+    @objc var metadatasUploadInConflict: [tableMetadata]
     @objc var metadatasMOV: [tableMetadata]
-    @objc var metadatasConflict: [tableMetadata]
+    @objc var serverUrl: String?
     @objc weak var delegate: NCCreateFormUploadConflictDelegate?
+    @objc var alwaysNewFileNameNumber: Bool = false
+    @objc var textLabelDetailNewFile: String?
     
     var metadatasConflictNewFiles = [String]()
     var metadatasConflictAlreadyExistingFiles = [String]()
+    var fileNamesPath = [String:String]()
 
     // MARK: - Cicle
 
     @objc required init?(coder aDecoder: NSCoder) {
-        self.metadatas = [tableMetadata]()
+        self.metadatasNOConflict = [tableMetadata]()
         self.metadatasMOV = [tableMetadata]()
-        self.metadatasConflict = [tableMetadata]()
+        self.metadatasUploadInConflict = [tableMetadata]()
         super.init(coder: aDecoder)
     }
     
@@ -72,13 +80,13 @@ import Foundation
         
         tableView.register(UINib.init(nibName: "NCCreateFormUploadConflictCell", bundle: nil), forCellReuseIdentifier: "Cell")
         
-        if metadatasConflict.count == 1 {
-            labelTitle.text = String(metadatasConflict.count) + " " + NSLocalizedString("_file_conflict_num_", comment: "")
+        if metadatasUploadInConflict.count == 1 {
+            labelTitle.text = String(metadatasUploadInConflict.count) + " " + NSLocalizedString("_file_conflict_num_", comment: "")
             labelSubTitle.text = NSLocalizedString("_file_conflict_desc_", comment: "")
             labelNewFiles.text = NSLocalizedString("_file_conflict_new_", comment: "")
             labelAlreadyExistingFiles.text = NSLocalizedString("_file_conflict_exists_", comment: "")
         } else {
-            labelTitle.text = String(metadatasConflict.count) + " " + NSLocalizedString("_files_conflict_num_", comment: "")
+            labelTitle.text = String(metadatasUploadInConflict.count) + " " + NSLocalizedString("_files_conflict_num_", comment: "")
             labelSubTitle.text = NSLocalizedString("_files_conflict_desc_", comment: "")
             labelNewFiles.text = NSLocalizedString("_files_conflict_new_", comment: "")
             labelAlreadyExistingFiles.text = NSLocalizedString("_files_conflict_exists_", comment: "")
@@ -100,41 +108,62 @@ import Foundation
         buttonContinue.layer.backgroundColor = NCBrandColor.sharedInstance.graySoft.withAlphaComponent(0.5).cgColor
     }
     
+    // MARK: - Action
+
     @IBAction func valueChangedSwitchNewFiles(_ sender: Any) {
         metadatasConflictNewFiles.removeAll()
 
         if switchNewFiles.isOn {
-            for metadata in metadatasConflict {
+            for metadata in metadatasUploadInConflict {
                 metadatasConflictNewFiles.append(metadata.ocId)
             }
         }
         
-        tableView.reloadData()
-        
-        canContinue()
+       verifySwith()
     }
     
     @IBAction func valueChangedSwitchAlreadyExistingFiles(_ sender: Any) {
         metadatasConflictAlreadyExistingFiles.removeAll()
         
         if switchAlreadyExistingFiles.isOn {
-            for metadata in metadatasConflict {
+            for metadata in metadatasUploadInConflict {
                 metadatasConflictAlreadyExistingFiles.append(metadata.ocId)
             }
         }
         
-        tableView.reloadData()
+        verifySwith()
+    }
+    
+    func verifySwith() {
         
+        if alwaysNewFileNameNumber && switchNewFiles.isOn {
+            metadatasConflictNewFiles.removeAll()
+            metadatasConflictAlreadyExistingFiles.removeAll()
+            
+            for metadata in metadatasUploadInConflict {
+                metadatasConflictNewFiles.append(metadata.ocId)
+            }
+            for metadata in metadatasUploadInConflict {
+                metadatasConflictAlreadyExistingFiles.append(metadata.ocId)
+            }
+            
+            switchAlreadyExistingFiles.isOn = true
+            NCContentPresenter.shared.messageNotification("_info_", description: "_file_not_rewite_doc_", delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.info, errorCode: 0)
+        }
+        
+        tableView.reloadData()
         canContinue()
     }
-    
+        
     @IBAction func buttonCancelTouch(_ sender: Any) {
+        
+        delegate?.dismissCreateFormUploadConflict(metadatas: nil)
         dismiss(animated: true)
     }
     
     @IBAction func buttonContinueTouch(_ sender: Any) {
         
-        for metadata in metadatasConflict {
+        for metadata in metadatasUploadInConflict {
             
             // new filename + num
             if metadatasConflictNewFiles.contains(metadata.ocId) && metadatasConflictAlreadyExistingFiles.contains(metadata.ocId) {
@@ -142,12 +171,11 @@ import Foundation
                 let fileNameMOV = (metadata.fileNameView as NSString).deletingPathExtension + ".mov"
                 
                 let newFileName = NCUtility.sharedInstance.createFileName(metadata.fileNameView, serverUrl: metadata.serverUrl, account: metadata.account)
-                let ocId = CCUtility.createMetadataID(fromAccount: metadata.account, serverUrl: metadata.serverUrl, fileNameView: newFileName, directory: false)!
-                metadata.ocId = ocId
+                metadata.ocId = UUID().uuidString
                 metadata.fileName = newFileName
                 metadata.fileNameView = newFileName
                 
-                metadatas.append(metadata)
+                metadatasNOConflict.append(metadata)
                 
                 // MOV
                 for metadataMOV in metadatasMOV {
@@ -156,12 +184,11 @@ import Foundation
                         let oldPath = CCUtility.getDirectoryProviderStorageOcId(metadataMOV.ocId, fileNameView: metadataMOV.fileNameView)
                         let newFileNameMOV = (newFileName as NSString).deletingPathExtension + ".mov"
                         
-                        let ocId = CCUtility.createMetadataID(fromAccount: metadataMOV.account, serverUrl: metadataMOV.serverUrl, fileNameView: newFileNameMOV, directory: false)!
-                        metadataMOV.ocId = ocId
+                        metadataMOV.ocId = UUID().uuidString
                         metadataMOV.fileName = newFileNameMOV
                         metadataMOV.fileNameView = newFileNameMOV
                         
-                        let newPath = CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: newFileNameMOV)
+                        let newPath = CCUtility.getDirectoryProviderStorageOcId(metadataMOV.ocId, fileNameView: newFileNameMOV)
                         CCUtility.moveFile(atPath: oldPath, toPath: newPath)
                         
                         break
@@ -171,7 +198,7 @@ import Foundation
             // overwrite
             } else if metadatasConflictNewFiles.contains(metadata.ocId) {
                 
-                metadatas.append(metadata)
+                metadatasNOConflict.append(metadata)
             
             // remove (MOV)
             } else if metadatasConflictAlreadyExistingFiles.contains(metadata.ocId) {
@@ -192,10 +219,19 @@ import Foundation
             }
         }
         
-        metadatas.append(contentsOf: metadatasMOV)
-        
-        delegate?.dismissCreateFormUploadConflict(metadatas: metadatas)
+        metadatasNOConflict.append(contentsOf: metadatasMOV)
         
+        if delegate != nil {
+            
+            delegate?.dismissCreateFormUploadConflict(metadatas: metadatasNOConflict)
+            
+        } else {
+            
+            NCManageDatabase.sharedInstance.addMetadatas(metadatasNOConflict)
+            appDelegate.startLoadAutoDownloadUpload()
+            NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: serverUrl, ocId: nil, action: Int32(k_action_NULL))
+        }
+                
         dismiss(animated: true)
     }
 }
@@ -205,7 +241,11 @@ import Foundation
 extension NCCreateFormUploadConflict: UITableViewDelegate {
     
     func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
-        return 330
+        if metadatasUploadInConflict.count == 1 {
+            return 250
+        } else {
+            return 280
+        }
     }
 }
 
@@ -218,21 +258,14 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
     }
     
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return metadatasConflict.count
+        return metadatasUploadInConflict.count
     }
     
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         
         if let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as? NCCreateFormUploadConflictCell {
             
-            let metadataNewFile = metadatasConflict[indexPath.row]
-            let fileNameExtension = (metadataNewFile.fileNameView as NSString).pathExtension.lowercased()
-            let fileNameWithoutExtension = (metadataNewFile.fileNameView as NSString).deletingPathExtension
-            var fileNameConflict = metadataNewFile.fileNameView
-
-            if fileNameExtension == "heic" && CCUtility.getFormatCompatibility() {
-                fileNameConflict = fileNameWithoutExtension + ".jpg"
-            }
+            let metadataNewFile = metadatasUploadInConflict[indexPath.row]
 
             cell.ocId = metadataNewFile.ocId
             cell.delegate = self
@@ -242,9 +275,18 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
 
             // -----> Already Existing File
             
-            guard let metadataAlreadyExists = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView == %@", metadataNewFile.account, metadataNewFile.serverUrl, fileNameConflict)) else { return UITableViewCell() }
+            guard let metadataAlreadyExists = NCUtility.sharedInstance.getMetadataConflict(account: metadataNewFile.account, serverUrl: metadataNewFile.serverUrl, fileName: metadataNewFile.fileNameView) else { return UITableViewCell() }
             if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView)) {
                 cell.imageAlreadyExistingFile.image =  UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView))
+            } else if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView)) && metadataAlreadyExists.contentType == "application/pdf" {
+            
+                let url = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView))
+                if let image = NCUtility.sharedInstance.pdfThumbnail(url: url) {
+                    cell.imageAlreadyExistingFile.image = image
+                } else {
+                    cell.imageAlreadyExistingFile.image = UIImage.init(named: metadataAlreadyExists.iconName)
+                }
+            
             } else {
                 if metadataAlreadyExists.iconName.count > 0 {
                     cell.imageAlreadyExistingFile.image = UIImage.init(named: metadataAlreadyExists.iconName)
@@ -260,7 +302,6 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
                 cell.switchAlreadyExistingFile.isOn = false
             }
             
-            
             // -----> New File
             
             if metadataNewFile.iconName.count > 0 {
@@ -268,19 +309,82 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
             } else {
                 cell.imageNewFile.image = UIImage.init(named: "file")
             }
+            let filePathNewFile = CCUtility.getDirectoryProviderStorageOcId(metadataNewFile.ocId, fileNameView: metadataNewFile.fileNameView)!
             if metadataNewFile.assetLocalIdentifier.count > 0 {
+                
                 let result = PHAsset.fetchAssets(withLocalIdentifiers: [metadataNewFile.assetLocalIdentifier], options: nil)
-                if result.count == 1 {
-                    PHImageManager.default().requestImage(for: result.firstObject!, targetSize: CGSize(width: 200, height: 200), contentMode: PHImageContentMode.aspectFill, options: nil) { (image, info) in
-                        cell.imageNewFile.image = image
+                let date = result.firstObject!.modificationDate
+                let mediaType = result.firstObject!.mediaType
+                
+                if let fileNamePath = self.fileNamesPath[metadataNewFile.fileNameView] {
+                    
+                    do {
+                        if mediaType == PHAssetMediaType.image {
+                            let data = try Data(contentsOf: URL(fileURLWithPath: fileNamePath))
+                            if let image = UIImage(data: data) {
+                                cell.imageNewFile.image = image
+                            }
+                        } else if mediaType == PHAssetMediaType.video {
+                            if let image = CCGraphics.thumbnailImage(forVideo: URL(fileURLWithPath: fileNamePath), atTime: 1) {
+                                cell.imageNewFile.image = image
+                            }
+                        }
+                        
+                        let fileDictionary = try FileManager.default.attributesOfItem(atPath: fileNamePath)
+                        let fileSize = fileDictionary[FileAttributeKey.size] as! Double
+                        
+                        cell.labelDetailNewFile.text = CCUtility.dateDiff(date) + "\n" + CCUtility.transformedSize(fileSize)
+                        
+                    } catch { print("Error: \(error)") }
+                    
+                } else {
+                    
+                    CCUtility.extractImageVideoFromAssetLocalIdentifier(forUpload: metadataNewFile, notification: false) { (metadataNew, fileNamePath) in
+                        
+                        if metadataNew != nil {
+                            self.fileNamesPath[metadataNewFile.fileNameView] = fileNamePath!
+                            do {
+                                if mediaType == PHAssetMediaType.image {
+                                    let data = try Data(contentsOf: URL(fileURLWithPath: fileNamePath!))
+                                    if let image = UIImage(data: data) {
+                                        cell.imageNewFile.image = image
+                                    }
+                                } else if mediaType == PHAssetMediaType.video {
+                                    if let image = CCGraphics.thumbnailImage(forVideo: URL(fileURLWithPath: fileNamePath!), atTime: 1) {
+                                        cell.imageNewFile.image = image
+                                    }
+                                }
+                                
+                                let fileDictionary = try FileManager.default.attributesOfItem(atPath: fileNamePath!)
+                                let fileSize = fileDictionary[FileAttributeKey.size] as! Double
+                                
+                                cell.labelDetailNewFile.text = CCUtility.dateDiff(date) + "\n" + CCUtility.transformedSize(fileSize)
+                                
+                            } catch { print("Error: \(error)") }
+                        }
+                    }
+                }
+                      
+            } else if FileManager().fileExists(atPath: filePathNewFile) {
+                
+                do {
+                    if metadataNewFile.typeFile == k_metadataTypeFile_image {
+                        let data = try Data(contentsOf: URL(fileURLWithPath: filePathNewFile))
+                        if let image = UIImage(data: data) {
+                            cell.imageNewFile.image = image
+                        }
                     }
                     
-                    let resource = PHAssetResource.assetResources(for: result.firstObject!)
-                    let size = resource.first?.value(forKey: "fileSize") as! Double
-                    let date = result.firstObject!.modificationDate
+                    let fileDictionary = try FileManager.default.attributesOfItem(atPath: filePathNewFile)
+                    let fileSize = fileDictionary[FileAttributeKey.size] as! Double
+                    
+                    cell.labelDetailNewFile.text = CCUtility.dateDiff(metadataNewFile.date as Date) + "\n" + CCUtility.transformedSize(fileSize)
                     
-                    cell.labelDetailNewFile.text = CCUtility.dateDiff(date) + "\n" + CCUtility.transformedSize(size)
-                }                
+                } catch { print("Error: \(error)") }
+                
+            } else {
+                
+                CCUtility.dateDiff(metadataNewFile.date as Date)
             }
             
             if metadatasConflictNewFiles.contains(metadataNewFile.ocId) {
@@ -290,11 +394,16 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
             }
         
             // Hide switch if only one
-            if metadatasConflict.count == 1 {
+            if metadatasUploadInConflict.count == 1 {
                 cell.switchAlreadyExistingFile.isHidden = true
                 cell.switchNewFile.isHidden = true
             }
             
+            // text label new file
+            if textLabelDetailNewFile != nil {
+                cell.labelDetailNewFile.text = textLabelDetailNewFile! + "\n"
+            }
+            
             return cell
         }
         
@@ -313,7 +422,7 @@ extension NCCreateFormUploadConflict: NCCreateFormUploadConflictCellDelegate {
         if isOn {
             metadatasConflictNewFiles.append(ocId)
         }
-        if metadatasConflictNewFiles.count == metadatasConflict.count {
+        if metadatasConflictNewFiles.count == metadatasUploadInConflict.count {
             switchNewFiles.isOn = true
         } else {
             switchNewFiles.isOn = false
@@ -329,7 +438,7 @@ extension NCCreateFormUploadConflict: NCCreateFormUploadConflictCellDelegate {
         if isOn {
             metadatasConflictAlreadyExistingFiles.append(ocId)
         }
-        if metadatasConflictAlreadyExistingFiles.count == metadatasConflict.count {
+        if metadatasConflictAlreadyExistingFiles.count == metadatasUploadInConflict.count {
             switchAlreadyExistingFiles.isOn = true
         } else {
             switchAlreadyExistingFiles.isOn = false
@@ -341,7 +450,7 @@ extension NCCreateFormUploadConflict: NCCreateFormUploadConflictCellDelegate {
     func canContinue() {
         var result = true
         
-        for metadata in metadatasConflict {
+        for metadata in metadatasUploadInConflict {
             if !metadatasConflictNewFiles.contains(metadata.ocId) && !metadatasConflictAlreadyExistingFiles.contains(metadata.ocId) {
                 result = false
             }

+ 8 - 8
iOSClient/Main/Create cloud/NCCreateFormUploadConflictCell.xib

@@ -17,10 +17,10 @@
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="WSQ-HI-Wkg">
-                        <rect key="frame" x="5" y="34.5" width="200" height="200"/>
+                        <rect key="frame" x="5" y="34.5" width="150" height="150"/>
                         <constraints>
-                            <constraint firstAttribute="width" constant="200" id="cfG-23-jOI"/>
-                            <constraint firstAttribute="height" constant="200" id="hzO-CU-dTl"/>
+                            <constraint firstAttribute="width" constant="150" id="cfG-23-jOI"/>
+                            <constraint firstAttribute="height" constant="150" id="hzO-CU-dTl"/>
                         </constraints>
                     </imageView>
                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hv8-qJ-lkR">
@@ -30,7 +30,7 @@
                         <nil key="highlightedColor"/>
                     </label>
                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0hq-re-YVn">
-                        <rect key="frame" x="598.5" y="244.5" width="37.5" height="40"/>
+                        <rect key="frame" x="598.5" y="194.5" width="37.5" height="40"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="40" id="5Ed-pm-3oc"/>
                         </constraints>
@@ -51,14 +51,14 @@
                         </connections>
                     </switch>
                     <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Tx2-JG-GGa">
-                        <rect key="frame" x="436" y="34.5" width="200" height="200"/>
+                        <rect key="frame" x="486" y="34.5" width="150" height="150"/>
                         <constraints>
-                            <constraint firstAttribute="height" constant="200" id="EvS-Tl-Lkx"/>
-                            <constraint firstAttribute="width" constant="200" id="brj-dv-3FM"/>
+                            <constraint firstAttribute="height" constant="150" id="EvS-Tl-Lkx"/>
+                            <constraint firstAttribute="width" constant="150" id="brj-dv-3FM"/>
                         </constraints>
                     </imageView>
                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Qye-6B-5aj">
-                        <rect key="frame" x="5" y="244.5" width="37.5" height="40"/>
+                        <rect key="frame" x="5" y="194.5" width="37.5" height="40"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="40" id="j5h-pt-EoN"/>
                         </constraints>

+ 51 - 11
iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift

@@ -26,11 +26,12 @@ import NCCommunication
 
 // MARK: -
 
-class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
+@objc class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, NCCreateFormUploadConflictDelegate {
     
     var editorId = ""
     var creatorId = ""
     var typeTemplate = ""
+    var templateIdentifier = ""
     var serverUrl = ""
     var fileNameFolder = ""
     var fileName = ""
@@ -255,20 +256,59 @@ class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICol
         guard let selectTemplate = self.selectTemplate else {
             return
         }
+        templateIdentifier = selectTemplate.identifier
+
         let rowFileName : XLFormRowDescriptor  = self.form.formRow(withTag: "fileName")!
         guard var fileNameForm = rowFileName.value else {
             return
         }
+        
         if fileNameForm as! String == "" {
             return
         } else {
             
-            fileName = (fileNameForm as! NSString).deletingPathExtension + "." + fileNameExtension
-            fileName = NCUtility.sharedInstance.createFileName(fileName, serverUrl: serverUrl, account: appDelegate.activeAccount)
-            fileNameForm = fileName
-            fileName = CCUtility.returnFileNamePath(fromFileName: fileName, serverUrl: serverUrl, activeUrl: appDelegate.activeUrl)
+            fileNameForm = (fileNameForm as! NSString).deletingPathExtension + "." + fileNameExtension
+            
+            if NCUtility.sharedInstance.getMetadataConflict(account: appDelegate.activeAccount, serverUrl: serverUrl, fileName: String(describing: fileNameForm)) != nil {
+                
+                let metadataForUpload = NCManageDatabase.sharedInstance.createMetadata(account: appDelegate.activeAccount, fileName: String(describing: fileNameForm), ocId: "", serverUrl: serverUrl, url: "", contentType: "")
+                
+                guard let conflictViewController = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return }
+                conflictViewController.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "")
+                conflictViewController.alwaysNewFileNameNumber = true
+                conflictViewController.serverUrl = serverUrl
+                conflictViewController.metadatasUploadInConflict = [metadataForUpload]
+                conflictViewController.delegate = self
+                
+                self.present(conflictViewController, animated: true, completion: nil)
+                
+            } else {
+                                
+                let fileNamePath = CCUtility.returnFileNamePath(fromFileName: String(describing: fileNameForm), serverUrl: serverUrl, activeUrl: appDelegate.activeUrl)!
+                createDocument(fileNamePath: fileNamePath, fileName: String(describing: fileNameForm))
+            }
         }
+    }
+    
+    func dismissCreateFormUploadConflict(metadatas: [tableMetadata]?) {
+        
+        if metadatas == nil || metadatas?.count == 0 {
             
+            DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
+                self.cancel()
+            }
+            
+        } else {
+            
+            let fileName = metadatas![0].fileName
+            let fileNamePath = CCUtility.returnFileNamePath(fromFileName: fileName, serverUrl: serverUrl, activeUrl: appDelegate.activeUrl)!
+            
+            createDocument(fileNamePath: fileNamePath, fileName: fileName)
+        }
+    }
+    
+    func createDocument(fileNamePath: String, fileName: String) {
+        
         if self.editorId == k_editor_text || self.editorId == k_editor_onlyoffice {
              
             var customUserAgent: String?
@@ -277,7 +317,7 @@ class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICol
                 customUserAgent = NCUtility.sharedInstance.getCustomUserAgentOnlyOffice()
             }
             
-            NCCommunication.sharedInstance.NCTextCreateFile(serverUrl: appDelegate.activeUrl, fileNamePath: fileName, editorId: editorId, creatorId: creatorId, templateId: selectTemplate.identifier, customUserAgent: customUserAgent, addCustomHeaders: nil, account: self.appDelegate.activeAccount) { (account, url, errorCode, errorMessage) in
+            NCCommunication.sharedInstance.NCTextCreateFile(serverUrl: appDelegate.activeUrl, fileNamePath: fileNamePath, editorId: editorId, creatorId: creatorId, templateId: templateIdentifier, customUserAgent: customUserAgent, addCustomHeaders: nil, account: self.appDelegate.activeAccount) { (account, url, errorCode, errorMessage) in
                 
                 if errorCode == 0 && account == self.appDelegate.activeAccount {
                     
@@ -293,8 +333,7 @@ class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICol
                         }
                         
                         self.dismiss(animated: true, completion: {
-                            let metadata = CCUtility.createMetadata(withAccount: self.appDelegate.activeAccount, date: Date(), directory: false, ocId: CCUtility.createRandomString(12), serverUrl: self.serverUrl, fileName: (fileNameForm as! NSString).deletingPathExtension + "." + self.fileNameExtension, etag: "", size: 0, status: Double(k_metadataStatusNormal), url:url, contentType: contentType)
-                            
+                            let metadata = NCManageDatabase.sharedInstance.createMetadata(account: self.appDelegate.activeAccount, fileName: (fileName as NSString).deletingPathExtension + "." + self.fileNameExtension, ocId: CCUtility.createRandomString(12), serverUrl: self.serverUrl, url: url ?? "", contentType: contentType)
                             self.appDelegate.activeMain.readFileReloadFolder()
                             self.appDelegate.activeMain.shouldPerformSegue(metadata, selector: "")
                         })
@@ -311,15 +350,16 @@ class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICol
         
         if self.editorId == k_editor_collabora {
             
-            OCNetworking.sharedManager().createNewRichdocuments(withAccount: appDelegate.activeAccount, fileName: fileName, serverUrl: serverUrl, templateID: selectTemplate.identifier, completion: { (account, url, message, errorCode) in
+            OCNetworking.sharedManager().createNewRichdocuments(withAccount: appDelegate.activeAccount, fileName: fileNamePath, serverUrl: serverUrl, templateID: templateIdentifier, completion: { (account, url, message, errorCode) in
                        
                 if errorCode == 0 && account == self.appDelegate.activeAccount {
                    
                    if url != nil && url!.count > 0 {
                        
                        self.dismiss(animated: true, completion: {
-                           let metadata = CCUtility.createMetadata(withAccount: self.appDelegate.activeAccount, date: Date(), directory: false, ocId: CCUtility.createRandomString(12), serverUrl: self.serverUrl, fileName: (fileNameForm as! NSString).deletingPathExtension + "." + self.fileNameExtension, etag: "", size: 0, status: Double(k_metadataStatusNormal), url:url, contentType: "")
-                           
+                        
+                        let metadata = NCManageDatabase.sharedInstance.createMetadata(account: self.appDelegate.activeAccount, fileName: (fileName as NSString).deletingPathExtension + "." + self.fileNameExtension, ocId: CCUtility.createRandomString(12), serverUrl: self.serverUrl, url: url!, contentType: "")
+                        
                            self.appDelegate.activeMain.shouldPerformSegue(metadata, selector: "")
                        })
                    }

+ 0 - 268
iOSClient/Main/Create cloud/NCCreateFormUploadFileText.swift

@@ -1,268 +0,0 @@
-//
-//  NCCreateFormUploadFileText.swift
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 14/11/2018.
-//  Copyright © 2018 Marino Faggiana. All rights reserved.
-//
-//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-import Foundation
-
-class NCCreateFormUploadFileText: XLFormViewController, NCSelectDelegate {
-    
-    var serverUrl = ""
-    var titleServerUrl = ""
-    var fileName = ""
-    var text = ""
-    
-    let appDelegate = UIApplication.shared.delegate as! AppDelegate
-    
-    convenience init(serverUrl: String, text: String, fileName: String) {
-        
-        self.init()
-        
-        if serverUrl == CCUtility.getHomeServerUrlActiveUrl(appDelegate.activeUrl) {
-            titleServerUrl = "/"
-        } else {
-            titleServerUrl = (serverUrl as NSString).lastPathComponent
-        }
-        
-        self.fileName = fileName
-        self.serverUrl = serverUrl
-        self.text = text
-    }
-    
-    // MARK: - View Life Cycle
-    
-    override func viewDidLoad() {
-        
-        super.viewDidLoad()
-        
-        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
-        self.navigationItem.rightBarButtonItem = saveButton
-        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
-        
-        // Theming view
-        NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)
-        changeTheming()
-    }
-    
-    @objc func changeTheming() {
-           appDelegate.changeTheming(self, tableView: tableView, collectionView: nil, form: true)
-           initializeForm()
-    }
-    
-    //MARK: XLForm
-    
-    func initializeForm() {
-        
-        let form : XLFormDescriptor = XLFormDescriptor(title: NSLocalizedString("_text_upload_title_", comment: "")) as XLFormDescriptor
-        form.rowNavigationOptions = XLFormRowNavigationOptions.stopDisableRow
-        
-        var section : XLFormSectionDescriptor
-        var row : XLFormRowDescriptor
-        
-        // Section: Destination Folder
-        
-        section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("_save_path_", comment: ""))
-        form.addFormSection(section)
-        
-        row = XLFormRowDescriptor(tag: "ButtonDestinationFolder", rowType: XLFormRowDescriptorTypeButton, title: self.titleServerUrl)
-        row.action.formSelector = #selector(changeDestinationFolder(_:))
-        row.cellConfig["backgroundColor"] = NCBrandColor.sharedInstance.backgroundForm
-
-        row.cellConfig["imageView.image"] = CCGraphics.changeThemingColorImage(UIImage(named: "folder")!, width: 50, height: 50, color: NCBrandColor.sharedInstance.brandElement) as UIImage
-        
-        row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue
-        row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
-        row.cellConfig["textLabel.textColor"] = NCBrandColor.sharedInstance.textView
-
-        section.addFormRow(row)
-        
-        // Section: File Name
-        
-        section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("_filename_", comment: ""))
-        form.addFormSection(section)
-        
-        row = XLFormRowDescriptor(tag: "fileName", rowType: XLFormRowDescriptorTypeAccount, title: NSLocalizedString("_filename_", comment: ""))
-        row.value = self.fileName
-        row.cellConfig["backgroundColor"] = NCBrandColor.sharedInstance.backgroundForm
-
-        row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
-        row.cellConfig["textLabel.textColor"] = NCBrandColor.sharedInstance.textView
-
-        row.cellConfig["textField.textAlignment"] = NSTextAlignment.right.rawValue
-        row.cellConfig["textField.font"] = UIFont.systemFont(ofSize: 15.0)
-        row.cellConfig["textField.textColor"] = NCBrandColor.sharedInstance.textView
-
-        section.addFormRow(row)
-        
-        self.form = form
-    }
-    
-    override func formRowDescriptorValueHasChanged(_ formRow: XLFormRowDescriptor!, oldValue: Any!, newValue: Any!) {
-        
-        super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
-        
-        if formRow.tag == "fileName" {
-            
-            self.form.delegate = nil
-            
-            if let fileNameNew = formRow.value {
-                self.fileName = CCUtility.removeForbiddenCharactersServer(fileNameNew as? String)
-            }
-            
-            formRow.value = self.fileName
-            self.title = fileName
-            
-            self.updateFormRow(formRow)
-            
-            self.form.delegate = self
-        }
-    }
-    
-    override func textFieldDidBeginEditing(_ textField: UITextField) {
-        
-        let cell = textField.formDescriptorCell()
-        let tag = cell?.rowDescriptor.tag
-        
-        if tag == "fileName" {
-            CCUtility.selectFileName(from: textField)
-        }
-    }
-    
-    // MARK: - Action
-    
-    func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, buttonType: String, overwrite: Bool) {
-        
-        if serverUrl != nil {
-            
-            self.serverUrl = serverUrl!
-            
-            if serverUrl == CCUtility.getHomeServerUrlActiveUrl(appDelegate.activeUrl) {
-                self.titleServerUrl = "/"
-            } else {
-                self.titleServerUrl = (serverUrl! as NSString).lastPathComponent
-            }
-            
-            // Update
-            let row : XLFormRowDescriptor  = self.form.formRow(withTag: "ButtonDestinationFolder")!
-            row.title = self.titleServerUrl
-            self.updateFormRow(row)
-        }
-    }
-    
-    @objc func save() {
-        
-        let rowFileName : XLFormRowDescriptor  = self.form.formRow(withTag: "fileName")!
-        guard let name = rowFileName.value else {
-            return
-        }
-        let ext = (name as! NSString).pathExtension.uppercased()
-        var fileNameSave = ""
-        
-        if (ext == "") {
-            fileNameSave = name as! String + ".txt"
-        } else if (CCUtility.isDocumentModifiableExtension(ext)) {
-            fileNameSave = name as! String
-        } else {
-            fileNameSave = (name as! NSString).deletingPathExtension + ".txt"
-        }
-        
-        let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView == %@", appDelegate.activeAccount, self.serverUrl, fileNameSave))
-        if (metadata != nil) {
-            
-            let alertController = UIAlertController(title: fileNameSave, message: NSLocalizedString("_file_already_exists_", comment: ""), preferredStyle: .alert)
-            
-            let cancelAction = UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .default) { (action:UIAlertAction) in
-            }
-            
-            let overwriteAction = UIAlertAction(title: NSLocalizedString("_overwrite_", comment: ""), style: .cancel) { (action:UIAlertAction) in
-                self.dismissAndUpload(fileNameSave, ocId: metadata!.ocId, serverUrl: self.serverUrl)
-            }
-            
-            alertController.addAction(cancelAction)
-            alertController.addAction(overwriteAction)
-            
-            self.present(alertController, animated: true, completion:nil)
-            
-        } else {
-            let ocId = CCUtility.createMetadataID(fromAccount: appDelegate.activeAccount, serverUrl: self.serverUrl, fileNameView: fileNameSave, directory: false)!
-            dismissAndUpload(fileNameSave, ocId: ocId, serverUrl: serverUrl)
-        }
-    }
-    
-    func dismissAndUpload(_ fileNameSave: String, ocId: String, serverUrl: String) {
-        
-        self.dismiss(animated: true, completion: {
-            
-            let data = self.text.data(using: .utf8)
-            let success = FileManager.default.createFile(atPath: CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: fileNameSave), contents: data, attributes: nil)
-            
-            if success {
-                
-                let metadataForUpload = tableMetadata()
-                
-                metadataForUpload.account = self.appDelegate.activeAccount
-                metadataForUpload.date = NSDate()
-                metadataForUpload.ocId = ocId
-                metadataForUpload.fileName = fileNameSave
-                metadataForUpload.fileNameView = fileNameSave
-                metadataForUpload.serverUrl = serverUrl
-                metadataForUpload.session = k_upload_session
-                metadataForUpload.sessionSelector = selectorUploadFile
-                metadataForUpload.status = Int(k_metadataStatusWaitUpload)
-                
-                NCManageDatabase.sharedInstance.addMetadata(metadataForUpload)
-                NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, ocId: nil, action: Int32(k_action_NULL))
-
-                self.appDelegate.startLoadAutoDownloadUpload()                
-            
-            } else {
-                
-                NCContentPresenter.shared.messageNotification("_error_", description: "_error_creation_file_", delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.info, errorCode: 0)
-            }
-        })
-    }
-    
-    func cancel() {
-        
-        self.dismiss(animated: true, completion: nil)
-    }
-    
-    @objc func changeDestinationFolder(_ sender: XLFormRowDescriptor) {
-        
-        self.deselectFormRow(sender)
-        
-        let storyboard = UIStoryboard(name: "NCSelect", bundle: nil)
-        let navigationController = storyboard.instantiateInitialViewController() as! UINavigationController
-        let viewController = navigationController.topViewController as! NCSelect
-        
-        viewController.delegate = self
-        viewController.hideButtonCreateFolder = false
-        viewController.includeDirectoryE2EEncryption = true
-        viewController.includeImages = false
-        viewController.layoutViewSelect = k_layout_view_move
-        viewController.selectFile = false
-        viewController.titleButtonDone = NSLocalizedString("_select_", comment: "")
-        viewController.type = ""
-        
-        navigationController.modalPresentationStyle = UIModalPresentationStyle.fullScreen
-        self.present(navigationController, animated: true, completion: nil)
-    }
-}

+ 33 - 37
iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift

@@ -24,12 +24,13 @@
 
 import Foundation
 import WeScan
+import NCCommunication
 
 #if GOOGLEMOBILEVISION
 import GoogleMobileVision
 #endif
 
-class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate {
+class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NCCreateFormUploadConflictDelegate {
     
     enum typeDpiQuality {
         case low
@@ -406,32 +407,42 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate {
             fileNameSave = (name as! NSString).deletingPathExtension + "." + fileType.lowercased()
         }
         
-        let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView == %@", appDelegate.activeAccount, self.serverUrl, fileNameSave))
-        if (metadata != nil) {
-            
-            let alertController = UIAlertController(title: fileNameSave, message: NSLocalizedString("_file_already_exists_", comment: ""), preferredStyle: .alert)
-            
-            let cancelAction = UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .default) { (action:UIAlertAction) in
-            }
-            
-            let overwriteAction = UIAlertAction(title: NSLocalizedString("_overwrite_", comment: ""), style: .cancel) { (action:UIAlertAction) in
-                NCManageDatabase.sharedInstance.deleteMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView == %@", self.appDelegate.activeAccount, self.serverUrl, fileNameSave))
-                self.dismissAndUpload(fileNameSave, ocId: CCUtility.createMetadataID(fromAccount: self.appDelegate.activeAccount, serverUrl: self.serverUrl, fileNameView: fileNameSave, directory: false)!, serverUrl: self.serverUrl)
-            }
-            
-            alertController.addAction(cancelAction)
-            alertController.addAction(overwriteAction)
+        //Create metadata for upload
+        let metadataForUpload = NCManageDatabase.sharedInstance.createMetadata(account: appDelegate.activeAccount, fileName: fileNameSave, ocId: UUID().uuidString, serverUrl: serverUrl, url: appDelegate.activeUrl, contentType: "")
+        
+        metadataForUpload.session = k_upload_session
+        metadataForUpload.sessionSelector = selectorUploadFile
+        metadataForUpload.status = Int(k_metadataStatusWaitUpload)
+                
+        if NCUtility.sharedInstance.getMetadataConflict(account: appDelegate.activeAccount, serverUrl: serverUrl, fileName: fileNameSave) != nil {
+                        
+            guard let conflictViewController = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return }
+            conflictViewController.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "")
+            conflictViewController.serverUrl = serverUrl
+            conflictViewController.metadatasUploadInConflict = [metadataForUpload]
+            conflictViewController.delegate = self
             
-            self.present(alertController, animated: true, completion:nil)
+            self.present(conflictViewController, animated: true, completion: nil)
             
         } else {
-            dismissAndUpload(fileNameSave, ocId: CCUtility.createMetadataID(fromAccount: appDelegate.activeAccount, serverUrl: serverUrl, fileNameView: fileNameSave, directory: false)!, serverUrl: serverUrl)
+                            
+            dismissAndUpload(metadataForUpload)
         }
     }
     
-    func dismissAndUpload(_ fileNameSave: String, ocId: String, serverUrl: String) {
+    func dismissCreateFormUploadConflict(metadatas: [tableMetadata]?) {
         
-        guard let fileNameGenerateExport = CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: fileNameSave) else {
+        if metadatas != nil && metadatas!.count > 0 {
+                                
+            DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
+                self.dismissAndUpload(metadatas![0])
+            }
+        }
+    }
+    
+    func dismissAndUpload(_ metadata: tableMetadata) {
+        
+        guard let fileNameGenerateExport = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView) else {
             NCContentPresenter.shared.messageNotification("_error_", description: "_error_creation_file_", delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.info, errorCode: 0)
             return
         }
@@ -549,21 +560,8 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate {
             }
         }
         
-        //Create metadata for upload
-        let metadataForUpload = tableMetadata()
-        
-        metadataForUpload.account = self.appDelegate.activeAccount
-        metadataForUpload.date = NSDate()
-        metadataForUpload.ocId = ocId
-        metadataForUpload.fileName = fileNameSave
-        metadataForUpload.fileNameView = fileNameSave
-        metadataForUpload.serverUrl = serverUrl
-        metadataForUpload.session = k_upload_session
-        metadataForUpload.sessionSelector = selectorUploadFile
-        metadataForUpload.status = Int(k_metadataStatusWaitUpload)
-        
-        NCManageDatabase.sharedInstance.addMetadata(metadataForUpload)
-        NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, ocId: nil, action: Int32(k_action_NULL))
+        NCManageDatabase.sharedInstance.addMetadata(metadata)
+        NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: serverUrl, ocId: nil, action: Int32(k_action_NULL))
 
         self.appDelegate.startLoadAutoDownloadUpload()
                         
@@ -645,8 +643,6 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate {
     }
 }
 
-@available(iOS 11, *)
-
 class NCCreateScanDocument : NSObject, ImageScannerControllerDelegate {
     
     @objc static let sharedInstance: NCCreateScanDocument = {

+ 52 - 33
iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift

@@ -23,7 +23,7 @@
 
 import Foundation
 
-class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAudioPlayerDelegate {
+class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAudioPlayerDelegate, NCCreateFormUploadConflictDelegate {
     
     @IBOutlet weak var buttonPlayStop: UIButton!
     @IBOutlet weak var labelTimer: UILabel!
@@ -215,42 +215,61 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
     
     @objc func save() {
         
-        self.dismiss(animated: true, completion: {
+        let rowFileName : XLFormRowDescriptor  = self.form.formRow(withTag: "fileName")!
+        guard let name = rowFileName.value else {
+            return
+        }
+        let ext = (name as! NSString).pathExtension.uppercased()
+        var fileNameSave = ""
+                   
+        if (ext == "") {
+            fileNameSave = name as! String + ".m4a"
+        } else {
+            fileNameSave = (name as! NSString).deletingPathExtension + ".m4a"
+        }
         
-            let rowFileName : XLFormRowDescriptor  = self.form.formRow(withTag: "fileName")!
-            guard let name = rowFileName.value else {
-                return
-            }
-            let ext = (name as! NSString).pathExtension.uppercased()
-            var fileNameSave = ""
-            
-            if (ext == "") {
-                fileNameSave = name as! String + ".m4a"
-            } else if (CCUtility.isDocumentModifiableExtension(ext)) {
-                fileNameSave = name as! String
-            } else {
-                fileNameSave = (name as! NSString).deletingPathExtension + ".m4a"
-            }
-            
-            let metadataForUpload = tableMetadata()
-            
-            metadataForUpload.account = self.appDelegate.activeAccount
-            metadataForUpload.date = NSDate()
-            metadataForUpload.ocId = CCUtility.createMetadataID(fromAccount: self.appDelegate.activeAccount, serverUrl: self.serverUrl, fileNameView: fileNameSave, directory: false)
-            metadataForUpload.fileName = fileNameSave
-            metadataForUpload.fileNameView = fileNameSave
-            metadataForUpload.serverUrl = self.serverUrl
-            metadataForUpload.session = k_upload_session
-            metadataForUpload.sessionSelector = selectorUploadFile
-            metadataForUpload.status = Int(k_metadataStatusWaitUpload)
+        let metadataForUpload = NCManageDatabase.sharedInstance.createMetadata(account: self.appDelegate.activeAccount, fileName: fileNameSave, ocId: UUID().uuidString, serverUrl: self.serverUrl, url: "", contentType: "")
+        
+        metadataForUpload.session = k_upload_session
+        metadataForUpload.sessionSelector = selectorUploadFile
+        metadataForUpload.status = Int(k_metadataStatusWaitUpload)
+        
+        if NCUtility.sharedInstance.getMetadataConflict(account: appDelegate.activeAccount, serverUrl: serverUrl, fileName: fileNameSave) != nil {
+                        
+            guard let conflictViewController = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return }
+            conflictViewController.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "")
+            conflictViewController.serverUrl = serverUrl
+            conflictViewController.metadatasUploadInConflict = [metadataForUpload]
+            conflictViewController.delegate = self
             
-            CCUtility.copyFile(atPath: self.fileNamePath, toPath: CCUtility.getDirectoryProviderStorageOcId(metadataForUpload.ocId, fileNameView: fileNameSave))
+            self.present(conflictViewController, animated: true, completion: nil)
             
-            NCManageDatabase.sharedInstance.addMetadata(metadataForUpload)
-            NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, ocId: nil, action: Int32(k_action_NULL))
+        } else {
+                            
+            dismissAndUpload(metadataForUpload)
+        }
+    }
+    
+    func dismissCreateFormUploadConflict(metadatas: [tableMetadata]?) {
+        
+        if metadatas != nil && metadatas!.count > 0 {
+                                
+            DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
+                self.dismissAndUpload(metadatas![0])
+            }
+        }
+    }
+    
+    func dismissAndUpload(_ metadata: tableMetadata) {
+        
+        CCUtility.copyFile(atPath: self.fileNamePath, toPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))
+                   
+        NCManageDatabase.sharedInstance.addMetadata(metadata)
+        NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, ocId: nil, action: Int32(k_action_NULL))
 
-            self.appDelegate.startLoadAutoDownloadUpload()
-        })
+        self.appDelegate.startLoadAutoDownloadUpload()
+        
+        self.dismiss(animated: true, completion: nil)
     }
     
     @objc func cancel() {

+ 41 - 52
iOSClient/Main/Menu/AppDelegate+Menu.swift

@@ -27,11 +27,25 @@ import FloatingPanel
 
 extension AppDelegate {
 
+    @objc public func showMenuIn(viewController: UIViewController) {
+        let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
+        mainMenuViewController.actions = self.initMenu()
+
+        let menuPanelController = NCMenuPanelController()
+        menuPanelController.parentPresenter = viewController
+        menuPanelController.delegate = mainMenuViewController
+        menuPanelController.set(contentViewController: mainMenuViewController)
+        menuPanelController.track(scrollView: mainMenuViewController.tableView)
+
+        viewController.present(menuPanelController, animated: true, completion: nil)
+    }
+    
     private func initMenu() -> [NCMenuAction] {
         var actions = [NCMenuAction]()
         let appDelegate = UIApplication.shared.delegate as! AppDelegate
         let directEditingCreators = NCManageDatabase.sharedInstance.getDirectEditingCreators(account: appDelegate.activeAccount)
-
+        let isEncrypted = CCUtility.isFolderEncrypted(appDelegate.activeMain.serverUrl, e2eEncrypted: false, account: appDelegate.activeAccount)
+        
         actions.append(
             NCMenuAction(
                 title: NSLocalizedString("_upload_photos_videos_", comment: ""),
@@ -64,7 +78,7 @@ extension AppDelegate {
         )
 #endif
         
-        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_text}) {
+        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_text}) && !isEncrypted {
             let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_text})!
             actions.append(
                 NCMenuAction(title: NSLocalizedString("_create_nextcloudtext_document_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage(named: "file_txt"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
@@ -83,29 +97,18 @@ extension AppDelegate {
                     appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil)
                 })
             )
-        } else {
-            actions.append(
-                NCMenuAction(title: NSLocalizedString("_upload_file_text_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage(named: "file_txt"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
-                    let storyboard = UIStoryboard(name: "NCText", bundle: nil)
-                    let controller = storyboard.instantiateViewController(withIdentifier: "NCText")
-                    controller.modalPresentationStyle = UIModalPresentationStyle.pageSheet
-                    appDelegate.activeMain.present(controller, animated: true, completion: nil)
-                })
-            )
-        }
+        } 
         
         #if !targetEnvironment(simulator)
-            if #available(iOS 11.0, *) {
-                actions.append(
-                    NCMenuAction(
-                        title: NSLocalizedString("_scans_document_", comment: ""),
-                        icon: CCGraphics.changeThemingColorImage(UIImage(named: "scan"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                        action: { menuAction in
-                            NCCreateScanDocument.sharedInstance.openScannerDocument(viewController: appDelegate.activeMain)
-                        }
-                    )
-                )
-            }
+        actions.append(
+            NCMenuAction(
+                title: NSLocalizedString("_scans_document_", comment: ""),
+                icon: CCGraphics.changeThemingColorImage(UIImage(named: "scan"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
+                action: { menuAction in
+                    NCCreateScanDocument.sharedInstance.openScannerDocument(viewController: appDelegate.activeMain)
+                }
+            )
+        )
         #endif
 
         actions.append(
@@ -127,23 +130,22 @@ extension AppDelegate {
             )
         )
 
-        if #available(iOS 11.0, *) {
-            if let capabilities = NCManageDatabase.sharedInstance.getCapabilites(account: appDelegate.activeAccount) {
-                if (capabilities.versionMajor >= k_nextcloud_version_18_0 && (self.activeMain.richWorkspaceText == nil || self.activeMain.richWorkspaceText.count == 0)) {
-                    actions.append(
-                        NCMenuAction(
-                            title: NSLocalizedString("_add_folder_info_", comment: ""),
-                            icon: CCGraphics.changeThemingColorImage(UIImage(named: "addFolderInfo"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                            action: { menuAction in
-                                self.activeMain.createRichWorkspace()
-                            }
-                        )
+        
+        if let capabilities = NCManageDatabase.sharedInstance.getCapabilites(account: appDelegate.activeAccount) {
+            if (capabilities.versionMajor >= k_nextcloud_version_18_0 && (self.activeMain.richWorkspaceText == nil || self.activeMain.richWorkspaceText.count == 0)) && !isEncrypted {
+                actions.append(
+                    NCMenuAction(
+                        title: NSLocalizedString("_add_folder_info_", comment: ""),
+                        icon: CCGraphics.changeThemingColorImage(UIImage(named: "addFolderInfo"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
+                        action: { menuAction in
+                            self.activeMain.createRichWorkspace()
+                        }
                     )
-                }
+                )
             }
         }
         
-        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_docx}) {
+        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_docx}) && !isEncrypted {
             let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_docx})!
             actions.append(
                 NCMenuAction(
@@ -168,7 +170,7 @@ extension AppDelegate {
             )
         }
         
-        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_xlsx}) {
+        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_xlsx}) && !isEncrypted {
             let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_xlsx})!
             actions.append(
                 NCMenuAction(
@@ -193,7 +195,7 @@ extension AppDelegate {
             )
         }
         
-        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_pptx}) {
+        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_pptx}) && !isEncrypted {
             let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_pptx})!
             actions.append(
                 NCMenuAction(
@@ -219,7 +221,7 @@ extension AppDelegate {
         }
         
         if let richdocumentsMimetypes = NCManageDatabase.sharedInstance.getRichdocumentsMimetypes(account: appDelegate.activeAccount) {
-            if richdocumentsMimetypes.count > 0 && appDelegate.reachability.isReachable() {
+            if richdocumentsMimetypes.count > 0 && appDelegate.reachability.isReachable() && !isEncrypted {
                 actions.append(
                     NCMenuAction(
                         title: NSLocalizedString("_create_new_document_", comment: ""),
@@ -287,17 +289,4 @@ extension AppDelegate {
 
         return actions
     }
-
-    @objc public func showMenuIn(viewController: UIViewController) {
-        let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
-        mainMenuViewController.actions = self.initMenu()
-
-        let menuPanelController = NCMenuPanelController()
-        menuPanelController.parentPresenter = viewController
-        menuPanelController.delegate = mainMenuViewController
-        menuPanelController.set(contentViewController: mainMenuViewController)
-        menuPanelController.track(scrollView: mainMenuViewController.tableView)
-
-        viewController.present(menuPanelController, animated: true, completion: nil)
-    }
 }

+ 17 - 13
iOSClient/Main/Menu/CCFavorites+Menu.swift

@@ -27,6 +27,23 @@ import FloatingPanel
 
 extension CCFavorites {
 
+    @objc func toggleMoreMenu(viewController: UIViewController, indexPath: IndexPath, metadata: tableMetadata) {
+        
+        if let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) {
+            
+            let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
+            mainMenuViewController.actions = self.initMoreMenu(indexPath: indexPath, metadata: metadata)
+
+            let menuPanelController = NCMenuPanelController()
+            menuPanelController.parentPresenter = viewController
+            menuPanelController.delegate = mainMenuViewController
+            menuPanelController.set(contentViewController: mainMenuViewController)
+            menuPanelController.track(scrollView: mainMenuViewController.tableView)
+
+            viewController.present(menuPanelController, animated: true, completion: nil)
+        }
+    }
+    
     private func initMoreMenu(indexPath: IndexPath, metadata: tableMetadata) -> [NCMenuAction] {
         var actions = [NCMenuAction]()
         let appDelegate = UIApplication.shared.delegate as! AppDelegate
@@ -97,18 +114,5 @@ extension CCFavorites {
 
         return actions
     }
-
-    @objc func toggleMoreMenu(viewController: UIViewController, indexPath: IndexPath, metadata: tableMetadata) {
-        let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
-        mainMenuViewController.actions = self.initMoreMenu(indexPath: indexPath, metadata: metadata)
-
-        let menuPanelController = NCMenuPanelController()
-        menuPanelController.parentPresenter = viewController
-        menuPanelController.delegate = mainMenuViewController
-        menuPanelController.set(contentViewController: mainMenuViewController)
-        menuPanelController.track(scrollView: mainMenuViewController.tableView)
-
-        viewController.present(menuPanelController, animated: true, completion: nil)
-    }
 }
 

+ 53 - 37
iOSClient/Main/Menu/CCMain+Menu.swift

@@ -27,6 +27,21 @@ import FloatingPanel
 
 extension CCMain {
 
+    // MARK: - Sort Menu
+    
+    @objc func toggleMenu(viewController: UIViewController) {
+        let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
+        mainMenuViewController.actions = self.initSortMenu()
+
+        let menuPanelController = NCMenuPanelController()
+        menuPanelController.parentPresenter = viewController
+        menuPanelController.delegate = mainMenuViewController
+        menuPanelController.set(contentViewController: mainMenuViewController)
+        menuPanelController.track(scrollView: mainMenuViewController.tableView)
+
+        viewController.present(menuPanelController, animated: true, completion: nil)
+    }
+
     private func initSortMenu() -> [NCMenuAction] {
         var actions = [NCMenuAction]()
 
@@ -106,20 +121,10 @@ extension CCMain {
         return actions
     }
 
-    @objc func toggleMenu(viewController: UIViewController) {
-        let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
-        mainMenuViewController.actions = self.initSortMenu()
-
-        let menuPanelController = NCMenuPanelController()
-        menuPanelController.parentPresenter = viewController
-        menuPanelController.delegate = mainMenuViewController
-        menuPanelController.set(contentViewController: mainMenuViewController)
-        menuPanelController.track(scrollView: mainMenuViewController.tableView)
-
-        viewController.present(menuPanelController, animated: true, completion: nil)
-    }
-
+    // MARK: - Select Menu
+    
     @objc func toggleSelectMenu(viewController: UIViewController) {
+           
         let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
         mainMenuViewController.actions = self.initSelectMenu()
 
@@ -131,8 +136,7 @@ extension CCMain {
 
         viewController.present(menuPanelController, animated: true, completion: nil)
     }
-
-
+    
     private func initSelectMenu() -> [NCMenuAction] {
         var actions = [NCMenuAction]()
 
@@ -189,6 +193,25 @@ extension CCMain {
         return actions
     }
 
+    // MARK: - More Menu ...
+
+    @objc func toggleMoreMenu(viewController: UIViewController, indexPath: IndexPath, metadata: tableMetadata, metadataFolder: tableMetadata) {
+           
+        if let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) {
+            
+            let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
+            mainMenuViewController.actions = self.initMoreMenu(indexPath: indexPath, metadata: metadata, metadataFolder: metadataFolder)
+
+            let menuPanelController = NCMenuPanelController()
+            menuPanelController.parentPresenter = viewController
+            menuPanelController.delegate = mainMenuViewController
+            menuPanelController.set(contentViewController: mainMenuViewController)
+            menuPanelController.track(scrollView: mainMenuViewController.tableView)
+
+            viewController.present(menuPanelController, animated: true, completion: nil)
+        }
+    }
+    
     private func initMoreMenu(indexPath: IndexPath, metadata: tableMetadata, metadataFolder: tableMetadata) -> [NCMenuAction] {
         let appDelegate = UIApplication.shared.delegate as! AppDelegate
         let autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
@@ -318,13 +341,16 @@ extension CCMain {
                         icon: CCGraphics.changeThemingColorImage(UIImage(named: "lock"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                         action: { menuAction in
                             DispatchQueue.global(qos: .userInitiated).async {
-                                let error = NCNetworkingEndToEnd.sharedManager()?.markFolderEncrypted(onServerUrl: "\(self.serverUrl ?? "")/\(metadata.fileName)", fileId: metadata.fileId, user: appDelegate.activeUser, userID: appDelegate.activeUserID, password: appDelegate.activePassword, url: appDelegate.activeUrl)
+                                let serverUrl = self.serverUrl + "/" + metadata.fileName
+                                let error = NCNetworkingEndToEnd.sharedManager()?.markFolderEncrypted(onServerUrl: serverUrl, fileId: metadata.fileId, user: appDelegate.activeUser, userID: appDelegate.activeUserID, password: appDelegate.activePassword, url: appDelegate.activeUrl)
                                 DispatchQueue.main.async {
                                     if (error != nil) {
                                         NCContentPresenter.shared.messageNotification(NSLocalizedString("_e2e_error_mark_folder_", comment: ""), description: error?.localizedDescription, delay: TimeInterval(k_dismissAfterSecond), type: .error, errorCode: (error! as NSError).code)
                                     } else {
-                                        NCManageDatabase.sharedInstance.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, "\(self.serverUrl ?? "")/\(metadata.fileName)"))
-                                        self.readFolder(self.serverUrl)
+                                        NCManageDatabase.sharedInstance.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, serverUrl))
+                                        NCManageDatabase.sharedInstance.setDirectory(serverUrl: serverUrl, serverUrlTo: nil, etag: nil, ocId: nil, fileId: nil, encrypted: true, richWorkspace: nil, account: metadata.account)
+                                        NCManageDatabase.sharedInstance.setMetadataEncrypted(ocId: metadata.ocId, encrypted: true)
+                                        NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, ocId: metadata.ocId, action: k_action_MOD)
                                     }
                                 }
                             }
@@ -340,13 +366,16 @@ extension CCMain {
                         icon: CCGraphics.changeThemingColorImage(UIImage(named: "lock"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                         action: { menuAction in
                             DispatchQueue.global(qos: .userInitiated).async {
-                                let error = NCNetworkingEndToEnd.sharedManager()?.deletemarkEndToEndFolderEncrypted(onServerUrl: "\(self.serverUrl ?? "")/\(metadata.fileName)", fileId: metadata.fileId, user: appDelegate.activeUser, userID: appDelegate.activeUserID, password: appDelegate.activePassword, url: appDelegate.activeUrl)
+                                let serverUrl = self.serverUrl + "/" + metadata.fileName
+                                let error = NCNetworkingEndToEnd.sharedManager()?.deletemarkEndToEndFolderEncrypted(onServerUrl: serverUrl, fileId: metadata.fileId, user: appDelegate.activeUser, userID: appDelegate.activeUserID, password: appDelegate.activePassword, url: appDelegate.activeUrl)
                                 DispatchQueue.main.async {
                                     if (error != nil) {
                                         NCContentPresenter.shared.messageNotification(NSLocalizedString("_e2e_error_delete_mark_folder_", comment: ""), description: error?.localizedDescription, delay: TimeInterval(k_dismissAfterSecond), type: .error, errorCode: (error! as NSError).code)
                                     } else {
                                         NCManageDatabase.sharedInstance.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, "\(self.serverUrl ?? "")/\(metadata.fileName)"))
-                                        self.readFolder(self.serverUrl)
+                                        NCManageDatabase.sharedInstance.setDirectory(serverUrl: serverUrl, serverUrlTo: nil, etag: nil, ocId: nil, fileId: nil, encrypted: false, richWorkspace: nil, account: metadata.account)
+                                        NCManageDatabase.sharedInstance.setMetadataEncrypted(ocId: metadata.ocId, encrypted: false)
+                                        NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, ocId: metadata.ocId, action: k_action_MOD)
                                     }
                                 }
                             }
@@ -363,6 +392,7 @@ extension CCMain {
             } else {
                 iconHeader = UIImage(named: metadata.iconName)
             }
+            let isEncrypted = CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account)
 
             actions.append(
                 NCMenuAction(
@@ -382,7 +412,7 @@ extension CCMain {
                 )
             )
 
-            if (!metadataFolder.e2eEncrypted) {
+            if (!isEncrypted) {
                 actions.append(
                     NCMenuAction(
                         title: NSLocalizedString("_details_", comment: ""),
@@ -435,7 +465,7 @@ extension CCMain {
                 )
             )
             
-            if (!metadataFolder.e2eEncrypted) {
+            if (!isEncrypted) {
                 actions.append(
                     NCMenuAction(
                         title: NSLocalizedString("_move_or_copy_", comment: ""),
@@ -447,7 +477,7 @@ extension CCMain {
                 )
             }
 
-            if (!metadataFolder.e2eEncrypted) {
+            if (!isEncrypted) {
                 let localFile = NCManageDatabase.sharedInstance.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
                 var title: String!
                 if (localFile == nil || localFile!.offline == false) {
@@ -503,18 +533,4 @@ extension CCMain {
 
         return actions
     }
-
-    @objc func toggleMoreMenu(viewController: UIViewController, indexPath: IndexPath, metadata: tableMetadata, metadataFolder: tableMetadata) {
-        let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
-        mainMenuViewController.actions = self.initMoreMenu(indexPath: indexPath, metadata: metadata, metadataFolder: metadataFolder)
-
-        let menuPanelController = NCMenuPanelController()
-        menuPanelController.parentPresenter = viewController
-        menuPanelController.delegate = mainMenuViewController
-        menuPanelController.set(contentViewController: mainMenuViewController)
-        menuPanelController.track(scrollView: mainMenuViewController.tableView)
-
-        viewController.present(menuPanelController, animated: true, completion: nil)
-    }
-
 }

+ 39 - 56
iOSClient/Main/Menu/NCDetailNavigationController+Menu.swift

@@ -26,10 +26,28 @@ import NCCommunication
 
 extension NCDetailNavigationController {
 
+    @objc func toggleMoreMenu(viewController: UIViewController, metadata: tableMetadata) {
+        if appDelegate.activeDetail.backgroundView.subviews.first == nil && appDelegate.activeDetail.viewerImageViewController == nil {
+            return
+        }
+        
+        if let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) {
+        
+            let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
+            mainMenuViewController.actions = self.initMoreMenu(viewController: viewController, metadata: metadata)
+
+            let menuPanelController = NCMenuPanelController()
+            menuPanelController.parentPresenter = viewController
+            menuPanelController.delegate = mainMenuViewController
+            menuPanelController.set(contentViewController: mainMenuViewController)
+            menuPanelController.track(scrollView: mainMenuViewController.tableView)
+
+            viewController.present(menuPanelController, animated: true, completion: nil)
+        }
+    }
+    
     private func initMoreMenu(viewController: UIViewController, metadata: tableMetadata) -> [NCMenuAction] {
         var actions = [NCMenuAction]()
-        let fileNameExtension = (metadata.fileNameView as NSString).pathExtension.uppercased()
-        let directEditingCreators = NCManageDatabase.sharedInstance.getDirectEditingCreators(account: appDelegate.activeAccount)
         var titleFavorite = NSLocalizedString("_add_favorites_", comment: "")
         if metadata.favorite { titleFavorite = NSLocalizedString("_remove_favorites_", comment: "") }
         let localFile = NCManageDatabase.sharedInstance.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
@@ -60,15 +78,17 @@ extension NCDetailNavigationController {
             )
         )
         
-        actions.append(
-            NCMenuAction(title: NSLocalizedString("_open_in_", comment: ""),
-                icon: CCGraphics.changeThemingColorImage(UIImage(named: "openFile"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                action: { menuAction in
-                    NCMainCommon.sharedInstance.downloadOpen(metadata: metadata, selector: selectorOpenInDetail)
-                }
+        if metadata.session == "" {
+            actions.append(
+                NCMenuAction(title: NSLocalizedString("_open_in_", comment: ""),
+                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "openFile"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
+                    action: { menuAction in
+                        NCMainCommon.sharedInstance.downloadOpen(metadata: metadata, selector: selectorOpenInDetail)
+                    }
+                )
             )
-        )
-
+        }
+        
         actions.append(
             NCMenuAction(
                 title: NSLocalizedString("_rename_", comment: ""),
@@ -151,7 +171,7 @@ extension NCDetailNavigationController {
                     
                     alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_delete_", comment: ""), style: .default) { (action:UIAlertAction) in
                         
-                        NCNetworking.sharedInstance.deleteMetadata(metadata, user: self.appDelegate.activeUser, userID: self.appDelegate.activeUserID, password: self.appDelegate.activePassword, url: self.appDelegate.activeUrl) { (errorCode, errorDescription) in }
+                        NCNetworking.sharedInstance.deleteMetadata(metadata, account: self.appDelegate.activeAccount, user: self.appDelegate.activeUser, userID: self.appDelegate.activeUserID, password: self.appDelegate.activePassword, url: self.appDelegate.activeUrl) { (errorCode, errorDescription) in }
                     })
                     
                     alertController.addAction(UIAlertAction(title: NSLocalizedString("_no_delete_", comment: ""), style: .default) { (action:UIAlertAction) in })
@@ -163,17 +183,15 @@ extension NCDetailNavigationController {
         
         // PDF
         
-        if #available(iOS 11.0, *) {
-            if (metadata.typeFile == k_metadataTypeFile_document && metadata.contentType == "application/pdf" ) {
-                actions.append(
-                    NCMenuAction(title: NSLocalizedString("_search_", comment: ""),
-                        icon: CCGraphics.changeThemingColorImage(UIImage(named: "search"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                        action: { menuAction in
-                             NotificationCenter.default.post(name: Notification.Name.init(rawValue:k_notificationCenter_menuSearchTextPDF), object: nil)
-                        }
-                    )
+        if (metadata.typeFile == k_metadataTypeFile_document && metadata.contentType == "application/pdf" ) {
+            actions.append(
+                NCMenuAction(title: NSLocalizedString("_search_", comment: ""),
+                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "search"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
+                    action: { menuAction in
+                        NotificationCenter.default.post(name: Notification.Name.init(rawValue:k_notificationCenter_menuSearchTextPDF), object: nil)
+                    }
                 )
-            }
+            )
         }
         
         // IMAGE - VIDEO - AUDIO
@@ -204,24 +222,6 @@ extension NCDetailNavigationController {
             }
         }
                 
-        if CCUtility.isDocumentModifiableExtension(fileNameExtension) && (directEditingCreators == nil || !appDelegate.reachability.isReachable()) {
-            actions.append(
-                NCMenuAction(title: NSLocalizedString("_internal_modify_", comment: ""),
-                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "edit"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                    action: { menuAction in
-                        if let navigationController = UIStoryboard(name: "NCText", bundle: nil).instantiateViewController(withIdentifier: "NCText") as? UINavigationController {
-                            navigationController.modalPresentationStyle = .pageSheet
-                            navigationController.modalTransitionStyle = .crossDissolve
-                            if let textViewController = navigationController.topViewController as? NCText {
-                                textViewController.metadata = metadata;
-                                viewController.present(navigationController, animated: true, completion: nil)
-                            }
-                        }
-                    }
-                )
-            )
-        }
-        
         // CLOSE
         
         actions.append(
@@ -235,22 +235,5 @@ extension NCDetailNavigationController {
         
         return actions
     }
-
-    @objc func toggleMoreMenu(viewController: UIViewController, metadata: tableMetadata) {
-        if appDelegate.activeDetail.backgroundView.subviews.first == nil && appDelegate.activeDetail.viewerImageViewController == nil {
-            return
-        }
-        
-        let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
-        mainMenuViewController.actions = self.initMoreMenu(viewController: viewController, metadata: metadata)
-
-        let menuPanelController = NCMenuPanelController()
-        menuPanelController.parentPresenter = viewController
-        menuPanelController.delegate = mainMenuViewController
-        menuPanelController.set(contentViewController: mainMenuViewController)
-        menuPanelController.track(scrollView: mainMenuViewController.tableView)
-
-        viewController.present(menuPanelController, animated: true, completion: nil)
-    }
 }
 

+ 1 - 5
iOSClient/Main/Menu/NCMainMenuTableViewController.swift

@@ -81,11 +81,7 @@ class NCMainMenuTableViewController: UITableViewController {
 extension NCMainMenuTableViewController: FloatingPanelControllerDelegate {
 
     func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout? {
-        if #available(iOS 11.0, *) {
-            return NCMainMenuFloatingPanelLayout(height: self.actions.count * 60 + Int((UIApplication.shared.keyWindow?.rootViewController!.view.safeAreaInsets.bottom)!))
-        } else {
-            return NCMainMenuFloatingPanelLayout(height: self.actions.count * 60)
-        }
+        return NCMainMenuFloatingPanelLayout(height: self.actions.count * 60 + Int((UIApplication.shared.keyWindow?.rootViewController!.view.safeAreaInsets.bottom)!))
     }
 
     func floatingPanel(_ vc: FloatingPanelController, behaviorFor newCollection: UITraitCollection) -> FloatingPanelBehavior? {

+ 1 - 6
iOSClient/Main/Menu/NCMenuPanelController.swift

@@ -36,11 +36,6 @@ class NCMenuPanelController: FloatingPanelController {
             self.surfaceView.backgroundColor = .systemBackground
         }
         self.isRemovalInteractionEnabled = true
-        if #available(iOS 11, *) {
-            self.surfaceView.cornerRadius = 16
-        } else {
-            self.surfaceView.cornerRadius = 0
-        }
+        self.surfaceView.cornerRadius = 16
     }
-
 }

+ 51 - 40
iOSClient/Main/NCDetailViewController.swift

@@ -42,9 +42,12 @@ class NCDetailViewController: UIViewController {
     @objc var metadatas = [tableMetadata]()
     
     private let progressHeight: CGFloat = 1.5
+    private var maxProgress: Float = 0
     private var videoLayer: AVPlayerLayer?
     private var viewerImageViewControllerLongPressInProgress = false
-        
+    
+    private var viewerQuickLook: NCViewerQuickLook?
+
     //MARK: -
 
     required init?(coder: NSCoder) {
@@ -115,7 +118,7 @@ class NCDetailViewController: UIViewController {
         guard let navigationController = splitViewController?.viewControllers.last as? UINavigationController else { return }
                         
         appDelegate.progressViewDetail.frame = CGRect(x: 0, y: navigationController.navigationBar.frame.height - (progressHeight*2), width: navigationController.navigationBar.frame.width, height: progressHeight)
-        appDelegate.progressViewDetail.setProgress(0, animated: false)
+        progress(0)
         
         if NCBrandColor.sharedInstance.brand.isLight() {
             appDelegate.progressViewDetail.tintColor = NCBrandColor.sharedInstance.brand.darker(by: 10)
@@ -131,7 +134,13 @@ class NCDetailViewController: UIViewController {
     
     @objc func progress(_ progress: Float) {
         DispatchQueue.main.async {
-            self.appDelegate.progressViewDetail.progress = progress
+            if progress == 0 {
+                self.maxProgress = 0
+                self.appDelegate.progressViewDetail.progress = 0
+            } else if progress > self.maxProgress {
+                self.appDelegate.progressViewDetail.progress = progress
+                self.maxProgress = progress
+            }
         }
     }
     
@@ -403,7 +412,11 @@ class NCDetailViewController: UIViewController {
     }
     
     @objc func viewUnload() {
-        if self.view?.window == nil { return }
+        self.unload(checkWindow: true)
+    }
+    
+    private func unload(checkWindow: Bool) {
+        if checkWindow && self.view?.window == nil { return }
 
         metadata = nil
         selector = nil
@@ -458,44 +471,27 @@ class NCDetailViewController: UIViewController {
         if metadata.typeFile == k_metadataTypeFile_image || metadata.typeFile == k_metadataTypeFile_audio || metadata.typeFile == k_metadataTypeFile_video {
             
             viewImage()
-            return
-        }
-        
-        // DOCUMENT - INTERNAL VIEWER
-        if metadata.typeFile == k_metadataTypeFile_document && selector != nil && selector == selectorLoadFileInternalView {
-            
-            let frame = CGRect(x: 0, y: 0, width: self.backgroundView.frame.width, height: self.backgroundView.frame.height)
-            let viewerDocumentWeb = NCViewerDocumentWeb.init(frame: frame, configuration: WKWebViewConfiguration())
             
-            viewerDocumentWeb.viewDocumentWebAt(metadata, view: backgroundView)
             return
         }
-        
+    
         // DOCUMENT
         if metadata.typeFile == k_metadataTypeFile_document {
             
             // PDF
             if metadata.contentType == "application/pdf" {
-                if #available(iOS 11.0, *) {
-                    
-                    let frame = CGRect(x: 0, y: 0, width: self.backgroundView.frame.width, height: self.backgroundView.frame.height)
-                    let viewerPDF = NCViewerPDF.init(frame: frame)
-                    
-                    let filePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
-                    if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) == false {
-                        return
-                    }
                     
-                    viewerPDF.setupPdfView(filePath: URL(fileURLWithPath: filePath), view: backgroundView)
+                let frame = CGRect(x: 0, y: 0, width: self.backgroundView.frame.width, height: self.backgroundView.frame.height)
+                let viewerPDF = NCViewerPDF.init(frame: frame)
                     
-                } else {
-                    
-                    let frame = CGRect(x: 0, y: 0, width: self.backgroundView.frame.width, height: self.backgroundView.frame.height)
-                    let viewerDocumentWeb = NCViewerDocumentWeb.init(frame: frame, configuration: WKWebViewConfiguration())
+                let filePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
+                if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) == false {
                     
-                    viewerDocumentWeb.viewDocumentWebAt(metadata, view: backgroundView)
+                    return
                 }
-                
+                    
+                viewerPDF.setupPdfView(filePath: URL(fileURLWithPath: filePath), view: backgroundView)
+
                 return
             }
             
@@ -582,14 +578,23 @@ class NCDetailViewController: UIViewController {
                     let richDocument = NCViewerRichdocument.init(frame: backgroundView.frame, configuration: WKWebViewConfiguration())
                     richDocument.viewRichDocumentAt(metadata.url, metadata: metadata, view: backgroundView, viewController: self)
                 }
+                
+                return
             }
         }
         
         // OTHER
-        let frame = CGRect(x: 0, y: 0, width: self.backgroundView.frame.width, height: self.backgroundView.frame.height)
-        let viewerDocumentWeb = NCViewerDocumentWeb.init(frame: frame, configuration: WKWebViewConfiguration())
         
-        viewerDocumentWeb.viewDocumentWebAt(metadata, view: backgroundView)
+        let fileNamePath = NSTemporaryDirectory() + metadata.fileNameView
+
+        CCUtility.copyFile(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView), toPath: fileNamePath)
+
+        viewerQuickLook = NCViewerQuickLook.init()
+        viewerQuickLook?.quickLook(url: URL(fileURLWithPath: fileNamePath), viewController: self)
+        
+        DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
+            self.unload(checkWindow: false)
+        }
     }
 }
 
@@ -700,14 +705,14 @@ extension NCDetailViewController: NCViewerImageViewControllerDelegate, NCViewerI
             let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
             let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileName)!
             
+            metadata.session = k_download_session_foreground
+            
             _ = NCCommunication.sharedInstance.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, customUserAgent: nil, addCustomHeaders: nil, account: metadata.account, progressHandler: { (progress) in
                                 
                 self.progress(Float(progress.fractionCompleted))
                 
             }) { (account, etag, date, length, errorCode, errorDescription) in
                 
-                self.progress(0)
-                
                 if errorCode == 0 && account == metadata.account {
                     
                     _ = NCManageDatabase.sharedInstance.addLocalFile(metadata: metadata)
@@ -720,6 +725,9 @@ extension NCDetailViewController: NCViewerImageViewControllerDelegate, NCViewerI
                 } else if errorCode != 0 {
                     completion(index, NCViewerImageCommon.shared.getImageOffOutline(frame: self.view.frame, type: metadata.typeFile), metadata, ZoomScale.default, nil)
                 }
+                
+                metadata.session = ""
+                self.progress(0)
             }
         
         // Preview
@@ -749,19 +757,22 @@ extension NCDetailViewController: NCViewerImageViewControllerDelegate, NCViewerI
         }
     }
     
+    func viewerImageViewController(_ viewerImageViewController: NCViewerImageViewController, willChangeFocusTo index: Int, view: NCViewerImageContentView, metadata: tableMetadata) {
+        
+        statusViewImage(metadata: metadata, viewerImageViewController: viewerImageViewController)
+    }
+    
     func viewerImageViewController(_ viewerImageViewController: NCViewerImageViewController, didChangeFocusTo index: Int, view: NCViewerImageContentView, metadata: tableMetadata) {
-                
-        if metadata.typeFile == k_metadataTypeFile_image {
+        
+        if metadata.typeFile == k_metadataTypeFile_image && !view.isLoading {
             DispatchQueue.global().async {
                 if let image = NCViewerImageCommon.shared.getImage(metadata: metadata) {
-                    DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(400)) {
+                    DispatchQueue.main.async {
                         view.image = image
                     }
                 }
             }
         }
-        
-        statusViewImage(metadata: metadata, viewerImageViewController: viewerImageViewController)
     }
     
     func viewerImageViewControllerTap(_ viewerImageViewController: NCViewerImageViewController, metadata: tableMetadata) {

+ 26 - 24
iOSClient/Main/NCMainCommon.swift

@@ -604,31 +604,33 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
             }
             
             // Share image
-            if (isShare) {
-                cell.shared.image = NCMainCommonImages.cellSharedImage
-            } else if (tableShare != nil && tableShare!.shareType == Int(shareTypeLink.rawValue)) {
-                cell.shared.image = NCMainCommonImages.cellShareByLinkImage
-            } else if (tableShare != nil && tableShare!.shareType != Int(shareTypeLink.rawValue)) {
-                cell.shared.image = NCMainCommonImages.cellSharedImage
-            } else {
-                cell.shared.image = NCMainCommonImages.cellCanShareImage
-            }
-            if metadata.ownerId != appDelegate.activeUserID {
-                // Load avatar
-                let fileNameSource = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.activeUser, activeUrl: appDelegate.activeUrl) + "-" + metadata.ownerId + ".png"
-                let fileNameSourceAvatar = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.activeUser, activeUrl: appDelegate.activeUrl) + "-avatar-" + metadata.ownerId + ".png"
-                if FileManager.default.fileExists(atPath: fileNameSourceAvatar) {
-                    if let avatar = UIImage(contentsOfFile: fileNameSourceAvatar) {
-                        cell.shared.image = avatar
-                    }
-                } else if FileManager.default.fileExists(atPath: fileNameSource) {
-                    if let avatar = NCUtility.sharedInstance.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar) {
-                        cell.shared.image = avatar
-                    }
+            if !(metadataFolder?.e2eEncrypted ?? false) && !metadata.e2eEncrypted {
+                if (isShare) {
+                    cell.shared.image = NCMainCommonImages.cellSharedImage
+                } else if (tableShare != nil && tableShare!.shareType == Int(shareTypeLink.rawValue)) {
+                    cell.shared.image = NCMainCommonImages.cellShareByLinkImage
+                } else if (tableShare != nil && tableShare!.shareType != Int(shareTypeLink.rawValue)) {
+                    cell.shared.image = NCMainCommonImages.cellSharedImage
                 } else {
-                    NCCommunication.sharedInstance.downloadAvatar(serverUrl: appDelegate.activeUrl, userID: metadata.ownerId, fileNameLocalPath: fileNameSource, size: Int(k_avatar_size), customUserAgent: nil, addCustomHeaders: nil, account: appDelegate.activeAccount) { (account, data, errorCode, errorMessage) in
-                        if errorCode == 0 && account == self.appDelegate.activeAccount {
-                            cell.shared.image = NCUtility.sharedInstance.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar)
+                    cell.shared.image = NCMainCommonImages.cellCanShareImage
+                }
+                if metadata.ownerId != appDelegate.activeUserID {
+                    // Load avatar
+                    let fileNameSource = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.activeUser, activeUrl: appDelegate.activeUrl) + "-" + metadata.ownerId + ".png"
+                    let fileNameSourceAvatar = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.activeUser, activeUrl: appDelegate.activeUrl) + "-avatar-" + metadata.ownerId + ".png"
+                    if FileManager.default.fileExists(atPath: fileNameSourceAvatar) {
+                        if let avatar = UIImage(contentsOfFile: fileNameSourceAvatar) {
+                            cell.shared.image = avatar
+                        }
+                    } else if FileManager.default.fileExists(atPath: fileNameSource) {
+                        if let avatar = NCUtility.sharedInstance.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar) {
+                            cell.shared.image = avatar
+                        }
+                    } else {
+                        NCCommunication.sharedInstance.downloadAvatar(serverUrl: appDelegate.activeUrl, userID: metadata.ownerId, fileNameLocalPath: fileNameSource, size: Int(k_avatar_size), customUserAgent: nil, addCustomHeaders: nil, account: appDelegate.activeAccount) { (account, data, errorCode, errorMessage) in
+                            if errorCode == 0 && account == self.appDelegate.activeAccount {
+                                cell.shared.image = NCUtility.sharedInstance.createAvatar(fileNameSource: fileNameSource, fileNameSourceAvatar: fileNameSourceAvatar)
+                            }
                         }
                     }
                 }

+ 11 - 5
iOSClient/Main/NCMasterNavigationController.swift

@@ -38,11 +38,17 @@ class NCMasterNavigationController: UINavigationController {
     override func viewWillLayoutSubviews() {
         super.viewWillLayoutSubviews()
         
-        if self.splitViewController?.isCollapsed == false {
-            if (self.splitViewController != nil) {
-                if let navigationController = self.splitViewController!.viewControllers[self.splitViewController!.viewControllers.count-1] as? UINavigationController {
-                    navigationController.topViewController!.navigationItem.leftBarButtonItem = self.splitViewController!.displayModeButtonItem
-                }
+        guard let splitViewController = self.splitViewController else { return }
+        
+        if let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as? UINavigationController {
+            
+            if splitViewController.isCollapsed {
+                
+                navigationController.topViewController?.navigationItem.backBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_back_", comment: ""), style: UIBarButtonItem.Style.plain, target: nil, action: nil)
+                
+            } else {
+                
+                navigationController.topViewController?.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem
             }
         }
     }

+ 4 - 4
iOSClient/Main/NCPhotosPickerViewController.swift

@@ -100,8 +100,8 @@ class customPhotoPickerViewController: TLPhotosPickerViewController {
     override func makeUI() {
         super.makeUI()
         
-        self.customNavItem.leftBarButtonItem?.tintColor = NCBrandColor.sharedInstance.textView
-        self.customNavItem.rightBarButtonItem?.tintColor = NCBrandColor.sharedInstance.textView
+        self.customNavItem.leftBarButtonItem?.tintColor = NCBrandColor.sharedInstance.brandText
+        self.customNavItem.rightBarButtonItem?.tintColor = NCBrandColor.sharedInstance.brandText
         
         self.titleLabel.textColor = NCBrandColor.sharedInstance.icon
         self.subTitleLabel.textColor = NCBrandColor.sharedInstance.graySoft
@@ -112,7 +112,7 @@ class customPhotoPickerViewController: TLPhotosPickerViewController {
         if CCUtility.getDarkMode() {
             self.navigationBar.barStyle = .black
         }
-        self.titleLabel.textColor = NCBrandColor.sharedInstance.textView
-        self.subTitleLabel.textColor = NCBrandColor.sharedInstance.textView
+        self.titleLabel.textColor = NCBrandColor.sharedInstance.brandText
+        self.subTitleLabel.textColor = NCBrandColor.sharedInstance.brandText
     }
 }

+ 2 - 2
iOSClient/Media/NCMedia.swift

@@ -424,7 +424,7 @@ extension NCMedia: UIViewControllerPreviewingDelegate {
         viewController.imageFile = cell.imageItem.image
         viewController.showOpenIn = true
         viewController.showShare = false
-        viewController.showOpenInternalViewer = false
+        viewController.showOpenQuickLook = false
 
         return viewController
     }
@@ -642,7 +642,7 @@ extension NCMedia {
         }
         if let metadata = appDelegate.arrayDeleteMetadata.firstObject {
             appDelegate.arrayDeleteMetadata.removeObject(at: 0)
-            NCNetworking.sharedInstance.deleteMetadata(metadata as! tableMetadata, user: appDelegate.activeUser, userID: appDelegate.activeUserID, password: appDelegate.activePassword, url: appDelegate.activeUrl) { (errorCode, errorDescription) in }
+            NCNetworking.sharedInstance.deleteMetadata(metadata as! tableMetadata, account: appDelegate.activeAccount, user: appDelegate.activeUser, userID: appDelegate.activeUserID, password: appDelegate.activePassword, url: appDelegate.activeUrl) { (errorCode, errorDescription) in }
         }
     }
     

+ 41 - 19
iOSClient/Networking/CCNetworking.m

@@ -586,8 +586,19 @@
 
     if ([CCUtility fileProviderStorageExists:metadata.ocId fileNameView:metadata.fileNameView] == NO) {
         
-        [CCUtility extractImageVideoFromAssetLocalIdentifierForUpload:metadata completion:^(tableMetadata *metadataForUpload) {
-            if (metadataForUpload != nil) {
+        [CCUtility extractImageVideoFromAssetLocalIdentifierForUpload:metadata notification:true completion:^(tableMetadata *newMetadata, NSString *fileNamePath) {
+            
+            if (newMetadata == nil) {
+                
+                [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"ocId == %@", metadata.ocId]];
+                
+            } else {
+                
+                NSString *toPath = [CCUtility getDirectoryProviderStorageOcId:newMetadata.ocId fileNameView:newMetadata.fileNameView];
+                [CCUtility moveFileAtPath:fileNamePath toPath:toPath];
+                
+                tableMetadata *metadataForUpload = [[NCManageDatabase sharedInstance] addMetadata:newMetadata];
+                
                 if ([CCUtility isFolderEncrypted:metadataForUpload.serverUrl e2eEncrypted:metadataForUpload.e2eEncrypted account:metadataForUpload.account] && [CCUtility isEndToEndEnabled:metadataForUpload.account]) {
                     [self e2eEncryptedFile:metadataForUpload taskStatus:taskStatus];
                 } else {
@@ -598,7 +609,22 @@
         
     } else {
         
-        tableMetadata *metadataForUpload = [[NCManageDatabase sharedInstance] addMetadata:[CCUtility insertFileSystemInMetadata:metadata]];        
+        NSDictionary *results = [[NCCommunicationCommon sharedInstance] objcGetInternalContenTypeWithFileName:metadata.fileNameView contentType:metadata.contentType directory:metadata.directory];
+        metadata.contentType = results[@"contentType"];
+        metadata.iconName = results[@"iconName"];
+        metadata.typeFile = results[@"typeFile"];
+
+        NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[CCUtility getDirectoryProviderStorageOcId:metadata.ocId fileNameView:metadata.fileName] error:nil];
+        
+        if (attributes[NSFileModificationDate]) {
+            metadata.date = attributes[NSFileModificationDate];
+        } else {
+            metadata.date = [NSDate date];
+        }
+        metadata.size = [attributes[NSFileSize] longValue];
+        
+        tableMetadata *metadataForUpload = [[NCManageDatabase sharedInstance] addMetadata:metadata];
+        
         if ([CCUtility isFolderEncrypted:metadataForUpload.serverUrl e2eEncrypted:metadataForUpload.e2eEncrypted account:metadataForUpload.account] && [CCUtility isEndToEndEnabled:metadataForUpload.account]) {
             [self e2eEncryptedFile:metadataForUpload taskStatus:taskStatus];
         } else {
@@ -639,11 +665,15 @@
         }
         
         // if new file upload create a new encrypted filename
+        fileNameIdentifier = [CCUtility generateRandomIdentifier];
+        
+        /*
         if ([metadata.ocId isEqualToString:[CCUtility createMetadataIDFromAccount:metadata.account serverUrl:metadata.serverUrl fileNameView:metadata.fileNameView directory:false]]) {
             fileNameIdentifier = [CCUtility generateRandomIdentifier];
         } else {
             fileNameIdentifier = metadata.fileName;
         }
+        */
         
         if ([[NCEndToEndEncryption sharedManager] encryptFileName:metadata.fileNameView fileNameIdentifier:fileNameIdentifier directory:[CCUtility getDirectoryProviderStorageOcId:metadata.ocId] key:&key initializationVector:&initializationVector authenticationTag:&authenticationTag]) {
             
@@ -724,8 +754,8 @@
     NSMutableURLRequest *request;
     PHAsset *asset;
     NSError *error;
+    NSString *serverUrl = metadata.serverUrl;
     
-    //
     tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", metadata.account]];
     if (tableAccount == nil) {
         [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"ocId == %@", metadata.ocId]];
@@ -769,7 +799,7 @@
         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
             
             // Send Metadata
-            NSError *error = [[NCNetworkingEndToEnd sharedManager] sendEndToEndMetadataOnServerUrl:metadata.serverUrl fileNameRename:nil fileNameNewRename:nil unlock:false account:tableAccount.account user:tableAccount.user userID:tableAccount.userID password:[CCUtility getPassword:tableAccount.account] url:tableAccount.url];
+            NSError *error = [[NCNetworkingEndToEnd sharedManager] sendEndToEndMetadataOnServerUrl:serverUrl fileNameRename:nil fileNameNewRename:nil unlock:false account:tableAccount.account user:tableAccount.user userID:tableAccount.userID password:[CCUtility getPassword:tableAccount.account] url:tableAccount.url];
             
             dispatch_async(dispatch_get_main_queue(), ^{
 
@@ -782,6 +812,10 @@
                     
                 } else {
                 
+                    // Add Header e2e-token
+                    tableE2eEncryptionLock *tableLock = [[NCManageDatabase sharedInstance] getE2ETokenLockWithServerUrl:metadata.serverUrl];
+                    [request setValue:tableLock.e2eToken forHTTPHeaderField:@"e2e-token"];
+                    
                     // NSURLSession
                     NSURLSession *sessionUpload;
                     if ([metadata.session isEqualToString:k_upload_session]) sessionUpload = [self sessionUpload];
@@ -860,7 +894,6 @@
 - (void)uploadFileSuccessFailure:(tableMetadata *)metadata fileName:(NSString *)fileName ocId:(NSString *)ocId etag:(NSString *)etag date:(NSDate *)date serverUrl:(NSString *)serverUrl errorCode:(NSInteger)errorCode
 {
     NSString *tempocId = metadata.ocId;
-    NSString *tempSession = metadata.session;
     NSString *errorMessage = @"";
     BOOL isE2EEDirectory = false;
 
@@ -972,23 +1005,12 @@
             metadata.sessionTaskIdentifier = k_taskIdentifierDone;
             metadata.status = k_metadataStatusNormal;
             
+            [CCUtility moveFileAtPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], tempocId] toPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], metadata.ocId]];
+            
             [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileName == %@", metadata.account, metadata.serverUrl, metadata.fileName]];
             metadata = [[NCManageDatabase sharedInstance] addMetadata:metadata];
             
             NSLog(@"[LOG] Insert new upload : %@ - ocId : %@", metadata.fileName, ocId);
-            
-            if ([tempocId isEqualToString:[CCUtility createMetadataIDFromAccount:metadata.account serverUrl:metadata.serverUrl fileNameView:metadata.fileNameView directory:metadata.directory]]) {
-                
-                [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"ocId == %@", tempocId]];
-                
-                // adjust file system Directory Provider Storage
-                if ([tempSession isEqualToString:k_upload_session_extension]) {
-                    // this is for File Provider Extension [Apple Works and ... ?]
-                    [CCUtility copyFileAtPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], tempocId] toPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], metadata.ocId]];
-                } else {
-                    [CCUtility moveFileAtPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], tempocId] toPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], metadata.ocId]];
-                }
-            }
         }
 #ifndef EXTENSION
         

+ 47 - 156
iOSClient/Networking/NCNetworking.swift

@@ -37,19 +37,10 @@ import NCCommunication
         let instance = NCNetworking()
         return instance
     }()
-    
-    var account = ""
-    
+        
     // Protocol
     var delegate: NCNetworkingDelegate?
-    
-    //MARK: - Setup
-    
-    @objc public func setup(account: String, delegate: NCNetworkingDelegate?) {
-        self.account = account
-        self.delegate = delegate
-    }
-    
+        
     //MARK: - Communication Delegate
        
     func authenticationChallenge(_ challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
@@ -200,7 +191,9 @@ import NCCommunication
                 var errorDescription = errorDescription
                 if errorDescription == nil { errorDescription = "Internal error. Error not found" }
                 
+                #if !EXTENSION
                 NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: errorCode)
+                #endif
                 
                 completion(account, nil, nil, errorCode, errorDescription!)
             }
@@ -212,12 +205,14 @@ import NCCommunication
         NCCommunication.sharedInstance.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles(), customUserAgent: nil, addCustomHeaders: nil, account: account) { (account, files, errorCode, errorDescription) in
 
             if errorCode == 0 && files != nil {
-             
-                let file = files![0]
-                let isEncrypted = CCUtility.isFolderEncrypted(file.serverUrl, e2eEncrypted:file.e2eEncrypted, account: account)
-                let metadata = NCManageDatabase.sharedInstance.convertNCFileToMetadata(file, isEncrypted: isEncrypted, account: account)
-                completion(account, metadata, errorCode, "")
-                
+                if files?.count ?? 0 == 1 {
+                    let file = files![0]
+                    let isEncrypted = CCUtility.isFolderEncrypted(file.serverUrl, e2eEncrypted:file.e2eEncrypted, account: account)
+                    let metadata = NCManageDatabase.sharedInstance.convertNCFileToMetadata(file, isEncrypted: isEncrypted, account: account)
+                    completion(account, metadata, errorCode, "")
+                } else {
+                    completion(account, nil, errorCode, "")
+                }
             } else {
 
                 completion(account, nil, errorCode, errorDescription!)
@@ -229,74 +224,39 @@ import NCCommunication
 
     @objc func createFolder(fileName: String, serverUrl: String, account: String, user: String, userID: String, password: String, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
         
+        let isDirectoryEncrypted = CCUtility.isFolderEncrypted(serverUrl, e2eEncrypted: false, account: account)
+               
+        if isDirectoryEncrypted {
+            #if !EXTENSION
+            NCNetworkingE2EE.sharedInstance.createFolder(fileName: fileName, serverUrl: serverUrl, account: account, user: user, userID: userID, password: password, url: url, completion: completion)
+            #endif
+        } else {
+            createFolderPlain(fileName: fileName, serverUrl: serverUrl, account: account, user: user, userID: userID, password: password, url: url, completion: completion)
+        }
+    }
+    
+    @objc func createFolderPlain(fileName: String, serverUrl: String, account: String, user: String, userID: String, password: String, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
+        
         var fileNameFolder = CCUtility.removeForbiddenCharactersServer(fileName)!
-        var fileNameFolderUrl = ""
-        var fileNameIdentifier = ""
-        var key: NSString?
-        var initializationVector: NSString?
-        let object = tableE2eEncryption()
         
         fileNameFolder = NCUtility.sharedInstance.createFileName(fileNameFolder, serverUrl: serverUrl, account: account)
         if fileNameFolder.count == 0 {
             self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": Int(0)], errorDescription: "", completion: completion)
             return
         }
-        let isDirectoryEncrypted = CCUtility.isFolderEncrypted(serverUrl, e2eEncrypted: false, account: account)
-        if isDirectoryEncrypted {
-            fileNameIdentifier = CCUtility.generateRandomIdentifier()
-            fileNameFolderUrl = serverUrl + "/" + fileNameIdentifier
-        } else {
-            fileNameFolderUrl = serverUrl + "/" + fileNameFolder
-        }
+        let fileNameFolderUrl = serverUrl + "/" + fileNameFolder
         
         NCCommunication.sharedInstance.createFolder(fileNameFolderUrl, customUserAgent: nil, addCustomHeaders: nil, account: account) { (account, ocId, date, errorCode, errorDescription) in
             if errorCode == 0 {
-                
                 self.readFile(serverUrlFileName: fileNameFolderUrl, account: account) { (account, metadataFolder, errorCode, errorDescription) in
                     if errorCode == 0 {
-                        
+                        // Add Metadata
+                        NCManageDatabase.sharedInstance.addMetadata(metadataFolder!)
                         // Add folder
                         NCManageDatabase.sharedInstance.addDirectory(encrypted: metadataFolder!.e2eEncrypted, favorite: metadataFolder!.favorite, ocId: metadataFolder!.ocId, fileId: metadataFolder!.fileId, etag: nil, permissions: metadataFolder!.permissions, serverUrl: fileNameFolderUrl, richWorkspace: metadataFolder!.richWorkspace, account: account)
                         
-                        if isDirectoryEncrypted {
-                            
-                            DispatchQueue.global().async {
-                                
-                                if let error = NCNetworkingEndToEnd.sharedManager()?.markFolderEncrypted(onServerUrl: fileNameFolderUrl, fileId: metadataFolder?.fileId, user: user, userID: userID, password: password, url: url) as NSError? {
-                                    self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": error.code], errorDescription: error.localizedDescription, completion: completion)
-                                    return
-                                }
-                                                                                                
-                                NCEndToEndEncryption.sharedManager()?.encryptkey(&key, initializationVector: &initializationVector)
-                                let metadataKey = NCEndToEndEncryption.sharedManager()?.generateKey(16)?.base64EncodedString(options: []) // AES_KEY_128_LENGTH
-                                
-                                object.account = account
-                                object.authenticationTag = nil
-                                object.fileName = fileNameFolder
-                                object.fileNameIdentifier = fileNameIdentifier
-                                object.fileNamePath = ""
-                                object.key = key! as String
-                                object.initializationVector = initializationVector! as String
-                                object.metadataKey = metadataKey!
-                                object.metadataKeyIndex = 0
-                                object.mimeType = "application/directory"
-                                object.serverUrl = serverUrl
-                                object.version = Int(NCManageDatabase.sharedInstance.getEndToEndEncryptionVersion(account: account))
-                                let _ = NCManageDatabase.sharedInstance.addE2eEncryption(object)
-                                
-                                // Send Metadata
-                                if let error = NCNetworkingEndToEnd.sharedManager()?.sendMetadata(onServerUrl: serverUrl, fileNameRename: nil, fileNameNewRename: nil, unlock: true, account: account, user: user, userID: userID, password: password, url: url) as NSError? {
-                                    self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": error.code], errorDescription: error.localizedDescription, completion: completion)
-                                    return
-                                }
-                                
-                                DispatchQueue.main.async {
-                                    self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
-                                }
-                            }
-                        } else {
-                            self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
-                        }
+                        self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
+                        
                     } else {
                         self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
                     }
@@ -306,35 +266,37 @@ import NCCommunication
             }
         }
     }
-    
+        
     //MARK: - WebDav Delete
 
-    @objc func deleteMetadata(_ metadata: tableMetadata, user: String, userID: String, password: String, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
+    @objc func deleteMetadata(_ metadata: tableMetadata, account: String, user: String, userID: String, password: String, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
                 
         let isDirectoryEncrypted = CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account)
         let metadataLive = NCUtility.sharedInstance.isLivePhoto(metadata: metadata)
         
         if isDirectoryEncrypted {
+            #if !EXTENSION
             if let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, metadata.serverUrl)) {
                 if metadataLive == nil {
-                    self.deleteMetadataE2EE(metadata, directory: directory, user: user, userID: userID, password: password, url: url, completion: completion)
+                    NCNetworkingE2EE.sharedInstance.deleteMetadata(metadata, directory: directory, account: account, user: user, userID: userID, password: password, url: url, completion: completion)
                 } else {
-                    self.deleteMetadataE2EE(metadataLive!, directory: directory, user: user, userID: userID, password: password, url: url) { (errorCode, errorDescription) in
+                    NCNetworkingE2EE.sharedInstance.deleteMetadata(metadataLive!, directory: directory, account: account, user: user, userID: userID, password: password, url: url) { (errorCode, errorDescription) in
                         if errorCode == 0 {
-                            self.deleteMetadataE2EE(metadata, directory: directory, user: user, userID: userID, password: password, url: url, completion: completion)
+                            NCNetworkingE2EE.sharedInstance.deleteMetadata(metadata, directory: directory, account: account, user: user, userID: userID, password: password, url: url, completion: completion)
                         } else {
                             completion(errorCode, errorDescription)
                         }
                     }
                 }
             }
+            #endif
         } else {
             if metadataLive == nil {
-                self.deleteMetadataPlain(metadata, completion: completion)
+                self.deleteMetadataPlain(metadata, addCustomHeaders: nil, completion: completion)
             } else {
-                self.deleteMetadataPlain(metadataLive!) { (errorCode, errorDescription) in
+                self.deleteMetadataPlain(metadataLive!, addCustomHeaders: nil) { (errorCode, errorDescription) in
                     if errorCode == 0 {
-                        self.deleteMetadataPlain(metadata, completion: completion)
+                        self.deleteMetadataPlain(metadata, addCustomHeaders: nil, completion: completion)
                     } else {
                         completion(errorCode, errorDescription)
                     }
@@ -343,7 +305,7 @@ import NCCommunication
         }
     }
     
-    private func deleteMetadataPlain(_ metadata: tableMetadata, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
+    func deleteMetadataPlain(_ metadata: tableMetadata, addCustomHeaders: [String:String]?, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
         
         // verify permission
         let permission = NCUtility.sharedInstance.permissionsContainsString(metadata.permissions, permissions: k_permission_can_delete)
@@ -354,7 +316,7 @@ import NCCommunication
         }
                 
         let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
-        NCCommunication.sharedInstance.deleteFileOrFolder(serverUrlFileName, customUserAgent: nil, addCustomHeaders: nil, account: metadata.account) { (account, errorCode, errorDescription) in
+        NCCommunication.sharedInstance.deleteFileOrFolder(serverUrlFileName, customUserAgent: nil, addCustomHeaders: addCustomHeaders, account: metadata.account) { (account, errorCode, errorDescription) in
         
             if errorCode == 0 || errorCode == kOCErrorServerPathNotFound {
                 
@@ -375,34 +337,6 @@ import NCCommunication
         }
     }
     
-    private func deleteMetadataE2EE(_ metadata: tableMetadata, directory: tableDirectory, user: String, userID: String, password: String, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
-                        
-        DispatchQueue.global().async {
-            // LOCK FOLDER
-            let error = NCNetworkingEndToEnd.sharedManager().lockFolderEncrypted(onServerUrl: directory.serverUrl, fileId: directory.fileId, user: user, userID: userID, password: password, url: url) as NSError?
-            
-            DispatchQueue.main.async {
-                if error == nil {
-                    self.deleteMetadataPlain(metadata) { (errorCode, errorDescription) in
-                        
-                        if errorCode == 0 {
-                            NCManageDatabase.sharedInstance.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameIdentifier == %@", metadata.account, directory.serverUrl, metadata.fileName))
-                        }
-                        
-                        DispatchQueue.global().async {
-                            NCNetworkingEndToEnd.sharedManager().rebuildAndSendMetadata(onServerUrl: directory.serverUrl, account: self.account, user: user, userID: userID, password: password, url: url)
-                        }
-                        
-                        self.NotificationPost(name: k_notificationCenter_deleteFile, userInfo: ["metadata": metadata, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
-                    }
-                } else {
-                    
-                    self.NotificationPost(name: k_notificationCenter_deleteFile, userInfo: ["metadata": metadata, "errorCode": error!.code], errorDescription: error?.localizedDescription, completion: completion)
-                }
-            }
-        }
-    }
-    
     //MARK: - WebDav Favorite
 
     @objc func favoriteMetadata(_ metadata: tableMetadata, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
@@ -437,26 +371,27 @@ import NCCommunication
     
     //MARK: - WebDav Rename
 
-    
     @objc func renameMetadata(_ metadata: tableMetadata, fileNameNew: String, user: String, userID: String, password: String, url: String, viewController: UIViewController?, completion: @escaping (_ errorCode: Int, _ errorDescription: String?)->()) {
         
         let isDirectoryEncrypted = CCUtility.isFolderEncrypted(metadata.serverUrl, e2eEncrypted: metadata.e2eEncrypted, account: metadata.account)
         let metadataLive = NCUtility.sharedInstance.isLivePhoto(metadata: metadata)
 
         if isDirectoryEncrypted {
+            #if !EXTENSION
             if let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, metadata.serverUrl)) {
                 if metadataLive == nil {
-                    renameMetadataE2EE(metadata, fileNameNew: fileNameNew, directory: directory, user: user, userID: userID, password: password, url: url, completion: completion)
+                    NCNetworkingE2EE.sharedInstance.renameMetadata(metadata, fileNameNew: fileNameNew, directory: directory, user: user, userID: userID, password: password, url: url, completion: completion)
                 } else {
-                    self.renameMetadataE2EE(metadataLive!, fileNameNew: fileNameNew, directory: directory, user: user, userID: userID, password: password, url: url) { (errorCode, errorDescription) in
+                    NCNetworkingE2EE.sharedInstance.renameMetadata(metadataLive!, fileNameNew: fileNameNew, directory: directory, user: user, userID: userID, password: password, url: url) { (errorCode, errorDescription) in
                         if errorCode == 0 {
-                            self.renameMetadataE2EE(metadata, fileNameNew: fileNameNew, directory: directory, user: user, userID: userID, password: password, url: url, completion: completion)
+                            NCNetworkingE2EE.sharedInstance.renameMetadata(metadata, fileNameNew: fileNameNew, directory: directory, user: user, userID: userID, password: password, url: url, completion: completion)
                         } else {
                             completion(errorCode, errorDescription)
                         }
                     }
                 }
             }
+            #endif
         } else {
             if metadataLive == nil {
                 renameMetadataPlain(metadata, fileNameNew: fileNameNew, completion: completion)
@@ -528,50 +463,6 @@ import NCCommunication
         }
     }
     
-    private func renameMetadataE2EE(_ metadata: tableMetadata, fileNameNew: String, directory: tableDirectory, user: String, userID: String, password: String, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String?)->()) {
-        
-        // verify if exists the new fileName
-        if NCManageDatabase.sharedInstance.getE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileName == %@", metadata.account, metadata.serverUrl, fileNameNew)) != nil {
-            
-            self.NotificationPost(name: k_notificationCenter_renameFile, userInfo: ["metadata": metadata, "errorCode": Int(k_CCErrorInternalError)], errorDescription: "_file_already_exists_", completion: completion)
-
-        } else {
-            
-            DispatchQueue.global().async {
-                
-                if let error = NCNetworkingEndToEnd.sharedManager()?.sendMetadata(onServerUrl: metadata.serverUrl, fileNameRename: metadata.fileName, fileNameNewRename: fileNameNew, unlock: false, account: metadata.account, user: user, userID: userID, password: password, url: url) as NSError? {
-                    
-                    self.NotificationPost(name: k_notificationCenter_renameFile, userInfo: ["metadata": metadata, "errorCode": error.code], errorDescription: error.localizedDescription, completion: completion)
-                    
-                } else {
-                    NCManageDatabase.sharedInstance.setMetadataFileNameView(serverUrl: metadata.serverUrl, fileName: metadata.fileName, newFileNameView: fileNameNew, account: metadata.account)
-                    
-                    // Move file system
-                    let atPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId) + "/" + metadata.fileNameView
-                    let toPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId) + "/" + fileNameNew
-                    do {
-                        try FileManager.default.moveItem(atPath: atPath, toPath: toPath)
-                    } catch { }
-                    let atPathIcon = CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
-                    let toPathIcon = CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, fileNameView: fileNameNew)!
-                    do {
-                        try FileManager.default.moveItem(atPath: atPathIcon, toPath: toPathIcon)
-                    } catch { }
-                    
-                    self.NotificationPost(name: k_notificationCenter_renameFile, userInfo: ["metadata": metadata, "errorCode": Int(0)], errorDescription: "", completion: completion)
-                }
-                
-                // UNLOCK
-                if let tableLock = NCManageDatabase.sharedInstance.getE2ETokenLock(serverUrl: metadata.serverUrl) {
-                    if let error = NCNetworkingEndToEnd.sharedManager()?.unlockFolderEncrypted(onServerUrl: metadata.serverUrl, fileId: directory.fileId, e2eToken: tableLock.e2eToken, user: user, userID: userID, password: password, url: url) as NSError? {
-                        
-                        self.NotificationPost(name: k_notificationCenter_renameFile, userInfo: ["metadata": metadata, "errorCode": error.code], errorDescription: error.localizedDescription, completion: completion)
-                    }
-                }
-            }
-        }
-    }
-    
     //MARK: - WebDav Move
     
     @objc func moveMetadata(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool, completion: @escaping (_ errorCode: Int, _ errorDescription: String?)->()) {

+ 220 - 0
iOSClient/Networking/NCNetworkingE2EE.swift

@@ -0,0 +1,220 @@
+//
+//  NCNetworkingE2EE.swift
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 05/05/2020.
+//  Copyright © 2020 Marino Faggiana. All rights reserved.
+//
+
+import Foundation
+import OpenSSL
+import NCCommunication
+
+@objc class NCNetworkingE2EE: NSObject {
+    @objc public static let sharedInstance: NCNetworkingE2EE = {
+        let instance = NCNetworkingE2EE()
+        return instance
+    }()
+    
+    //MARK: - WebDav Create Folder
+    
+    func createFolder(fileName: String, serverUrl: String, account: String, user: String, userID: String, password: String, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
+        
+        var fileNameFolder = CCUtility.removeForbiddenCharactersServer(fileName)!
+        var fileNameFolderUrl = ""
+        var fileNameIdentifier = ""
+        var key: NSString?
+        var initializationVector: NSString?
+        
+        fileNameFolder = NCUtility.sharedInstance.createFileName(fileNameFolder, serverUrl: serverUrl, account: account)
+        if fileNameFolder.count == 0 {
+            self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": Int(0)], errorDescription: "", completion: completion)
+            return
+        }
+        fileNameIdentifier = CCUtility.generateRandomIdentifier()
+        fileNameFolderUrl = serverUrl + "/" + fileNameIdentifier
+       
+        DispatchQueue.global().async {
+            
+            let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", account, serverUrl))
+            if directory == nil {
+                self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": k_CCErrorInternalError], errorDescription: "Directory not found", completion: completion)
+                return
+            }
+            
+            if let error = NCNetworkingEndToEnd.sharedManager()?.lockFolderEncrypted(onServerUrl: serverUrl, fileId: directory?.fileId, user: user, userID: userID, password: password, url: url) as NSError? {
+                self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": error.code], errorDescription: error.localizedDescription, completion: completion)
+                return
+            }
+            
+            guard let lock = NCManageDatabase.sharedInstance.getE2ETokenLock(serverUrl: serverUrl) else {
+                self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": k_CCErrorInternalError], errorDescription: "Lock not found", completion: completion)
+                return
+            }
+            
+            let e2eToken = lock.e2eToken
+            
+            DispatchQueue.main.async {
+                
+                NCCommunication.sharedInstance.createFolder(fileNameFolderUrl, customUserAgent: nil, addCustomHeaders: ["e2e-token" : e2eToken], account: account) { (account, ocId, date, errorCode, errorDescription) in
+                    if errorCode == 0 {
+                        NCNetworking.sharedInstance.readFile(serverUrlFileName: fileNameFolderUrl, account: account) { (account, metadataFolder, errorCode, errorDescription) in
+                            if errorCode == 0 {
+                                // Add Metadata
+                                metadataFolder?.fileNameView = fileNameFolder
+                                metadataFolder?.e2eEncrypted = true
+                                NCManageDatabase.sharedInstance.addMetadata(metadataFolder!)
+                                // Add folder
+                                NCManageDatabase.sharedInstance.addDirectory(encrypted: true, favorite: metadataFolder!.favorite, ocId: metadataFolder!.ocId, fileId: metadataFolder!.fileId, etag: nil, permissions: metadataFolder!.permissions, serverUrl: fileNameFolderUrl, richWorkspace: metadataFolder!.richWorkspace, account: account)
+                                
+                                let fileId = metadataFolder?.fileId
+                                
+                                DispatchQueue.global().async {
+                                
+                                    if let error = NCNetworkingEndToEnd.sharedManager()?.markFolderEncrypted(onServerUrl: fileNameFolderUrl, fileId: fileId, user: user, userID: userID, password: password, url: url) as NSError? {
+                                        self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": error.code], errorDescription: error.localizedDescription, completion: completion)
+                                        return
+                                    }
+
+                                    let newobject = tableE2eEncryption()
+                                    
+                                    NCEndToEndEncryption.sharedManager()?.encryptkey(&key, initializationVector: &initializationVector)
+                                    
+                                    newobject.account = account
+                                    newobject.authenticationTag = nil
+                                    newobject.fileName = fileNameFolder
+                                    newobject.fileNameIdentifier = fileNameIdentifier
+                                    newobject.fileNamePath = ""
+                                    newobject.key = key! as String
+                                    newobject.initializationVector = initializationVector! as String
+                                    
+                                    if let object = NCManageDatabase.sharedInstance.getE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", account, serverUrl)) {
+                                        newobject.metadataKey = object.metadataKey
+                                        newobject.metadataKeyIndex = object.metadataKeyIndex
+                                    } else {
+                                        newobject.metadataKey = (NCEndToEndEncryption.sharedManager()?.generateKey(16)?.base64EncodedString(options: []))! as String // AES_KEY_128_LENGTH
+                                        newobject.metadataKeyIndex = 0
+                                    }
+                                    newobject.mimeType = "httpd/unix-directory"
+                                    newobject.serverUrl = serverUrl
+                                    newobject.version = Int(NCManageDatabase.sharedInstance.getEndToEndEncryptionVersion(account: account))
+                                    
+                                    let _ = NCManageDatabase.sharedInstance.addE2eEncryption(newobject)
+
+                                    // Send Metadata
+                                    if let error = NCNetworkingEndToEnd.sharedManager()?.sendMetadata(onServerUrl: serverUrl, fileNameRename: nil, fileNameNewRename: nil, unlock: true, account: account, user: user, userID: userID, password: password, url: url) as NSError? {
+                                        self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": error.code], errorDescription: error.localizedDescription, completion: completion)
+                                        return
+                                    }
+                                    self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
+                                }
+                                
+                            } else {
+                                self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
+                            }
+                        }
+                    } else {
+                        self.NotificationPost(name: k_notificationCenter_createFolder, userInfo: ["fileName": fileName, "serverUrl": serverUrl, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
+                    }
+                }
+            }
+        }
+    }
+    
+    //MARK: - WebDav Delete
+    
+    func deleteMetadata(_ metadata: tableMetadata, directory: tableDirectory, account: String, user: String, userID: String, password: String, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
+                        
+        DispatchQueue.global().async {
+            // LOCK FOLDER
+            let error = NCNetworkingEndToEnd.sharedManager().lockFolderEncrypted(onServerUrl: directory.serverUrl, fileId: directory.fileId, user: user, userID: userID, password: password, url: url) as NSError?
+            
+            DispatchQueue.main.async {
+                if error == nil {
+                    guard let lock = NCManageDatabase.sharedInstance.getE2ETokenLock(serverUrl: directory.serverUrl) else {
+                        self.NotificationPost(name: k_notificationCenter_deleteFile, userInfo: ["metadata": metadata, "errorCode": k_CCErrorInternalError], errorDescription: "Lock not found", completion: completion)
+                        return
+                    }
+                    NCNetworking.sharedInstance.deleteMetadataPlain(metadata, addCustomHeaders: ["e2e-token" : lock.e2eToken]) { (errorCode, errorDescription) in
+                        
+                        if errorCode == 0 {
+                            NCManageDatabase.sharedInstance.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameIdentifier == %@", metadata.account, directory.serverUrl, metadata.fileName))
+                        }
+                        
+                        DispatchQueue.global().async {
+                            NCNetworkingEndToEnd.sharedManager().rebuildAndSendMetadata(onServerUrl: directory.serverUrl, account: account, user: user, userID: userID, password: password, url: url)
+                        }
+                        
+                        self.NotificationPost(name: k_notificationCenter_deleteFile, userInfo: ["metadata": metadata, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
+                    }
+                } else {
+                    
+                    self.NotificationPost(name: k_notificationCenter_deleteFile, userInfo: ["metadata": metadata, "errorCode": error!.code], errorDescription: error?.localizedDescription, completion: completion)
+                }
+            }
+        }
+    }
+    
+    //MARK: - WebDav Rename
+    
+    func renameMetadata(_ metadata: tableMetadata, fileNameNew: String, directory: tableDirectory, user: String, userID: String, password: String, url: String, completion: @escaping (_ errorCode: Int, _ errorDescription: String?)->()) {
+        
+        // verify if exists the new fileName
+        if NCManageDatabase.sharedInstance.getE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileName == %@", metadata.account, metadata.serverUrl, fileNameNew)) != nil {
+            
+            self.NotificationPost(name: k_notificationCenter_renameFile, userInfo: ["metadata": metadata, "errorCode": Int(k_CCErrorInternalError)], errorDescription: "_file_already_exists_", completion: completion)
+
+        } else {
+            
+            DispatchQueue.global().async {
+                
+                if let error = NCNetworkingEndToEnd.sharedManager()?.sendMetadata(onServerUrl: metadata.serverUrl, fileNameRename: metadata.fileName, fileNameNewRename: fileNameNew, unlock: false, account: metadata.account, user: user, userID: userID, password: password, url: url) as NSError? {
+                    
+                    self.NotificationPost(name: k_notificationCenter_renameFile, userInfo: ["metadata": metadata, "errorCode": error.code], errorDescription: error.localizedDescription, completion: completion)
+                    
+                } else {
+                    NCManageDatabase.sharedInstance.setMetadataFileNameView(serverUrl: metadata.serverUrl, fileName: metadata.fileName, newFileNameView: fileNameNew, account: metadata.account)
+                    
+                    // Move file system
+                    let atPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId) + "/" + metadata.fileNameView
+                    let toPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId) + "/" + fileNameNew
+                    do {
+                        try FileManager.default.moveItem(atPath: atPath, toPath: toPath)
+                    } catch { }
+                    let atPathIcon = CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
+                    let toPathIcon = CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, fileNameView: fileNameNew)!
+                    do {
+                        try FileManager.default.moveItem(atPath: atPathIcon, toPath: toPathIcon)
+                    } catch { }
+                    
+                    self.NotificationPost(name: k_notificationCenter_renameFile, userInfo: ["metadata": metadata, "errorCode": Int(0)], errorDescription: "", completion: completion)
+                }
+                
+                // UNLOCK
+                if let tableLock = NCManageDatabase.sharedInstance.getE2ETokenLock(serverUrl: metadata.serverUrl) {
+                    if let error = NCNetworkingEndToEnd.sharedManager()?.unlockFolderEncrypted(onServerUrl: metadata.serverUrl, fileId: directory.fileId, e2eToken: tableLock.e2eToken, user: user, userID: userID, password: password, url: url) as NSError? {
+                        
+                        self.NotificationPost(name: k_notificationCenter_renameFile, userInfo: ["metadata": metadata, "errorCode": error.code], errorDescription: error.localizedDescription, completion: completion)
+                    }
+                }
+            }
+        }
+    }
+    
+    //MARK: - Notification Post
+       
+    private func NotificationPost(name: String, userInfo: [AnyHashable : Any], errorDescription: Any?, completion: @escaping (_ errorCode: Int, _ errorDescription: String)->()) {
+        var userInfo = userInfo
+        DispatchQueue.main.async {
+               
+            if errorDescription == nil { userInfo["errorDescription"] = "" }
+            else { userInfo["errorDescription"] = NSLocalizedString(errorDescription as! String, comment: "") }
+               
+            NotificationCenter.default.post(name: Notification.Name.init(rawValue: name), object: nil, userInfo: userInfo)
+               
+            completion(userInfo["errorCode"] as! Int, userInfo["errorDescription"] as! String)
+        }
+    }
+}
+
+

+ 33 - 104
iOSClient/Networking/NCNetworkingEndToEnd.m

@@ -314,7 +314,9 @@
             
             NSDictionary *fields = [response allHeaderFields];
             returnOcId = [CCUtility removeForbiddenCharactersFileSystem:[fields objectForKey:@"OC-FileId"]];
-            returnFileId = [CCUtility convertOcIdToFileId:returnOcId];
+            NSArray *components = [returnOcId componentsSeparatedByString:@"oc"];
+            NSInteger numFileId = [components.firstObject intValue];
+            returnFileId = [@(numFileId) stringValue];
             
             if (encrypted) {
                 
@@ -373,68 +375,18 @@
     [communication setCredentialsWithUser:user andUserID:userID andPassword:password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     
-    tableE2eEncryptionLock *tableLock = [[NCManageDatabase sharedInstance] getE2ETokenLockWithServerUrl:serverUrl];
-
-    // Read Folder
-    [communication readFolder:serverUrl depth:@"1" withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *tokenReadFolder) {
-    
-        if (items.count > 1) {
+    // MARK
+    [communication markEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
             
-            returnError = [NSError errorWithDomain:@"com.nextcloud.nextcloud" code:999 userInfo:[NSDictionary dictionaryWithObject:NSLocalizedString(@"_e2e_error_directory_not_empty_", nil) forKey:NSLocalizedDescriptionKey]];
-            dispatch_semaphore_signal(semaphore);
-            return;
-        }
-        
-        // LOCK
-        [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:tableLock.e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *e2eToken, NSString *redirectedServer) {
-        
-            [[NCManageDatabase sharedInstance] setE2ETokenLockWithServerUrl:serverUrl fileId:fileId e2eToken:e2eToken];
-            
-            // REMOVE METADATA
-            [communication deleteEndToEndMetadata:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
-                NSLog(@"[LOG] Found metadata and delete");
-            } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-                NSLog(@"[LOG] %@", [NSString stringWithFormat:@"Remove metadata error %d", (int)response.statusCode]);
-            }];
+        dispatch_semaphore_signal(semaphore);
         
-            // MARK
-            [communication markEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
-            
-                // UNLOCK
-                [communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
-                    [[NCManageDatabase sharedInstance] deteleE2ETokenLockWithServerUrl:serverUrl];
-                    dispatch_semaphore_signal(semaphore);
-                } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-                    returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
-                    dispatch_semaphore_signal(semaphore);
-                }];
-            
-            } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
+    } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
             
-                returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_mark_folder_"];
-
-                // UNLOCK
-                [communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
-                    [[NCManageDatabase sharedInstance] deteleE2ETokenLockWithServerUrl:serverUrl];
-                    dispatch_semaphore_signal(semaphore);
-                } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-                    returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
-                    dispatch_semaphore_signal(semaphore);
-                }];
-            }];
-        
-        } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-        
-            returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
-            dispatch_semaphore_signal(semaphore);
-        }];
-        
-    } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
-        
-        returnError = [self getError:response error:error descriptionDefault:@"_error_"];
+        returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_mark_folder_"];
         dispatch_semaphore_signal(semaphore);
+        
     }];
-    
+      
     while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER))
         [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
     
@@ -453,64 +405,41 @@
     [communication setUserAgent:[CCUtility getUserAgent]];
     
     tableE2eEncryptionLock *tableLock = [[NCManageDatabase sharedInstance] getE2ETokenLockWithServerUrl:serverUrl];
-
-    // Read Folder
-    [communication readFolder:serverUrl depth:@"1" withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *tokenReadFolder) {
         
-        if (items.count > 1) {
-            
-            returnError = [NSError errorWithDomain:@"com.nextcloud.nextcloud" code:999 userInfo:[NSDictionary dictionaryWithObject:NSLocalizedString(@"_e2e_error_directory_not_empty_", nil) forKey:NSLocalizedDescriptionKey]];
-            dispatch_semaphore_signal(semaphore);
-            return;
-        }
+    // LOCK
+    [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:tableLock.e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *e2eToken, NSString *redirectedServer) {
         
-        // LOCK
-        [communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:tableLock.e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *e2eToken, NSString *redirectedServer) {
+        [[NCManageDatabase sharedInstance] setE2ETokenLockWithServerUrl:serverUrl fileId:fileId e2eToken:e2eToken];
         
-            [[NCManageDatabase sharedInstance] setE2ETokenLockWithServerUrl:serverUrl fileId:fileId e2eToken:e2eToken];
+        // DELETE MARK
+        [communication deletemarkEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
             
-            // DELETE METADATA
-            [communication deleteEndToEndMetadata:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
-                NSLog(@"[LOG] Found metadata and delete");
+            // UNLOCK
+            [communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
+                [[NCManageDatabase sharedInstance] deteleE2ETokenLockWithServerUrl:serverUrl];
+                dispatch_semaphore_signal(semaphore);
             } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-                NSLog(@"[LOG] %@", [NSString stringWithFormat:@"Remove metadata error %d", (int)response.statusCode]);
+                returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
+                dispatch_semaphore_signal(semaphore);
             }];
-        
-            // DELETE MARK
-            [communication deletemarkEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
             
-                // UNLOCK
-                [communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
-                    [[NCManageDatabase sharedInstance] deteleE2ETokenLockWithServerUrl:serverUrl];
-                    dispatch_semaphore_signal(semaphore);
-                } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-                    returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
-                    dispatch_semaphore_signal(semaphore);
-                }];
-            
-            } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
+        } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
             
-                returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_delete_mark_folder_"];
+            returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_delete_mark_folder_"];
 
-                // UNLOCK
-                [communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
-                    [[NCManageDatabase sharedInstance] deteleE2ETokenLockWithServerUrl:serverUrl];
-                    dispatch_semaphore_signal(semaphore);
-                } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-                    returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
-                    dispatch_semaphore_signal(semaphore);
-                }];
+            // UNLOCK
+            [communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileId:fileId e2eToken:e2eToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
+                [[NCManageDatabase sharedInstance] deteleE2ETokenLockWithServerUrl:serverUrl];
+                dispatch_semaphore_signal(semaphore);
+            } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
+                returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
+                dispatch_semaphore_signal(semaphore);
             }];
-        
-        } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
-        
-            returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
-            dispatch_semaphore_signal(semaphore);
         }];
-    
-    } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
         
-        returnError = [self getError:response error:error descriptionDefault:@"_error_"];
+    } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
+        
+        returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
         dispatch_semaphore_signal(semaphore);
     }];
     

+ 16 - 5
iOSClient/Networking/NCNetworkingNotificationCenter.swift

@@ -37,6 +37,7 @@ import Foundation
     }()
     
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    var viewerQuickLook: NCViewerQuickLook?
     
     //MARK: - Download
 
@@ -69,13 +70,23 @@ import Foundation
                         return
                     }
                     
+                    // Quick Look
+                    if selector == selectorLoadFileQuickLook {
+                        
+                        
+                        let fileNamePath = NSTemporaryDirectory() + metadata.fileNameView
+
+                        CCUtility.copyFile(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView), toPath: fileNamePath)
+
+                        viewerQuickLook = NCViewerQuickLook.init()
+                        viewerQuickLook?.quickLook(url: URL(fileURLWithPath: fileNamePath), viewController: appDelegate.activeMain)
+                        return
+                    }
+                    
                     // open View File
-                    if (selector == selectorLoadFileView || selector == selectorLoadFileViewFavorite || selector == selectorLoadFileInternalView) && UIApplication.shared.applicationState == UIApplication.State.active {
+                    if (selector == selectorLoadFileView || selector == selectorLoadFileViewFavorite) && UIApplication.shared.applicationState == UIApplication.State.active {
                     
-                        var uti = CCUtility.insertTypeFileIconName(metadata.fileNameView, metadata: metadata)
-                        if uti == nil {
-                            uti = ""
-                        } else if uti!.contains("opendocument") && !NCUtility.sharedInstance.isRichDocument(metadata) {
+                        if metadata.contentType.contains("opendocument") && !NCUtility.sharedInstance.isRichDocument(metadata) {
                             metadata.typeFile = k_metadataTypeFile_unknown
                         }
                         

+ 10 - 4
iOSClient/Networking/OCNetworking.m

@@ -1720,7 +1720,8 @@
                 } else {
                     
                     if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive && [appDelegate.reachability isReachable]) {
-                        [[NCContentPresenter shared] messageNotification:@"_error_" description:[NSString stringWithFormat:@"During the function request: %@ the server responded with error %ld password re-entry is required", function, (long)errorCode] delay:k_dismissAfterSecond*2 type:messageTypeError errorCode:errorCode];
+                        NSString *description = [NSString stringWithFormat: NSLocalizedString(@"_error_check_remote_user_", nil), tableAccount.user, tableAccount.url];
+                        [[NCContentPresenter shared] messageNotification:@"_error_" description:description delay:k_dismissAfterSecond*2 type:messageTypeError errorCode:errorCode];
                         [CCUtility setPassword:account password:nil];
                     }
                 }
@@ -1731,7 +1732,8 @@
         } else if ([CCUtility getPassword:account] != nil) {
             
             if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive && [appDelegate.reachability isReachable]) {
-                [[NCContentPresenter shared] messageNotification:@"_error_" description:[NSString stringWithFormat:@"During the function request: %@ the server responded with error %ld password re-entry is required", function, (long)errorCode] delay:k_dismissAfterSecond*2 type:messageTypeError errorCode:errorCode];
+                NSString *description = [NSString stringWithFormat: NSLocalizedString(@"_error_check_remote_user_", nil), tableAccount.user, tableAccount.url];
+                [[NCContentPresenter shared] messageNotification:@"_error_" description:description delay:k_dismissAfterSecond*2 type:messageTypeError errorCode:errorCode];
                 [CCUtility setPassword:account password:nil];
             }
         }
@@ -1864,8 +1866,12 @@
                         trash.trashbinOriginalLocation = itemDto.trashbinOriginalLocation;
                         trash.trashbinDeletionTime = [NSDate dateWithTimeIntervalSince1970:itemDto.trashbinDeletionTime];
 
-                        [CCUtility insertTypeFileIconName:trash.trashbinFileName metadata:(tableMetadata *)trash];
-
+                        NSDictionary *results = [[NCCommunicationCommon sharedInstance] objcGetInternalContenTypeWithFileName:trash.trashbinFileName contentType:@"" directory:itemDto.isDirectory];
+                        
+                        trash.contentType = results[@"contentType"];
+                        trash.iconName = results[@"iconName"];
+                        trash.typeFile = results[@"typeFile"];
+                        
                         [listTrash addObject:trash];
                     }
                 }

+ 4 - 10
iOSClient/Offline/NCOffline.swift

@@ -85,12 +85,8 @@ class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelega
         listLayout = NCListLayout()
         gridLayout = NCGridLayout()
         
-        // Add Refresh Control
-        if #available(iOS 10.0, *) {
-            collectionView.refreshControl = refreshControl
-        } else {
-            collectionView.addSubview(refreshControl)
-        }
+        // Refresh Control
+        collectionView.addSubview(refreshControl)
         
         // Configure Refresh Control
         refreshControl.tintColor = NCBrandColor.sharedInstance.brandText
@@ -397,7 +393,7 @@ class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelega
                     title: NSLocalizedString("_delete_", comment: ""),
                     icon: CCGraphics.changeThemingColorImage(UIImage(named: "trash"), width: 50, height: 50, color: .red),
                     action: { menuAction in
-                        NCNetworking.sharedInstance.deleteMetadata(metadata, user: self.appDelegate.activeUser, userID: self.appDelegate.activeUserID, password: self.appDelegate.activePassword, url: self.appDelegate.activeUrl) { (errorCode, errorDescription) in } 
+                        NCNetworking.sharedInstance.deleteMetadata(metadata, account: self.appDelegate.activeAccount, user: self.appDelegate.activeUser, userID: self.appDelegate.activeUserID, password: self.appDelegate.activePassword, url: self.appDelegate.activeUrl) { (errorCode, errorDescription) in } 
                     }
                 )
             )
@@ -582,9 +578,7 @@ extension NCOffline: UIViewControllerPreviewingDelegate {
         }
         
         viewController.showOpenIn = true
-        if metadata.typeFile == k_metadataTypeFile_document {
-            viewController.showOpenInternalViewer = true
-        }
+        viewController.showOpenQuickLook = NCUtility.sharedInstance.isQuickLookDisplayable(metadata: metadata)
         viewController.showShare = false
         
         return viewController

+ 1 - 1
iOSClient/PeekPop/CCPeekPop.h

@@ -32,7 +32,7 @@
 @property (nonatomic, strong) UIImage *imageFile;
 @property BOOL showShare;
 @property BOOL showOpenIn;
-@property BOOL showOpenInternalViewer;
+@property BOOL showOpenQuickLook;
 
 @property (nonatomic, weak) IBOutlet UILabel *fileName;
 @property (nonatomic, weak) IBOutlet UIImageView *imagePreview;

+ 3 - 3
iOSClient/PeekPop/CCPeekPop.m

@@ -78,9 +78,9 @@
         [items addObject:item];
     }
     
-    if (self.showOpenInternalViewer) {
-        UIPreviewAction *item = [UIPreviewAction actionWithTitle:NSLocalizedString(@"_open_internal_view_", nil) style:UIPreviewActionStyleDefault handler:^(UIPreviewAction *action,  UIViewController *previewViewController) {
-            [[NCMainCommon sharedInstance] downloadOpenWithMetadata:self.metadata selector:selectorLoadFileInternalView];
+    if (self.showOpenQuickLook) {
+        UIPreviewAction *item = [UIPreviewAction actionWithTitle:NSLocalizedString(@"_open_quicklook_", nil) style:UIPreviewActionStyleDefault handler:^(UIPreviewAction *action,  UIViewController *previewViewController) {
+            [[NCMainCommon sharedInstance] downloadOpenWithMetadata:self.metadata selector:selectorLoadFileQuickLook];
         }];
         [items addObject:item];
     }

+ 1 - 4
iOSClient/RichWorkspace/NCViewerRichWorkspaceWebView.swift

@@ -53,10 +53,7 @@ class NCViewerRichWorkspaceWebView: UIViewController, WKNavigationDelegate, WKSc
     }
     
     @objc func keyboardDidShow(notification: Notification) {
-        var safeAreaInsetsBottom: CGFloat = 0
-        if #available(iOS 11.0, *) {
-            safeAreaInsetsBottom = UIApplication.shared.keyWindow!.safeAreaInsets.bottom
-        }
+        let safeAreaInsetsBottom = UIApplication.shared.keyWindow!.safeAreaInsets.bottom
         guard let info = notification.userInfo else { return }
         guard let frameInfo = info[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else { return }
         let keyboardFrame = frameInfo.cgRectValue

+ 0 - 8
iOSClient/ScanDocument/ScanCollectionView.swift

@@ -23,8 +23,6 @@
 
 import UIKit
 
-@available(iOS 11, *)
-
 class DragDropViewController: UIViewController {
     
     //Data Source for collectionViewSource
@@ -369,8 +367,6 @@ class DragDropViewController: UIViewController {
 
 // MARK: - UICollectionViewDataSource Methods
 
-@available(iOS 11, *)
-
 extension DragDropViewController : UICollectionViewDataSource {
     
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
@@ -498,8 +494,6 @@ extension UIImage {
 
 // MARK: - UICollectionViewDragDelegate Methods
 
-@available(iOS 11, *)
-
 extension DragDropViewController : UICollectionViewDragDelegate
 {
     func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
@@ -561,8 +555,6 @@ extension DragDropViewController : UICollectionViewDragDelegate
 
 // MARK: - UICollectionViewDropDelegate Methods
 
-@available(iOS 11, *)
-
 extension DragDropViewController : UICollectionViewDropDelegate {
     
     func collectionView(_ collectionView: UICollectionView, canHandle session: UIDropSession) -> Bool {

+ 1 - 1
iOSClient/Security/NCEndToEndEncryption.m

@@ -31,7 +31,7 @@
 
 #define addName(field, value) X509_NAME_add_entry_by_txt(name, field, MBSTRING_ASC, (unsigned char *)value, -1, -1, 0); NSLog(@"%s: %s", field, value);
 
-#define IV_DELIMITER_ENCODED        @"fA==" // "|" base64 encoded
+#define IV_DELIMITER_ENCODED        @"|" //@"fA==" // "|" base64 encoded
 #define PBKDF2_INTERACTION_COUNT    1024
 #define PBKDF2_KEY_LENGTH           256
 //#define PBKDF2_SALT                 @"$4$YmBjm3hk$Qb74D5IUYwghUmzsMqeNFx5z0/8$"

+ 8 - 1
iOSClient/Security/NCEndToEndMetadata.swift

@@ -22,6 +22,7 @@
 //
 
 import Foundation
+import NCCommunication
 
 class NCEndToEndMetadata : NSObject  {
 
@@ -219,7 +220,13 @@ class NCEndToEndMetadata : NSObject  {
                         
                         // Update metadata on tableMetadata
                         metadata?.fileNameView = encryptedFileAttributes.filename
-                        CCUtility.insertTypeFileIconName(encryptedFileAttributes.filename, metadata: metadata)
+                        
+                        let results = NCCommunicationCommon.sharedInstance.getInternalContenType(fileName: encryptedFileAttributes.filename, contentType: metadata!.contentType, directory: metadata!.directory)
+                        
+                        metadata?.contentType = results.contentType
+                        metadata?.iconName = results.iconName
+                        metadata?.typeFile = results.typeFile
+                                                
                         DispatchQueue.main.async {
                             NCManageDatabase.sharedInstance.addMetadata(metadata!)
                         }

+ 1 - 5
iOSClient/Select/NCSelect.swift

@@ -117,11 +117,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
         gridLayout = NCGridLayout()
         
         // Add Refresh Control
-        if #available(iOS 10.0, *) {
-            collectionView.refreshControl = refreshControl
-        } else {
-            collectionView.addSubview(refreshControl)
-        }
+        collectionView.addSubview(refreshControl)
         
         // Configure Refresh Control
         refreshControl.tintColor = NCBrandColor.sharedInstance.brandText

+ 18 - 13
iOSClient/Settings/CCSettings.m

@@ -47,6 +47,7 @@
     XLFormDescriptor *form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"_settings_", nil)];
     XLFormSectionDescriptor *section;
     XLFormRowDescriptor *row;
+    NSInteger versionServer = [[NCManageDatabase sharedInstance] getServerVersionWithAccount:appDelegate.activeAccount];
     
     form.rowNavigationOptions = XLFormRowNavigationOptionNone;
     
@@ -134,20 +135,24 @@
         [section addFormRow:row];
     }
     
-    // Section : E2EEncryption --------------------------------------------------------------
+    // Section : E2EEncryption From Nextcloud 19 --------------------------------------------------------------
 
-    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_e2e_settings_title_", nil)];
-    [form addFormSection:section];
-    
-    // EndToEnd Encryption
-    NSString *title = [NSString stringWithFormat:@"%@ (%@)",NSLocalizedString(@"_e2e_settings_", nil), NSLocalizedString(@"_experimental_", nil)];
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"e2eEncryption" rowType:XLFormRowDescriptorTypeButton title:title];
-    row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundView;
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
-    [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
-    [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"lock"] width:50 height:50 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
-    row.action.viewControllerClass = [NCManageEndToEndEncryption class];
-    [section addFormRow:row];
+    if (versionServer >= k_nextcloud_version_19_0) {
+        
+        section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_e2e_settings_title_", nil)];
+        [form addFormSection:section];
+        
+        // EndToEnd Encryption
+        NSString *title = [NSString stringWithFormat:@"%@ (%@)",NSLocalizedString(@"_e2e_settings_", nil), NSLocalizedString(@"_experimental_", nil)];
+        row = [XLFormRowDescriptor formRowDescriptorWithTag:@"e2eEncryption" rowType:XLFormRowDescriptorTypeButton title:title];
+        row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundView;
+        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
+        [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
+        [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"lock"] width:50 height:50 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
+        row.action.viewControllerClass = [NCManageEndToEndEncryption class];
+        
+        [section addFormRow:row];
+    }
     
     // Section Advanced -------------------------------------------------
     

+ 1 - 4
iOSClient/Share/NCShare.swift

@@ -257,10 +257,7 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
         appearance.shadowRadius = 25
         appearance.animationduration = 0.25
         appearance.textColor = .darkGray
-        
-        if #available(iOS 11.0, *) {
-            appearance.setupMaskedCorners([.layerMaxXMaxYCorner, .layerMinXMaxYCorner])
-        }
+        appearance.setupMaskedCorners([.layerMaxXMaxYCorner, .layerMinXMaxYCorner])
         
         for item in items {
             if item.displayName != nil && item.displayName != "" {

+ 2 - 6
iOSClient/Share/NCShareCommon.swift

@@ -53,9 +53,7 @@ class NCShareCommon: NSObject {
 //        let globalPoint = shareViewController.view.superview?.convert(shareViewController.view.frame.origin, to: nil)
 //        let constantTrailingAnchor = window.bounds.width - shareViewController.view.bounds.width - globalPoint!.x + 40
 //        var constantBottomAnchor: CGFloat = 10
-//        if #available(iOS 11.0, *) {
-//            constantBottomAnchor = constantBottomAnchor + UIApplication.shared.keyWindow!.safeAreaInsets.bottom
-//        }
+//        constantBottomAnchor = constantBottomAnchor + UIApplication.shared.keyWindow!.safeAreaInsets.bottom
         
         window.addSubview(viewWindow)
         viewWindow.autoresizingMask = [.flexibleWidth, .flexibleHeight]
@@ -99,9 +97,7 @@ class NCShareCommon: NSObject {
 //        let globalPoint = shareViewController.view.superview?.convert(shareViewController.view.frame.origin, to: nil)
 //        let constantTrailingAnchor = window.bounds.width - shareViewController.view.bounds.width - globalPoint!.x + 40
 //        var constantBottomAnchor: CGFloat = 10
-//        if #available(iOS 11.0, *) {
-//            constantBottomAnchor = constantBottomAnchor + UIApplication.shared.keyWindow!.safeAreaInsets.bottom
-//        }
+//        constantBottomAnchor = constantBottomAnchor + UIApplication.shared.keyWindow!.safeAreaInsets.bottom
         
         window.addSubview(viewWindow)
         viewWindow.autoresizingMask = [.flexibleWidth, .flexibleHeight]

+ 1 - 1
iOSClient/Shares/NCShares.m

@@ -140,7 +140,7 @@
         viewController.metadata = metadata;
         viewController.imageFile = cell.fileImageView.image;
         viewController.showOpenIn = false;
-        viewController.showOpenInternalViewer = false;
+        viewController.showOpenQuickLook = false;
         viewController.showShare = false;
         
         return viewController;

BIN
iOSClient/Supporting Files/af.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/ar.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/ast.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/az.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/be.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/bg_BG.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/bn_BD.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/bs.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/ca.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/cy_GB.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/da.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/de.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/el.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/en-GB.lproj/Localizable.strings


+ 7 - 8
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -126,15 +126,14 @@
 "_livephoto_save_"          = "Save Live Photo to photo album";
 "_livephoto_save_error_"    = "Error during save of Live Photo";
 "_file_conflict_num_"       = "file conflict";
-"_files_conflict_num_"      = "file conflicts";
-"_file_conflict_desc_"      = "Which file do you want to keep?\nIf you select both versions, the copied file will have a number added to its name.";
-"_files_conflict_desc_"     = "Which files do you want to keep?\nIf you select both versions, the copied files will have a number added to its name.";
-"_file_conflict_new_"       = "New file";
-"_files_conflict_new_"      = "New files";
-"_file_conflict_exists_"    = "Already existing file";
-"_files_conflict_exists_"   = "Already existing files";
+"_file_conflicts_num_"      = "file conflicts";
+"_file_conflict_desc_"      = "Which files do you want to keep?\nIf you select both versions, the copied file will have a number added to its name.";
+"_file_conflict_new_"       = "New files";
+"_file_conflict_exists_"    = "Already existing files";
+"_file_not_rewite_doc_"     = "It is not possible to overwrite a document but only to create a new one";
 "_move_or_copy_"            = "Move or copy";
 "_copy_"                    = "Copy";
+"_now_"                     = "Now";
 
 // App
 
@@ -446,7 +445,7 @@
 "_copy_files_"                  = "Copy files";
 "_paste_file_"                  = "Paste file";
 "_paste_files_"                 = "Paste files";
-"_open_internal_view_"          = "Open with internal viewer";
+"_open_quicklook_"              = "Open with Quick Look";
 
 "_search_this_folder_"          = "Search in this folder";
 "_search_all_folders_"          = "Search in all folders";

BIN
iOSClient/Supporting Files/eo.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-419.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-AR.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-CL.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-CO.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-CR.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-DO.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-EC.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-GT.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-HN.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-MX.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-NI.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-PA.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-PE.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-PR.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-PY.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-SV.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-UY.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/et_EE.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/eu.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/fa.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/fi-FI.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/fr.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/gl.lproj/Localizable.strings


Some files were not shown because too many files changed in this diff