Browse Source

Version 5.5.3 (#3015)

Marino Faggiana 8 months ago
parent
commit
775af0c58e
100 changed files with 403 additions and 392 deletions
  1. 1 1
      File Provider Extension/FileProviderEnumerator.swift
  2. 6 6
      File Provider Extension/FileProviderExtension+Actions.swift
  3. 1 1
      File Provider Extension/FileProviderExtension+Thumbnail.swift
  4. 3 3
      File Provider Extension/FileProviderExtension.swift
  5. 5 5
      Nextcloud.xcodeproj/project.pbxproj
  6. 1 1
      Share/NCShareExtension.swift
  7. 2 2
      Widget/Dashboard/DashboardData.swift
  8. 2 2
      Widget/Files/FilesData.swift
  9. 3 3
      Widget/Lockscreen/LockscreenData.swift
  10. 9 7
      iOSClient/Activity/NCActivity.swift
  11. 0 2
      iOSClient/Activity/NCActivityCommentView.swift
  12. 5 2
      iOSClient/Activity/NCActivityTableViewCell.swift
  13. 2 2
      iOSClient/AppDelegate.swift
  14. 6 6
      iOSClient/Assistant/Models/NCAssistantTask.swift
  15. 1 1
      iOSClient/Data/NCManageDatabase+Directory.swift
  16. 20 2
      iOSClient/Data/NCManageDatabase+Metadata.swift
  17. 1 1
      iOSClient/Data/NCManageDatabase+Trash.swift
  18. 4 4
      iOSClient/Extensions/UIAlertController+Extension.swift
  19. 1 1
      iOSClient/Favorites/NCFavorite.swift
  20. 2 2
      iOSClient/Files/NCFiles.swift
  21. 2 2
      iOSClient/Groupfolders/NCGroupfolders.swift
  22. 1 1
      iOSClient/Login/NCLoginProvider.swift
  23. 1 3
      iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift
  24. 1 1
      iOSClient/Main/Collection Common/NCCollectionViewCommon+MediaLayout.swift
  25. 21 10
      iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
  26. 1 0
      iOSClient/Main/Collection Common/NCCollectionViewDownloadThumbnail.swift
  27. 8 8
      iOSClient/Main/Create cloud/NCCreateDocument.swift
  28. 9 8
      iOSClient/Main/NCActionCenter.swift
  29. 36 1
      iOSClient/Main/NCMainTabBarController.swift
  30. 1 1
      iOSClient/Media/NCMedia+CollectionViewDataSource.swift
  31. 39 32
      iOSClient/Media/NCMedia+Command.swift
  32. 1 2
      iOSClient/Media/NCMedia+MediaLayout.swift
  33. 6 6
      iOSClient/Media/NCMedia.storyboard
  34. 8 8
      iOSClient/Media/NCMedia.swift
  35. 1 1
      iOSClient/Media/NCMediaDataSource.swift
  36. 1 0
      iOSClient/Media/NCMediaDownloadThumbnaill.swift
  37. 2 2
      iOSClient/Menu/AppDelegate+Menu.swift
  38. 1 1
      iOSClient/Menu/NCCollectionViewCommon+Menu.swift
  39. 1 1
      iOSClient/Menu/NCViewer+Menu.swift
  40. 1 2
      iOSClient/Menu/UIViewController+Menu.swift
  41. 14 24
      iOSClient/Networking/E2EE/NCNetworkingE2EE.swift
  42. 3 3
      iOSClient/Networking/E2EE/NCNetworkingE2EECreateFolder.swift
  43. 2 6
      iOSClient/Networking/E2EE/NCNetworkingE2EEMarkFolder.swift
  44. 51 28
      iOSClient/Networking/NCNetworking+AsyncAwait.swift
  45. 5 6
      iOSClient/Networking/NCNetworking+Download.swift
  46. 3 3
      iOSClient/Networking/NCNetworking+LivePhoto.swift
  47. 1 0
      iOSClient/Networking/NCNetworking+Synchronization.swift
  48. 3 3
      iOSClient/Networking/NCNetworking+Upload.swift
  49. 27 18
      iOSClient/Networking/NCNetworking+WebDAV.swift
  50. 3 1
      iOSClient/Networking/NCNetworking.swift
  51. 2 2
      iOSClient/Networking/NCNetworkingCheckRemoteUser.swift
  52. 1 1
      iOSClient/Networking/NCNetworkingProcess.swift
  53. 19 20
      iOSClient/Networking/NCService.swift
  54. 3 3
      iOSClient/Notification/NCNotification.swift
  55. 4 4
      iOSClient/PushNotification/NCPushNotification.swift
  56. 1 0
      iOSClient/Recent/NCRecent.swift
  57. 2 21
      iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift
  58. 1 1
      iOSClient/RichWorkspace/NCViewerRichWorkspace.swift
  59. 3 2
      iOSClient/SceneDelegate.swift
  60. 1 1
      iOSClient/Select/NCSelect.swift
  61. 9 9
      iOSClient/Settings/Settings/E2EE/NCEndToEndInitialize.swift
  62. 2 2
      iOSClient/Settings/Settings/E2EE/NCManageE2EEView.swift
  63. 8 3
      iOSClient/Settings/Settings/NCSettingsView.swift
  64. 1 1
      iOSClient/Share/NCShare+NCCellDelegate.swift
  65. 3 2
      iOSClient/Share/NCShare.swift
  66. 6 7
      iOSClient/Share/NCShareNetworking.swift
  67. 0 70
      iOSClient/Share/NCSharePaging.swift
  68. 4 4
      iOSClient/Share/NCShareUserCell.swift
  69. 2 2
      iOSClient/Shares/NCShares.swift
  70. BIN
      iOSClient/Supporting Files/af.lproj/Localizable.strings
  71. BIN
      iOSClient/Supporting Files/an.lproj/Localizable.strings
  72. BIN
      iOSClient/Supporting Files/ar.lproj/Localizable.strings
  73. BIN
      iOSClient/Supporting Files/ast.lproj/Localizable.strings
  74. BIN
      iOSClient/Supporting Files/az.lproj/Localizable.strings
  75. BIN
      iOSClient/Supporting Files/be.lproj/Localizable.strings
  76. BIN
      iOSClient/Supporting Files/bg_BG.lproj/Localizable.strings
  77. BIN
      iOSClient/Supporting Files/bn_BD.lproj/Localizable.strings
  78. BIN
      iOSClient/Supporting Files/br.lproj/Localizable.strings
  79. BIN
      iOSClient/Supporting Files/bs.lproj/Localizable.strings
  80. BIN
      iOSClient/Supporting Files/ca.lproj/Localizable.strings
  81. BIN
      iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
  82. BIN
      iOSClient/Supporting Files/cy_GB.lproj/Localizable.strings
  83. BIN
      iOSClient/Supporting Files/da.lproj/Localizable.strings
  84. BIN
      iOSClient/Supporting Files/de.lproj/Localizable.strings
  85. BIN
      iOSClient/Supporting Files/el.lproj/Localizable.strings
  86. BIN
      iOSClient/Supporting Files/en-GB.lproj/Localizable.strings
  87. 2 1
      iOSClient/Supporting Files/en.lproj/Localizable.strings
  88. BIN
      iOSClient/Supporting Files/eo.lproj/Localizable.strings
  89. BIN
      iOSClient/Supporting Files/es-419.lproj/Localizable.strings
  90. BIN
      iOSClient/Supporting Files/es-AR.lproj/Localizable.strings
  91. BIN
      iOSClient/Supporting Files/es-CL.lproj/Localizable.strings
  92. BIN
      iOSClient/Supporting Files/es-CO.lproj/Localizable.strings
  93. BIN
      iOSClient/Supporting Files/es-CR.lproj/Localizable.strings
  94. BIN
      iOSClient/Supporting Files/es-DO.lproj/Localizable.strings
  95. BIN
      iOSClient/Supporting Files/es-EC.lproj/Localizable.strings
  96. BIN
      iOSClient/Supporting Files/es-GT.lproj/Localizable.strings
  97. BIN
      iOSClient/Supporting Files/es-HN.lproj/Localizable.strings
  98. BIN
      iOSClient/Supporting Files/es-MX.lproj/Localizable.strings
  99. BIN
      iOSClient/Supporting Files/es-NI.lproj/Localizable.strings
  100. BIN
      iOSClient/Supporting Files/es-PA.lproj/Localizable.strings

+ 1 - 1
File Provider Extension/FileProviderEnumerator.swift

@@ -160,7 +160,7 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
         let predicate = NSPredicate(format: "account == %@ AND serverUrl == %@", fileProviderData.shared.account, serverUrl)
 
         if pageNumber == 1 {
-            NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: NCKeychain().showHiddenFiles) { _, files, _, error in
+            NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: NCKeychain().showHiddenFiles, account: fileProviderData.shared.account) { _, files, _, error in
                 if error == .success {
                     NCManageDatabase.shared.convertFilesToMetadatas(files, useFirstAsMetadataFolder: true) { metadataFolder, metadatas in
                         /// FOLDER

+ 6 - 6
File Provider Extension/FileProviderExtension+Actions.swift

@@ -33,9 +33,9 @@ extension FileProviderExtension {
         let directoryName = utilityFileSystem.createFileName(directoryName, serverUrl: tableDirectory.serverUrl, account: fileProviderData.shared.account)
         let serverUrlFileName = tableDirectory.serverUrl + "/" + directoryName
 
-        NextcloudKit.shared.createFolder(serverUrlFileName: serverUrlFileName) { _, ocId, _, error in
+        NextcloudKit.shared.createFolder(serverUrlFileName: serverUrlFileName, account: fileProviderData.shared.account) { _, ocId, _, error in
             if error == .success {
-                NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: NCKeychain().showHiddenFiles) { _, files, _, error in
+                NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: NCKeychain().showHiddenFiles, account: fileProviderData.shared.account) { _, files, _, error in
                     if error == .success, let file = files.first {
                         let isDirectoryEncrypted = self.utilityFileSystem.isDirectoryE2EE(file: file)
                         let metadata = NCManageDatabase.shared.convertFileToMetadata(file, isDirectoryE2EE: isDirectoryEncrypted)
@@ -69,7 +69,7 @@ extension FileProviderExtension {
         let serverUrl = metadata.serverUrl
         let fileName = metadata.fileName
 
-        NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName) { account, error in
+        NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName, account: metadata.account) { account, error in
             if error == .success { // || error == kOCErrorServerPathNotFound {
                 let fileNamePath = self.utilityFileSystem.getDirectoryProviderStorageOcId(itemIdentifier.rawValue)
 
@@ -107,7 +107,7 @@ extension FileProviderExtension {
         let serverUrlTo = tableDirectoryTo.serverUrl
         let fileNameTo = serverUrlTo + "/" + itemFrom.filename
 
-        NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNameFrom, serverUrlFileNameDestination: fileNameTo, overwrite: false) { account, error in
+        NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNameFrom, serverUrlFileNameDestination: fileNameTo, overwrite: false, account: metadataFrom.account) { account, error in
             if error == .success {
                 if metadataFrom.directory {
                     NCManageDatabase.shared.deleteDirectoryAndSubDirectory(serverUrl: serverUrlFrom, account: account)
@@ -138,7 +138,7 @@ extension FileProviderExtension {
         let fileNamePathTo = metadata.serverUrl + "/" + itemName
         let ocId = metadata.ocId
 
-        NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePathFrom, serverUrlFileNameDestination: fileNamePathTo, overwrite: false) { account, error in
+        NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePathFrom, serverUrlFileNameDestination: fileNamePathTo, overwrite: false, account: metadata.account) { account, error in
             if error == .success {
                 // Rename metadata
                 NCManageDatabase.shared.renameMetadata(fileNameTo: itemName, ocId: ocId)
@@ -185,7 +185,7 @@ extension FileProviderExtension {
 
         if (favorite == true && metadata.favorite == false) || (favorite == false && metadata.favorite == true) {
             let fileNamePath = utilityFileSystem.getFileNamePath(metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, userId: metadata.userId)
-            NextcloudKit.shared.setFavorite(fileName: fileNamePath, favorite: favorite) { _, error in
+            NextcloudKit.shared.setFavorite(fileName: fileNamePath, favorite: favorite, account: metadata.account) { _, error in
                 if error == .success {
                     guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else {
                         return completionHandler(nil, NSFileProviderError(.noSuchItem))

+ 1 - 1
File Provider Extension/FileProviderExtension+Thumbnail.swift

@@ -38,7 +38,7 @@ extension FileProviderExtension {
             }
             let fileNameIconLocalPath = utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)
 
-            NextcloudKit.shared.downloadPreview(fileId: metadata.fileId, widthPreview: Int(size.width), heightPreview: Int(size.height), etag: metadata.etag) { _ in
+            NextcloudKit.shared.downloadPreview(fileId: metadata.fileId, widthPreview: Int(size.width), heightPreview: Int(size.height), etag: metadata.etag, account: metadata.account) { _ in
             } completion: { _, data, error in
                 if error == .success, let data {
                     do {

+ 3 - 3
File Provider Extension/FileProviderExtension.swift

@@ -195,7 +195,7 @@ class FileProviderExtension: NSFileProviderExtension {
         /// SIGNAL
         fileProviderData.shared.signalEnumerator(ocId: metadata.ocId, type: .update)
 
-        NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in
+        NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, account: metadata.account, requestHandler: { _ in
         }, taskHandler: { task in
             NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId,
                                                        taskIdentifier: task.taskIdentifier)
@@ -254,7 +254,7 @@ class FileProviderExtension: NSFileProviderExtension {
                                                    sessionError: "",
                                                    selector: "",
                                                    status: NCGlobal.shared.metadataStatusUploading)
-        if let task = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: url.path, dateCreationFile: nil, dateModificationFile: nil, session: NCNetworking.shared.sessionManagerUploadBackgroundExtension) {
+        if let task = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: url.path, dateCreationFile: nil, dateModificationFile: nil, account: metadata.account, session: NCNetworking.shared.sessionManagerUploadBackgroundExtension) {
             NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId,
                                                        status: NCGlobal.shared.metadataStatusUploading,
                                                        taskIdentifier: task.taskIdentifier)
@@ -318,7 +318,7 @@ class FileProviderExtension: NSFileProviderExtension {
                 let serverUrlFileName = tableDirectory.serverUrl + "/" + fileName
                 let fileNameLocalPath = self.utilityFileSystem.getDirectoryProviderStorageOcId(ocIdTemp, fileNameView: fileName)
 
-                if let task = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: nil, dateModificationFile: nil, session: NCNetworking.shared.sessionManagerUploadBackgroundExtension) {
+                if let task = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: nil, dateModificationFile: nil, account: metadata.account, session: NCNetworking.shared.sessionManagerUploadBackgroundExtension) {
                     NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId,
                                                                status: NCGlobal.shared.metadataStatusUploading,
                                                                taskIdentifier: task.taskIdentifier)

+ 5 - 5
Nextcloud.xcodeproj/project.pbxproj

@@ -5414,7 +5414,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 13;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEVELOPMENT_TEAM = NKUJUXUJ3B;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -5441,7 +5441,7 @@
 					"@executable_path/Frameworks",
 					"@executable_path/../../Frameworks",
 				);
-				MARKETING_VERSION = 5.5.2;
+				MARKETING_VERSION = 5.5.3;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = "-v";
 				OTHER_LDFLAGS = "";
@@ -5480,7 +5480,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 13;
 				DEVELOPMENT_TEAM = NKUJUXUJ3B;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				ENABLE_TESTABILITY = YES;
@@ -5504,7 +5504,7 @@
 					"@executable_path/Frameworks",
 					"@executable_path/../../Frameworks",
 				);
-				MARKETING_VERSION = 5.5.2;
+				MARKETING_VERSION = 5.5.3;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = "-v";
 				OTHER_LDFLAGS = "";
@@ -5779,7 +5779,7 @@
 			repositoryURL = "https://github.com/nextcloud/NextcloudKit";
 			requirement = {
 				kind = exactVersion;
-				version = 4.0.3;
+				version = 4.0.4;
 			};
 		};
 		F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = {

+ 1 - 1
Share/NCShareExtension.swift

@@ -278,7 +278,7 @@ class NCShareExtension: UIViewController {
     }
 
     @objc func actionCreateFolder() {
-        let alertController = UIAlertController.createFolder(serverUrl: serverUrl, urlBase: activeAccount) { error in
+        let alertController = UIAlertController.createFolder(serverUrl: serverUrl, userBaseUrl: activeAccount) { error in
             guard error != .success else { return }
             self.showAlert(title: "_error_createsubfolders_upload_", description: error.errorDescription)
         }

+ 2 - 2
Widget/Dashboard/DashboardData.swift

@@ -168,7 +168,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
     let titleImage = imagetmp
 
     let options = NKRequestOptions(timeout: 90, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
-    NextcloudKit.shared.getDashboardWidgetsApplication(id, options: options) { _, results, data, error in
+    NextcloudKit.shared.getDashboardWidgetsApplication(id, account: account.account, options: options) { _, results, data, error in
         Task {
             var datas = [DashboardData]()
             var numberItems = 0
@@ -225,7 +225,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
                                     if FileManager().fileExists(atPath: fileNamePath), let image = UIImage(contentsOfFile: fileNamePath) {
                                         icon = image
                                     } else {
-                                        let (_, data, error) = await NCNetworking.shared.downloadPreview(url: url)
+                                        let (_, data, error) = await NCNetworking.shared.downloadPreview(url: url, account: account.account)
                                         if error == .success,
                                            let image = convertDataToImage(data: data, size: CGSize(width: 256, height: 256), fileNameToWrite: fileName) {
                                             icon = image

+ 2 - 2
Widget/Files/FilesData.swift

@@ -190,7 +190,7 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
     }
 
     let options = NKRequestOptions(timeout: 30, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
-    NextcloudKit.shared.searchBodyRequest(serverUrl: account.urlBase, requestBody: requestBody, showHiddenFiles: NCKeychain().showHiddenFiles, options: options) { _, files, data, error in
+    NextcloudKit.shared.searchBodyRequest(serverUrl: account.urlBase, requestBody: requestBody, showHiddenFiles: NCKeychain().showHiddenFiles, account: account.account, options: options) { _, files, data, error in
         Task {
             var datas: [FilesData] = []
             let title = getTitleFilesWidget(account: account)
@@ -223,7 +223,7 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
                 }
                 if image == nil, file.hasPreview {
                     let sizePreview = NCUtility().getSizePreview(width: Int(file.width), height: Int(file.height))
-                    let (_, _, imageIcon, _, _, _) = await NCNetworking.shared.downloadPreview(fileId: file.fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, fileNameIconLocalPath: fileNameIconLocalPath, widthPreview: Int(sizePreview.width), heightPreview: Int(sizePreview.height), sizeIcon: NCGlobal.shared.sizeIcon, options: options)
+                    let (_, _, imageIcon, _, _, _) = await NCNetworking.shared.downloadPreview(fileId: file.fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, fileNameIconLocalPath: fileNameIconLocalPath, widthPreview: Int(sizePreview.width), heightPreview: Int(sizePreview.height), sizeIcon: NCGlobal.shared.sizeIcon, account: account.account, options: options)
                     image = imageIcon
                 }
                 if image == nil {

+ 3 - 3
Widget/Lockscreen/LockscreenData.swift

@@ -52,7 +52,7 @@ func getLockscreenDataEntry(configuration: AccountIntent?, isPreview: Bool, fami
         account = NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "account == %@", accountIdentifier))
     }
 
-    guard let account = account else {
+    guard let account else {
         return completion(LockscreenData(date: Date(), isPlaceholder: true, activity: "", link: URL(string: "https://")!, quotaRelative: 0, quotaUsed: "", quotaTotal: "", error: false))
     }
 
@@ -78,7 +78,7 @@ func getLockscreenDataEntry(configuration: AccountIntent?, isPreview: Bool, fami
     let options = NKRequestOptions(timeout: 90, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
     if #available(iOSApplicationExtension 16.0, *) {
         if family == .accessoryCircular {
-            NextcloudKit.shared.getUserProfile(options: options) { _, userProfile, _, error in
+            NextcloudKit.shared.getUserProfile(account: account.account, options: options) { _, userProfile, _, error in
                 if error == .success, let userProfile = userProfile {
                     if userProfile.quotaRelative > 0 {
                         quotaRelative = Float(userProfile.quotaRelative) / 100
@@ -102,7 +102,7 @@ func getLockscreenDataEntry(configuration: AccountIntent?, isPreview: Bool, fami
                 }
             }
         } else if family == .accessoryRectangular {
-            NextcloudKit.shared.getDashboardWidgetsApplication("activity", options: options) { _, results, _, error in
+            NextcloudKit.shared.getDashboardWidgetsApplication("activity", account: account.account, options: options) { _, results, _, error in
                 var activity: String = NSLocalizedString("_no_data_available_", comment: "")
                 var link = URL(string: "https://")!
                 if error == .success, let result = results?.first {

+ 9 - 7
iOSClient/Activity/NCActivity.swift

@@ -82,7 +82,7 @@ class NCActivity: UIViewController, NCSharePagingContent {
         commentView = Bundle.main.loadNibNamed("NCActivityCommentView", owner: self, options: nil)?.first as? NCActivityCommentView
         commentView?.setup(urlBase: appDelegate, account: activeAccount) { newComment in
             guard let newComment = newComment, !newComment.isEmpty, let metadata = self.metadata else { return }
-            NextcloudKit.shared.putComments(fileId: metadata.fileId, message: newComment) { _, error in
+            NextcloudKit.shared.putComments(fileId: metadata.fileId, message: newComment, account: self.appDelegate.account) { _, error in
                 if error == .success {
                     self.commentView?.newCommentField.text?.removeAll()
                     self.loadComments()
@@ -264,7 +264,7 @@ extension NCActivity: UITableViewDataSource {
                     cell.icon.image = image.withTintColor(NCBrandColor.shared.textColor, renderingMode: .alwaysOriginal)
                 }
             } else {
-                NextcloudKit.shared.downloadContent(serverUrl: activity.icon) { _, data, error in
+                NextcloudKit.shared.downloadContent(serverUrl: activity.icon, account: appDelegate.account) { _, data, error in
                     if error == .success {
                         do {
                             try data!.write(to: NSURL(fileURLWithPath: fileNameLocalPath) as URL, options: .atomic)
@@ -393,7 +393,7 @@ extension NCActivity {
         guard showComments, let metadata = metadata else { return }
         disptachGroup?.enter()
 
-        NextcloudKit.shared.getComments(fileId: metadata.fileId) { _, comments, _, error in
+        NextcloudKit.shared.getComments(fileId: metadata.fileId, account: metadata.account) { _, comments, _, error in
             if error == .success, let comments = comments {
                 NCManageDatabase.shared.addComments(comments, account: metadata.account, objectId: metadata.fileId)
             } else if error.errorCode != NCGlobal.shared.errorResourceNotFound {
@@ -422,7 +422,8 @@ extension NCActivity {
             limit: 1,
             objectId: nil,
             objectType: objectType,
-            previews: true) { task in
+            previews: true,
+            account: appDelegate.account) { task in
                 self.dataSourceTask = task
             } completion: { account, _, activityFirstKnown, activityLastGiven, _, error in
                 defer { disptachGroup.leave() }
@@ -450,7 +451,8 @@ extension NCActivity {
             limit: min(limit, 200),
             objectId: metadata?.fileId,
             objectType: objectType,
-            previews: true) { task in
+            previews: true,
+            account: appDelegate.account) { task in
                 self.dataSourceTask = task
             } completion: { account, activities, activityFirstKnown, activityLastGiven, _, error in
                 defer { disptachGroup.leave() }
@@ -507,7 +509,7 @@ extension NCActivity: NCShareCommentsCellDelegate {
                     alert.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in
                         guard let message = alert.textFields?.first?.text, !message.isEmpty else { return }
 
-                        NextcloudKit.shared.updateComments(fileId: metadata.fileId, messageId: tableComments.messageId, message: message) { _, error in
+                        NextcloudKit.shared.updateComments(fileId: metadata.fileId, messageId: tableComments.messageId, message: message, account: self.appDelegate.account) { _, error in
                             if error == .success {
                                 self.loadComments()
                             } else {
@@ -529,7 +531,7 @@ extension NCActivity: NCShareCommentsCellDelegate {
                 action: { _ in
                     guard let metadata = self.metadata, let tableComments = tableComments else { return }
 
-                    NextcloudKit.shared.deleteComments(fileId: metadata.fileId, messageId: tableComments.messageId) { _, error in
+                    NextcloudKit.shared.deleteComments(fileId: metadata.fileId, messageId: tableComments.messageId, account: metadata.account) { _, error in
                         if error == .success {
                             self.loadComments()
                         } else {

+ 0 - 2
iOSClient/Activity/NCActivityCommentView.swift

@@ -55,6 +55,4 @@ extension NCActivityCommentView: UISearchBarDelegate {
         searchBar.resignFirstResponder()
         completionHandler?(searchBar.text)
     }
-
-    func searchBarTextDidEndEditing(_ searchBar: UISearchBar) { }
 }

+ 5 - 2
iOSClient/Activity/NCActivityTableViewCell.swift

@@ -178,7 +178,7 @@ extension NCActivityTableViewCell: UICollectionViewDataSource {
                         cell.fileId = fileId
                         if !FileManager.default.fileExists(atPath: fileNamePath) {
                             if NCNetworking.shared.downloadThumbnailActivityQueue.operations.filter({ ($0 as? NCOperationDownloadThumbnailActivity)?.fileId == fileId }).isEmpty {
-                                NCNetworking.shared.downloadThumbnailActivityQueue.addOperation(NCOperationDownloadThumbnailActivity(fileId: fileId, fileNamePreviewLocalPath: fileNamePath, cell: cell, collectionView: collectionView))
+                                NCNetworking.shared.downloadThumbnailActivityQueue.addOperation(NCOperationDownloadThumbnailActivity(fileId: fileId, fileNamePreviewLocalPath: fileNamePath, account: appDelegate.account, cell: cell, collectionView: collectionView))
                             }
                         }
                     }
@@ -208,10 +208,12 @@ class NCOperationDownloadThumbnailActivity: ConcurrentOperation {
     var collectionView: UICollectionView?
     var fileNamePreviewLocalPath: String
     var fileId: String
+    var account: String
 
-    init(fileId: String, fileNamePreviewLocalPath: String, cell: NCActivityCollectionViewCell?, collectionView: UICollectionView?) {
+    init(fileId: String, fileNamePreviewLocalPath: String, account: String, cell: NCActivityCollectionViewCell?, collectionView: UICollectionView?) {
         self.fileNamePreviewLocalPath = fileNamePreviewLocalPath
         self.fileId = fileId
+        self.account = account
         self.cell = cell
         self.collectionView = collectionView
     }
@@ -221,6 +223,7 @@ class NCOperationDownloadThumbnailActivity: ConcurrentOperation {
 
         NextcloudKit.shared.downloadPreview(fileId: fileId,
                                             fileNamePreviewLocalPath: fileNamePreviewLocalPath,
+                                            account: account,
                                             options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, imagePreview, _, _, _, error in
             if error == .success, let imagePreview = imagePreview {
                 DispatchQueue.main.async {

+ 2 - 2
iOSClient/AppDelegate.swift

@@ -458,7 +458,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         let account: String = "\(user) \(urlBase)"
 
         NextcloudKit.shared.setup(account: account, user: user, userId: user, password: password, urlBase: urlBase, groupIdentifier: NCBrandOptions.shared.capabilitiesGroup)
-        NextcloudKit.shared.getUserProfile { account, userProfile, _, error in
+        NextcloudKit.shared.getUserProfile(account: account) { account, userProfile, _, error in
             if error == .success, let userProfile {
                 NCManageDatabase.shared.deleteAccount(account)
                 NCManageDatabase.shared.addAccount(account, urlBase: urlBase, user: user, userId: userProfile.userId, password: password)
@@ -512,7 +512,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         }
 
         NCPushNotification.shared.pushNotification()
-        NCService().startRequestServicesServer()
+        NCService().startRequestServicesServer(account: self.account, user: self.user, userId: self.userId)
 
         NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in
             NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Initialize Auto upload with \(items) uploads")

+ 6 - 6
iOSClient/Assistant/Models/NCAssistantTask.swift

@@ -20,6 +20,7 @@ class NCAssistantTask: ObservableObject {
 
     private var tasks: [NKTextProcessingTask] = []
     private let excludedTypeIds = ["OCA\\ContextChat\\TextProcessing\\ContextChatTaskType"]
+    private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
 
     init() {
         load()
@@ -49,7 +50,7 @@ class NCAssistantTask: ObservableObject {
         guard let id = task.id else { return }
         isLoading = true
 
-        NextcloudKit.shared.textProcessingGetTask(taskId: id) { _, task, _, error in
+        NextcloudKit.shared.textProcessingGetTask(taskId: id, account: appDelegate.account) { _, task, _, error in
             self.isLoading = false
 
             if error != .success {
@@ -64,7 +65,7 @@ class NCAssistantTask: ObservableObject {
     func scheduleTask(input: String) {
         isLoading = true
 
-        NextcloudKit.shared.textProcessingSchedule(input: input, typeId: selectedType?.id ?? "", identifier: "assistant") { _, task, _, error in
+        NextcloudKit.shared.textProcessingSchedule(input: input, typeId: selectedType?.id ?? "", identifier: "assistant", account: appDelegate.account) { _, task, _, error in
             self.isLoading = false
 
             if error != .success {
@@ -78,7 +79,6 @@ class NCAssistantTask: ObservableObject {
                 self.tasks.insert(task, at: 0)
                 self.filteredTasks.insert(task, at: 0)
             }
-
         }
     }
 
@@ -86,7 +86,7 @@ class NCAssistantTask: ObservableObject {
         guard let id = task.id else { return }
         isLoading = true
 
-        NextcloudKit.shared.textProcessingDeleteTask(taskId: id) { _, task, _, error in
+        NextcloudKit.shared.textProcessingDeleteTask(taskId: id, account: appDelegate.account) { _, task, _, error in
             self.isLoading = false
 
             if error != .success {
@@ -105,7 +105,7 @@ class NCAssistantTask: ObservableObject {
     private func loadAllTypes() {
         isLoading = true
 
-        NextcloudKit.shared.textProcessingGetTypes { _, types, _, error in
+        NextcloudKit.shared.textProcessingGetTypes(account: appDelegate.account) { _, types, _, error in
             self.isLoading = false
 
             if error != .success {
@@ -130,7 +130,7 @@ class NCAssistantTask: ObservableObject {
     private func loadAllTasks(appId: String = "assistant") {
         isLoading = true
 
-        NextcloudKit.shared.textProcessingTaskList(appId: appId) { _, tasks, _, error in
+        NextcloudKit.shared.textProcessingTaskList(appId: appId, account: appDelegate.account) { _, tasks, _, error in
             self.isLoading = false
 
             if error != .success {

+ 1 - 1
iOSClient/Data/NCManageDatabase+Directory.swift

@@ -91,7 +91,7 @@ extension NCManageDatabase {
             let windowScenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }
             for windowScene in windowScenes {
                 if let controller = windowScene.keyWindow?.rootViewController as? NCMainTabBarController {
-                    controller.filesServerUrl.removeValue(forKey: serverUrl)
+                    controller.navigationCollectionViewCommon.remove(where: { $0.serverUrl == serverUrl})
                 }
             }
         }

+ 20 - 2
iOSClient/Data/NCManageDatabase+Metadata.swift

@@ -206,7 +206,7 @@ extension tableMetadata {
         if directory || isDocumentViewableOnly || isDirectoryE2EE {
             return false
         }
-        return contentType == "com.adobe.pdf" || contentType == "application/pdf" || classFile == NKCommon.TypeClassFile.image.rawValue
+        return isPDF || isImage
     }
 
     var isDeletable: Bool {
@@ -277,7 +277,9 @@ extension tableMetadata {
     }
 
     var isAvailableEditorView: Bool {
-        guard (classFile == NKCommon.TypeClassFile.document.rawValue) && NextcloudKit.shared.isNetworkReachable() else { return false }
+        guard !isPDF,
+              classFile == NKCommon.TypeClassFile.document.rawValue,
+              NextcloudKit.shared.isNetworkReachable() else { return false }
         let utility = NCUtility()
         let directEditingEditors = utility.editorsDirectEditing(account: account, contentType: contentType)
         let richDocumentEditor = utility.isTypeFileRichDocument(self)
@@ -311,6 +313,10 @@ extension tableMetadata {
         return false
     }
 
+    var isPDF: Bool {
+        return (contentType == "application/pdf" || contentType == "com.adobe.pdf")
+    }
+
     /// Returns false if the user is lokced out of the file. I.e. The file is locked but by somone else
     func canUnlock(as user: String) -> Bool {
         return !lock || (lockOwner == user && lockOwnerType == 0)
@@ -837,6 +843,18 @@ extension NCManageDatabase {
         return nil
     }
 
+    func getResultMetadataFromOcId(_ ocId: String?) -> tableMetadata? {
+        guard let ocId else { return nil }
+
+        do {
+            let realm = try Realm()
+            return realm.objects(tableMetadata.self).filter("ocId == %@", ocId).first
+        } catch let error as NSError {
+            NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)")
+        }
+        return nil
+    }
+
     func getMetadataFromFileName(_ fileName: String, serverUrl: String) -> tableMetadata? {
         do {
             let realm = try Realm()

+ 1 - 1
iOSClient/Data/NCManageDatabase+Trash.swift

@@ -117,7 +117,7 @@ extension NCManageDatabase {
         do {
             let realm = try Realm()
             realm.refresh()
-            let results = realm.objects(tableTrash.self).filter("account == %@ AND filePath == %@", account, filePath).sorted(byKeyPath: "date", ascending: false)
+            let results = realm.objects(tableTrash.self).filter("account == %@ AND filePath == %@", account, filePath).sorted(byKeyPath: "trashbinDeletionTime", ascending: false)
             return Array(results.map { tableTrash.init(value: $0) })
         } catch let error as NSError {
             NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)")

+ 4 - 4
iOSClient/Extensions/UIAlertController+Extension.swift

@@ -32,16 +32,16 @@ extension UIAlertController {
     ///   - urlBase: UrlBase object
     ///   - completion: If not` nil` it overrides the default behavior which shows an error using `NCContentPresenter`
     /// - Returns: The presentable alert controller
-    static func createFolder(serverUrl: String, urlBase: NCUserBaseUrl, markE2ee: Bool = false, sceneIdentifier: String? = nil, completion: ((_ error: NKError) -> Void)? = nil) -> UIAlertController {
+    static func createFolder(serverUrl: String, userBaseUrl: NCUserBaseUrl, markE2ee: Bool = false, sceneIdentifier: String? = nil, completion: ((_ error: NKError) -> Void)? = nil) -> UIAlertController {
         let alertController = UIAlertController(title: NSLocalizedString("_create_folder_", comment: ""), message: nil, preferredStyle: .alert)
 
         let okAction = UIAlertAction(title: NSLocalizedString("_save_", comment: ""), style: .default, handler: { _ in
             guard let fileNameFolder = alertController.textFields?.first?.text else { return }
             if markE2ee {
                 Task {
-                    let createFolderResults = await NCNetworking.shared.createFolder(serverUrlFileName: serverUrl + "/" + fileNameFolder)
+                    let createFolderResults = await NCNetworking.shared.createFolder(serverUrlFileName: serverUrl + "/" + fileNameFolder, account: userBaseUrl.account)
                     if createFolderResults.error == .success {
-                        let error = await NCNetworkingE2EEMarkFolder().markFolderE2ee(account: urlBase.account, fileName: fileNameFolder, serverUrl: serverUrl, userId: urlBase.userId)
+                        let error = await NCNetworkingE2EEMarkFolder().markFolderE2ee(account: userBaseUrl.account, fileName: fileNameFolder, serverUrl: serverUrl, userId: userBaseUrl.userId)
                         if error != .success {
                             NCContentPresenter().showError(error: error)
                         }
@@ -50,7 +50,7 @@ extension UIAlertController {
                     }
                 }
             } else {
-                NCNetworking.shared.createFolder(fileName: fileNameFolder, serverUrl: serverUrl, account: urlBase.account, urlBase: urlBase.urlBase, userId: urlBase.userId, overwrite: false, withPush: true, sceneIdentifier: sceneIdentifier) { error in
+                NCNetworking.shared.createFolder(fileName: fileNameFolder, serverUrl: serverUrl, account: userBaseUrl.account, urlBase: userBaseUrl.urlBase, userId: userBaseUrl.userId, overwrite: false, withPush: true, sceneIdentifier: sceneIdentifier) { error in
                     if let completion = completion {
                         completion(error)
                     } else if error != .success {

+ 1 - 1
iOSClient/Favorites/NCFavorite.swift

@@ -68,7 +68,7 @@ class NCFavorite: NCCollectionViewCommon {
     override func reloadDataSourceNetwork(withQueryDB: Bool = false) {
         super.reloadDataSourceNetwork()
 
-        NextcloudKit.shared.listingFavorites(showHiddenFiles: NCKeychain().showHiddenFiles, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { task in
+        NextcloudKit.shared.listingFavorites(showHiddenFiles: NCKeychain().showHiddenFiles, account: self.appDelegate.account, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { task in
             self.dataSourceTask = task
             self.collectionView.reloadData()
         } completion: { account, files, _, error in

+ 2 - 2
iOSClient/Files/NCFiles.swift

@@ -175,7 +175,7 @@ class NCFiles: NCCollectionViewCommon {
     private func networkReadFolder(completion: @escaping(_ tableDirectory: tableDirectory?, _ metadatas: [tableMetadata]?, _ metadatasDifferentCount: Int, _ metadatasModified: Int, _ error: NKError) -> Void) {
         var tableDirectory: tableDirectory?
 
-        NCNetworking.shared.readFile(serverUrlFileName: serverUrl) { task in
+        NCNetworking.shared.readFile(serverUrlFileName: serverUrl, account: appDelegate.account) { task in
             self.dataSourceTask = task
             self.collectionView.reloadData()
         } completion: { account, metadata, error in
@@ -204,7 +204,7 @@ class NCFiles: NCCollectionViewCommon {
                        NCKeychain().isEndToEndEnabled(account: account),
                        !NCNetworkingE2EE().isInUpload(account: account, serverUrl: self.serverUrl) {
                         let lock = NCManageDatabase.shared.getE2ETokenLock(account: account, serverUrl: self.serverUrl)
-                        NCNetworkingE2EE().getMetadata(fileId: metadataFolder.ocId, e2eToken: lock?.e2eToken) { account, version, e2eMetadata, signature, _, error in
+                        NCNetworkingE2EE().getMetadata(fileId: metadataFolder.ocId, e2eToken: lock?.e2eToken, account: account) { account, version, e2eMetadata, signature, _, error in
                             if account == self.appDelegate.account, error == .success, let e2eMetadata = e2eMetadata {
                                 let error = NCEndToEndMetadata().decodeMetadata(e2eMetadata, signature: signature, serverUrl: self.serverUrl, account: account, urlBase: self.appDelegate.urlBase, userId: self.appDelegate.userId)
                                 if error == .success {

+ 2 - 2
iOSClient/Groupfolders/NCGroupfolders.swift

@@ -70,7 +70,7 @@ class NCGroupfolders: NCCollectionViewCommon {
 
         let homeServerUrl = utilityFileSystem.getHomeServer(urlBase: self.appDelegate.urlBase, userId: self.appDelegate.userId)
 
-        NextcloudKit.shared.getGroupfolders(options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { task in
+        NextcloudKit.shared.getGroupfolders(account: self.appDelegate.account, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { task in
             self.dataSourceTask = task
             self.collectionView.reloadData()
         } completion: { account, results, _, error in
@@ -81,7 +81,7 @@ class NCGroupfolders: NCCollectionViewCommon {
                         let mountPoint = groupfolder.mountPoint.hasPrefix("/") ? groupfolder.mountPoint : "/" + groupfolder.mountPoint
                         let serverUrlFileName = homeServerUrl + mountPoint
                         if NCManageDatabase.shared.getMetadataFromDirectory(account: self.appDelegate.account, serverUrl: serverUrlFileName) == nil {
-                            let results = await NCNetworking.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: NCKeychain().showHiddenFiles)
+                            let results = await NCNetworking.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: NCKeychain().showHiddenFiles, account: account)
                             if results.error == .success, let file = results.files.first {
                                 let isDirectoryE2EE = self.utilityFileSystem.isDirectoryE2EE(file: file)
                                 let metadata = NCManageDatabase.shared.convertFileToMetadata(file, isDirectoryE2EE: isDirectoryE2EE)

+ 1 - 1
iOSClient/Login/NCLoginProvider.swift

@@ -167,7 +167,7 @@ extension NCLoginProvider: WKNavigationDelegate {
         let user = username
 
         NextcloudKit.shared.setup(account: account, user: user, userId: user, password: password, urlBase: urlBase)
-        NextcloudKit.shared.getUserProfile { _, userProfile, _, error in
+        NextcloudKit.shared.getUserProfile(account: account) { _, userProfile, _, error in
             if error == .success, let userProfile {
                 NCManageDatabase.shared.deleteAccount(account)
                 NCManageDatabase.shared.addAccount(account, urlBase: urlBase, user: user, userId: userProfile.userId, password: password)

+ 1 - 3
iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift

@@ -58,7 +58,6 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
             pushMetadata(metadata)
         } else {
             let imageIcon = UIImage(contentsOfFile: utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag))
-
             if !metadata.isDirectoryE2EE && (metadata.isImage || metadata.isAudioOrVideo) {
                 var metadatas: [tableMetadata] = []
                 for metadata in dataSource.getMetadataSourceForAllSections() {
@@ -66,8 +65,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
                         metadatas.append(metadata)
                     }
                 }
-                NCViewer().view(viewController: self, metadata: metadata, metadatas: metadatas, imageIcon: imageIcon)
-                return
+                return NCViewer().view(viewController: self, metadata: metadata, metadatas: metadatas, imageIcon: imageIcon)
             } else if metadata.isAvailableEditorView || utilityFileSystem.fileProviderStorageExists(metadata) {
                 NCViewer().view(viewController: self, metadata: metadata, metadatas: [metadata], imageIcon: imageIcon)
             } else if NextcloudKit.shared.isNetworkReachable(),

+ 1 - 1
iOSClient/Main/Collection Common/NCCollectionViewCommon+MediaLayout.swift

@@ -35,7 +35,7 @@ extension NCCollectionViewCommon: NCMediaLayoutDelegate {
     }
 
     func getLayout() -> String? {
-        return NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewFiles, serverUrl: serverUrl)?.layout
+        return self.layoutType
     }
 
     func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, heightForHeaderInSection section: Int) -> Float {

+ 21 - 10
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -57,6 +57,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     var listLayout = NCListLayout()
     var gridLayout = NCGridLayout()
     var mediaLayout = NCMediaLayout()
+    var layoutType = NCGlobal.shared.layoutList
     var literalSearch: String?
     var tabBarSelect: NCCollectionViewCommonSelectTabBar!
     var timerNotificationCenter: Timer?
@@ -171,10 +172,16 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: serverUrl)
         if layoutForView?.layout == NCGlobal.shared.layoutList {
             collectionView?.collectionViewLayout = listLayout
+            self.layoutType = NCGlobal.shared.layoutList
         } else if layoutForView?.layout == NCGlobal.shared.layoutGrid {
             collectionView?.collectionViewLayout = gridLayout
-        } else if layoutForView?.layout == NCGlobal.shared.layoutPhotoRatio || layoutForView?.layout == NCGlobal.shared.layoutPhotoSquare {
+            self.layoutType = NCGlobal.shared.layoutGrid
+        } else if layoutForView?.layout == NCGlobal.shared.layoutPhotoRatio {
             collectionView?.collectionViewLayout = mediaLayout
+            self.layoutType = NCGlobal.shared.layoutPhotoRatio
+        } else if layoutForView?.layout == NCGlobal.shared.layoutPhotoSquare {
+            collectionView?.collectionViewLayout = mediaLayout
+            self.layoutType = NCGlobal.shared.layoutPhotoSquare
         }
 
         // FIXME: iPAD PDF landscape mode iOS 16
@@ -700,6 +707,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
             let list = UIAction(title: NSLocalizedString("_list_", comment: ""), image: utility.loadImage(named: "list.bullet"), state: layoutForView.layout == NCGlobal.shared.layoutList ? .on : .off) { _ in
                 layoutForView.layout = NCGlobal.shared.layoutList
                 self.layoutForView = NCManageDatabase.shared.setLayoutForView(layoutForView: layoutForView)
+                self.layoutType = NCGlobal.shared.layoutList
 
                 self.collectionView.reloadData()
                 self.collectionView.collectionViewLayout.invalidateLayout()
@@ -711,6 +719,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
             let grid = UIAction(title: NSLocalizedString("_icons_", comment: ""), image: utility.loadImage(named: "square.grid.2x2"), state: layoutForView.layout == NCGlobal.shared.layoutGrid ? .on : .off) { _ in
                 layoutForView.layout = NCGlobal.shared.layoutGrid
                 self.layoutForView = NCManageDatabase.shared.setLayoutForView(layoutForView: layoutForView)
+                self.layoutType = NCGlobal.shared.layoutGrid
 
                 self.collectionView.reloadData()
                 self.collectionView.collectionViewLayout.invalidateLayout()
@@ -723,6 +732,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                 UIAction(title: NSLocalizedString("_media_square_", comment: ""), image: utility.loadImage(named: "square.grid.3x3"), state: layoutForView.layout == NCGlobal.shared.layoutPhotoSquare ? .on : .off) { _ in
                     layoutForView.layout = NCGlobal.shared.layoutPhotoSquare
                     self.layoutForView = NCManageDatabase.shared.setLayoutForView(layoutForView: layoutForView)
+                    self.layoutType = NCGlobal.shared.layoutPhotoSquare
 
                     self.collectionView.reloadData()
                     self.collectionView.collectionViewLayout.invalidateLayout()
@@ -734,6 +744,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                 UIAction(title: NSLocalizedString("_media_ratio_", comment: ""), image: utility.loadImage(named: "rectangle.grid.3x2"), state: layoutForView.layout == NCGlobal.shared.layoutPhotoRatio ? .on : .off) { _ in
                     layoutForView.layout = NCGlobal.shared.layoutPhotoRatio
                     self.layoutForView = NCManageDatabase.shared.setLayoutForView(layoutForView: layoutForView)
+                    self.layoutType = NCGlobal.shared.layoutPhotoRatio
 
                     self.collectionView.reloadData()
                     self.collectionView.collectionViewLayout.invalidateLayout()
@@ -1126,7 +1137,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     }
 
     @objc func pasteFilesMenu() {
-        NCActionCenter.shared.pastePasteboard(serverUrl: serverUrl, hudView: tabBarController?.view)
+        NCActionCenter.shared.pastePasteboard(serverUrl: serverUrl, account: appDelegate.account, hudView: tabBarController?.view)
     }
 
     // MARK: - DataSource + NC Endpoint
@@ -1182,7 +1193,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                 self.collectionView.reloadData()
             }
         } else {
-            NCNetworking.shared.searchFiles(urlBase: appDelegate, literal: literalSearch) { task in
+            NCNetworking.shared.searchFiles(urlBase: appDelegate, literal: literalSearch, account: appDelegate.account) { task in
                 self.dataSourceTask = task
                 self.collectionView.reloadData()
             } completion: { metadatas, error in
@@ -1223,10 +1234,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     // MARK: - Push metadata
 
     func pushMetadata(_ metadata: tableMetadata) {
-        guard let filesServerUrl = (tabBarController as? NCMainTabBarController)?.filesServerUrl else { return }
+        guard let navigationCollectionViewCommon = (tabBarController as? NCMainTabBarController)?.navigationCollectionViewCommon else { return }
         let serverUrlPush = utilityFileSystem.stringAppendServerUrl(metadata.serverUrl, addFileName: metadata.fileName)
 
-        if let viewController = filesServerUrl[serverUrlPush], viewController.isViewLoaded {
+        if let viewController = navigationCollectionViewCommon.first(where: { $0.navigationController == self.navigationController && $0.serverUrl == serverUrlPush})?.viewController, viewController.isViewLoaded {
             navigationController?.pushViewController(viewController, animated: true)
         } else {
             if let viewController: NCFiles = UIStoryboard(name: "NCFiles", bundle: nil).instantiateInitialViewController() as? NCFiles {
@@ -1234,7 +1245,9 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                 viewController.serverUrl = serverUrlPush
                 viewController.titlePreviusFolder = navigationItem.title
                 viewController.titleCurrentFolder = metadata.fileNameView
-                filesServerUrl[serverUrlPush] = viewController
+
+                navigationCollectionViewCommon.append(NavigationCollectionViewCommon(serverUrl: serverUrlPush, navigationController: self.navigationController, viewController: viewController))
+
                 navigationController?.pushViewController(viewController, animated: true)
             }
         }
@@ -1243,10 +1256,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     // MARK: - Header size
 
     func isHeaderMenuTransferViewEnabled() -> Bool {
-        if headerMenuTransferView,
-           let metadata = NCManageDatabase.shared.getMetadataFromOcId(NCNetworking.shared.transferInForegorund?.ocId),
-           metadata.isTransferInForeground {
-            return true
+        if headerMenuTransferView {
+            return NCManageDatabase.shared.getResultMetadataFromOcId(NCNetworking.shared.transferInForegorund?.ocId)?.isTransferInForeground ?? false
         }
         return false
     }

+ 1 - 0
iOSClient/Main/Collection Common/NCCollectionViewDownloadThumbnail.swift

@@ -59,6 +59,7 @@ class NCCollectionViewDownloadThumbnail: ConcurrentOperation {
                                             heightPreview: Int(sizePreview.height),
                                             sizeIcon: NCGlobal.shared.sizeIcon,
                                             etag: etagResource,
+                                            account: self.metadata.account,
                                             options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, _, imageIcon, _, etag, error in
             if error == .success, let imageIcon {
                 NCManageDatabase.shared.setMetadataEtagResource(ocId: self.metadata.ocId, etagResource: etag)

+ 8 - 8
iOSClient/Main/Create cloud/NCCreateDocument.swift

@@ -43,7 +43,7 @@ class NCCreateDocument: NSObject {
                 options = NKRequestOptions(customUserAgent: NCUtility().getCustomUserAgentNCText())
             }
 
-            NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: editorId, creatorId: creatorId, templateId: templateId, options: options) { account, url, _, error in
+            NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: editorId, creatorId: creatorId, templateId: templateId, account: appDelegate.account, options: options) { account, url, _, error in
                 guard error == .success, account == self.appDelegate.account, let url = url else {
                     NCContentPresenter().showError(error: error)
                     return
@@ -56,7 +56,7 @@ class NCCreateDocument: NSObject {
 
         } else if editorId == NCGlobal.shared.editorCollabora {
 
-            NextcloudKit.shared.createRichdocuments(path: fileNamePath, templateId: templateId) { account, url, _, error in
+            NextcloudKit.shared.createRichdocuments(path: fileNamePath, templateId: templateId, account: appDelegate.account) { account, url, _, error in
                 guard error == .success, account == self.appDelegate.account, let url = url else {
                     NCContentPresenter().showError(error: error)
                     return
@@ -82,7 +82,7 @@ class NCCreateDocument: NSObject {
                 options = NKRequestOptions(customUserAgent: NCUtility().getCustomUserAgentNCText())
             }
 
-            let results = await textGetListOfTemplates(options: options)
+            let results = await textGetListOfTemplates(account:appDelegate.account, options: options)
             if results.error == .success {
                 for template in results.templates {
                     let temp = NKEditorTemplates()
@@ -120,7 +120,7 @@ class NCCreateDocument: NSObject {
         }
 
         if editorId == NCGlobal.shared.editorCollabora {
-            let results = await getTemplatesRichdocuments(typeTemplate: templateId)
+            let results = await getTemplatesRichdocuments(typeTemplate: templateId, account: appDelegate.account)
             if results.error == .success {
                 for template in results.templates! {
                     let temp = NKEditorTemplates()
@@ -145,19 +145,19 @@ class NCCreateDocument: NSObject {
 
     // MARK: - NextcloudKit async/await
 
-    func textGetListOfTemplates(options: NKRequestOptions = NKRequestOptions()) async -> (account: String, templates: [NKEditorTemplates], data: Data?, error: NKError) {
+    func textGetListOfTemplates(account: String, options: NKRequestOptions = NKRequestOptions()) async -> (account: String, templates: [NKEditorTemplates], data: Data?, error: NKError) {
 
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.NCTextGetListOfTemplates { account, templates, data, error in
+            NextcloudKit.shared.NCTextGetListOfTemplates(account: account) { account, templates, data, error in
                 continuation.resume(returning: (account: account, templates: templates, data: data, error: error))
             }
         })
     }
 
-    func getTemplatesRichdocuments(typeTemplate: String, options: NKRequestOptions = NKRequestOptions()) async -> (account: String, templates: [NKRichdocumentsTemplate]?, data: Data?, error: NKError) {
+    func getTemplatesRichdocuments(typeTemplate: String, account: String, options: NKRequestOptions = NKRequestOptions()) async -> (account: String, templates: [NKRichdocumentsTemplate]?, data: Data?, error: NKError) {
 
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.getTemplatesRichdocuments(typeTemplate: typeTemplate, options: options) { account, templates, data, error in
+            NextcloudKit.shared.getTemplatesRichdocuments(typeTemplate: typeTemplate, account: account, options: options) { account, templates, data, error in
                 continuation.resume(returning: (account: account, templates: templates, data: data, error: error))
             }
         })

+ 9 - 8
iOSClient/Main/NCActionCenter.swift

@@ -209,7 +209,7 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec
         }
         hud.show(in: hudView)
 
-        NextcloudKit.shared.getFileFromFileId(fileId: fileId) { account, file, _, error in
+        NextcloudKit.shared.getFileFromFileId(fileId: fileId, account: account) { account, file, _, error in
 
             hud.dismiss()
             if error != .success {
@@ -227,7 +227,7 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec
                     NCViewer().view(viewController: viewController, metadata: metadata, metadatas: [metadata], imageIcon: nil)
                 } else {
                     hud.show(in: hudView)
-                    NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { request in
+                    NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, account: account, requestHandler: { request in
                         downloadRequest = request
                     }, taskHandler: { _ in
                     }, progressHandler: { progress in
@@ -269,7 +269,7 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec
         var page = page
 
         NCActivityIndicator.shared.start(backgroundView: viewController.view)
-        NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName, queue: .main) { _, metadata, error in
+        NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName, account: metadata.account, queue: .main) { _, metadata, error in
 
             NCActivityIndicator.shared.stop()
 
@@ -428,12 +428,12 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec
 
     // MARK: - Copy & Paste
 
-    func pastePasteboard(serverUrl: String, hudView: UIView?) {
+    func pastePasteboard(serverUrl: String, account: String, hudView: UIView?) {
         var fractionCompleted: Float = 0
         let processor = ParallelWorker(n: 5, titleKey: "_uploading_", totalTasks: nil, hudView: hudView)
 
         func uploadPastePasteboard(fileName: String, serverUrlFileName: String, fileNameLocalPath: String, serverUrl: String, completion: @escaping () -> Void) {
-            NextcloudKit.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath) { request in
+            NextcloudKit.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, account: account) { request in
                 NCNetworking.shared.uploadRequest[fileNameLocalPath] = request
             } progressHandler: { progress in
                 if Float(progress.fractionCompleted) > fractionCompleted || fractionCompleted == 0 {
@@ -484,7 +484,6 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec
               let navigationController = controller.viewControllers?.first as? UINavigationController
         else { return }
         var serverUrlPush = self.utilityFileSystem.getHomeServer(urlBase: appDelegate.urlBase, userId: appDelegate.userId)
-        let filesServerUrl = controller.filesServerUrl
 
         DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
             navigationController.popToRootViewController(animated: false)
@@ -504,7 +503,7 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec
                 guard let dir = subDirs.first else { return }
                 serverUrlPush = serverUrlPush + "/" + dir
 
-                if let viewController = filesServerUrl[serverUrlPush], viewController.isViewLoaded {
+                if let viewController = controller.navigationCollectionViewCommon.first(where: { $0.navigationController == navigationController && $0.serverUrl == serverUrlPush})?.viewController as? NCFiles, viewController.isViewLoaded {
                     viewController.fileNameBlink = fileNameBlink
                     viewController.fileNameOpen = fileNameOpen
                     navigationController.pushViewController(viewController, animated: false)
@@ -514,7 +513,9 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec
                         viewController.serverUrl = serverUrlPush
                         viewController.titleCurrentFolder = String(dir)
                         viewController.navigationItem.backButtonTitle = viewController.titleCurrentFolder
-                        filesServerUrl[serverUrlPush] = viewController
+
+                        controller.navigationCollectionViewCommon.append(NavigationCollectionViewCommon(serverUrl: serverUrlPush, navigationController: navigationController, viewController: viewController))
+
                         if serverUrlPush == serverUrl {
                             viewController.fileNameBlink = fileNameBlink
                             viewController.fileNameOpen = fileNameOpen

+ 36 - 1
iOSClient/Main/NCMainTabBarController.swift

@@ -23,11 +23,28 @@
 
 import UIKit
 
+struct NavigationCollectionViewCommon {
+    var serverUrl: String
+    var navigationController: UINavigationController?
+    var viewController: NCCollectionViewCommon
+}
+
 class NCMainTabBarController: UITabBarController {
     var sceneIdentifier: String = UUID().uuidString
     var documentPickerViewController: NCDocumentPickerViewController?
-    let filesServerUrl = ThreadSafeDictionary<String, NCFiles>()
+    let navigationCollectionViewCommon = ThreadSafeArray<NavigationCollectionViewCommon>()
     let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
+    private var previousIndex: Int?
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        delegate = self
+    }
+
+    override func viewDidAppear(_ animated: Bool) {
+        super.viewDidAppear(animated)
+        previousIndex = selectedIndex
+    }
 
     func currentViewController() -> UIViewController? {
         return (selectedViewController as? UINavigationController)?.topViewController
@@ -48,3 +65,21 @@ class NCMainTabBarController: UITabBarController {
         return serverUrl
     }
 }
+
+extension NCMainTabBarController: UITabBarControllerDelegate {
+    func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
+        if previousIndex == tabBarController.selectedIndex {
+            scrollToTop(viewController: viewController)
+        }
+        previousIndex = tabBarController.selectedIndex
+    }
+
+    private func scrollToTop(viewController: UIViewController) {
+        guard let navigationController = viewController as? UINavigationController,
+              let topViewController = navigationController.topViewController else { return }
+
+        if let scrollView = topViewController.view.subviews.compactMap({ $0 as? UIScrollView }).first {
+            scrollView.setContentOffset(CGPoint(x: 0, y: -scrollView.adjustedContentInset.top), animated: true)
+        }
+    }
+}

+ 1 - 1
iOSClient/Media/NCMedia+CollectionViewDataSource.swift

@@ -47,7 +47,7 @@ extension NCMedia: UICollectionViewDataSource {
         if numberOfItemsInSection == 0 {
             selectOrCancelButton.isHidden = true
             menuButton.isHidden = false
-            gradientView.isHidden = true
+            gradientView.alpha = 0
             activityIndicatorTrailing.constant = 50
         } else if isEditMode {
             selectOrCancelButton.isHidden = false

+ 39 - 32
iOSClient/Media/NCMedia+Command.swift

@@ -22,6 +22,7 @@
 //
 
 import Foundation
+import UIKit
 import NextcloudKit
 
 extension NCMedia {
@@ -85,23 +86,27 @@ extension NCMedia {
 
     func setColor() {
         if isTop {
-            titleDate?.textColor = NCBrandColor.shared.textColor
-            activityIndicator.color = NCBrandColor.shared.textColor
-            selectOrCancelButton.setTitleColor(NCBrandColor.shared.textColor, for: .normal)
-            menuButton.setImage(NCUtility().loadImage(named: "ellipsis", colors: [NCBrandColor.shared.textColor]), for: .normal)
-            gradientView.isHidden = true
+            UIView.animate(withDuration: 0.3) { [self] in
+                gradientView.alpha = 0
+                titleDate?.textColor = NCBrandColor.shared.textColor
+                activityIndicator.color = NCBrandColor.shared.textColor
+                selectOrCancelButton.setTitleColor(NCBrandColor.shared.textColor, for: .normal)
+                menuButton.setImage(NCUtility().loadImage(named: "ellipsis", colors: [NCBrandColor.shared.textColor]), for: .normal)
+            }
         } else {
-            titleDate?.textColor = .white
-            activityIndicator.color = .white
-            selectOrCancelButton.setTitleColor(.white, for: .normal)
-            menuButton.setImage(NCUtility().loadImage(named: "ellipsis", colors: [.white]), for: .normal)
-            gradientView.isHidden = false
+            UIView.animate(withDuration: 0.3) { [self] in
+                gradientView.alpha = 1
+                titleDate?.textColor = .white
+                activityIndicator.color = .white
+                selectOrCancelButton.setTitleColor(.white, for: .normal)
+                menuButton.setImage(NCUtility().loadImage(named: "ellipsis", colors: [.white]), for: .normal)
+            }
         }
     }
 
     func createMenu() {
-        var layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "")
-        var columnPhoto = layoutForView?.columnPhoto ?? 3
+        let layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "")
+        let columnPhoto = layoutForView?.columnPhoto ?? 3
         let layout = layoutForView?.layout ?? NCGlobal.shared.mediaLayoutRatio
         let layoutTitle = (layout == NCGlobal.shared.mediaLayoutRatio) ? NSLocalizedString("_media_square_", comment: "") : NSLocalizedString("_media_ratio_", comment: "")
         let layoutImage = (layout == NCGlobal.shared.mediaLayoutRatio) ? utility.loadImage(named: "square.grid.3x3") : utility.loadImage(named: "rectangle.grid.3x2")
@@ -137,32 +142,16 @@ extension NCMedia {
         let viewLayoutMenu = UIAction(title: layoutTitle, image: layoutImage) { _ in
             if layout == NCGlobal.shared.mediaLayoutRatio {
                 NCManageDatabase.shared.setLayoutForView(account: self.appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", layout: NCGlobal.shared.mediaLayoutSquare)
+                self.layoutType = NCGlobal.shared.mediaLayoutSquare
             } else {
                 NCManageDatabase.shared.setLayoutForView(account: self.appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", layout: NCGlobal.shared.mediaLayoutRatio)
+                self.layoutType = NCGlobal.shared.mediaLayoutRatio
             }
             self.createMenu()
             self.collectionViewReloadData()
         }
 
-        let zoomViewMediaFolder = UIMenu(title: "", options: .displayInline, children: [
-            UIMenu(title: NSLocalizedString("_zoom_", comment: ""), children: [
-                UIAction(title: NSLocalizedString("_zoom_out_", comment: ""), image: utility.loadImage(named: "minus.magnifyingglass"), attributes: self.attributesZoomOut) { _ in
-                    UIView.animate(withDuration: 0.0, animations: {
-                        let column = columnPhoto + 1
-                        NCManageDatabase.shared.setLayoutForView(account: self.appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", columnPhoto: column)
-                        self.createMenu()
-                        self.collectionViewReloadData()
-                    })
-                },
-                UIAction(title: NSLocalizedString("_zoom_in_", comment: ""), image: utility.loadImage(named: "plus.magnifyingglass"), attributes: self.attributesZoomIn) { _ in
-                    UIView.animate(withDuration: 0.0, animations: {
-                        let column = columnPhoto - 1
-                        NCManageDatabase.shared.setLayoutForView(account: self.appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", columnPhoto: column)
-                        self.createMenu()
-                        self.collectionViewReloadData()
-                    })
-                }
-            ]),
+        let viewOptionsMedia = UIMenu(title: "", options: .displayInline, children: [
             UIMenu(title: NSLocalizedString("_media_view_options_", comment: ""), children: [viewFilterMenu, viewLayoutMenu]),
             UIAction(title: NSLocalizedString("_select_media_folder_", comment: ""), image: utility.loadImage(named: "folder"), handler: { _ in
                 guard let navigationController = UIStoryboard(name: "NCSelect", bundle: nil).instantiateInitialViewController() as? UINavigationController,
@@ -174,6 +163,24 @@ extension NCMedia {
             })
         ])
 
+        let zoomOut = UIAction(title: NSLocalizedString("_zoom_out_", comment: ""), image: utility.loadImage(named: "minus.magnifyingglass"), attributes: self.attributesZoomOut) { _ in
+            UIView.animate(withDuration: 0.0, animations: {
+                let column = columnPhoto + 1
+                NCManageDatabase.shared.setLayoutForView(account: self.appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", columnPhoto: column)
+                self.createMenu()
+                self.collectionViewReloadData()
+            })
+        }
+
+        let zoomIn = UIAction(title: NSLocalizedString("_zoom_in_", comment: ""), image: utility.loadImage(named: "plus.magnifyingglass"), attributes: self.attributesZoomIn) { _ in
+            UIView.animate(withDuration: 0.0, animations: {
+                let column = columnPhoto - 1
+                NCManageDatabase.shared.setLayoutForView(account: self.appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", columnPhoto: column)
+                self.createMenu()
+                self.collectionViewReloadData()
+            })
+        }
+
         let playFile = UIAction(title: NSLocalizedString("_play_from_files_", comment: ""), image: utility.loadImage(named: "play.circle")) { _ in
             guard let controller = self.tabBarController as? NCMainTabBarController else { return }
             self.documentPickerViewController = NCDocumentPickerViewController(controller: controller, isViewerMedia: true, allowsMultipleSelection: false, viewController: self)
@@ -195,7 +202,7 @@ extension NCMedia {
             self.present(alert, animated: true)
         }
 
-        menuButton.menu = UIMenu(title: "", children: [zoomViewMediaFolder, playFile, playURL])
+        menuButton.menu = UIMenu(title: "", children: [zoomOut, zoomIn, viewOptionsMedia, playFile, playURL])
     }
 }
 

+ 1 - 2
iOSClient/Media/NCMedia+MediaLayout.swift

@@ -41,8 +41,7 @@ extension NCMedia: NCMediaLayoutDelegate {
     }
 
     func getLayout() -> String? {
-        let layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "")
-        return layoutForView?.layout ?? NCGlobal.shared.mediaLayoutRatio
+        return self.layoutType
     }
 
     func collectionView(_ collectionView: UICollectionView, layout: UICollectionViewLayout, heightForHeaderInSection section: Int) -> Float {

+ 6 - 6
iOSClient/Media/NCMedia.storyboard

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="EFX-fO-Oip">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="EFX-fO-Oip">
     <device id="retina5_9" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -31,7 +31,7 @@
                                     <outlet property="delegate" destination="EFX-fO-Oip" id="s3n-CL-8X2"/>
                                 </connections>
                             </collectionView>
-                            <view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7rV-YL-aM7">
+                            <view userInteractionEnabled="NO" alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7rV-YL-aM7">
                                 <rect key="frame" x="0.0" y="0.0" width="375" height="150"/>
                                 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <constraints>
@@ -52,12 +52,12 @@
                                 <color key="color" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                             </activityIndicatorView>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Enx-va-Bud">
-                                <rect key="frame" x="235" y="65" width="90" height="30"/>
+                                <rect key="frame" x="269" y="65" width="56" height="30"/>
                                 <constraints>
-                                    <constraint firstAttribute="width" constant="90" id="N4t-Eb-vDt"/>
                                     <constraint firstAttribute="height" constant="30" id="YfM-AZ-ws4"/>
                                 </constraints>
-                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
+                                <inset key="contentEdgeInsets" minX="13" minY="0.0" maxX="13" maxY="0.0"/>
                                 <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                 <state key="normal" title="Title"/>
                                 <connections>

+ 8 - 8
iOSClient/Media/NCMedia.swift

@@ -26,7 +26,6 @@ import NextcloudKit
 import RealmSwift
 
 class NCMedia: UIViewController {
-
     @IBOutlet weak var collectionView: UICollectionView!
     @IBOutlet weak var titleDate: UILabel!
     @IBOutlet weak var activityIndicator: UIActivityIndicatorView!
@@ -37,6 +36,7 @@ class NCMedia: UIViewController {
     @IBOutlet weak var gradientView: UIView!
 
     let layout = NCMediaLayout()
+    var layoutType = NCGlobal.shared.mediaLayoutRatio
     var activeAccount = tableAccount()
     var documentPickerViewController: NCDocumentPickerViewController?
     var tabBarSelect: NCMediaSelectTabBar!
@@ -73,6 +73,7 @@ class NCMedia: UIViewController {
         super.viewDidLoad()
 
         view.backgroundColor = .systemBackground
+        activeAccount = NCManageDatabase.shared.getActiveAccount() ?? tableAccount()
 
         collectionView.register(UINib(nibName: "NCSectionFirstHeaderEmptyData", bundle: nil), forSupplementaryViewOfKind: mediaSectionHeader, withReuseIdentifier: "sectionFirstHeaderEmptyData")
         collectionView.register(UINib(nibName: "NCGridMediaCell", bundle: nil), forCellWithReuseIdentifier: "gridCell")
@@ -80,14 +81,13 @@ class NCMedia: UIViewController {
         collectionView.contentInset = UIEdgeInsets(top: insetsTop, left: 0, bottom: 50, right: 0)
         collectionView.backgroundColor = .systemBackground
         collectionView.prefetchDataSource = self
-        // Drag & Drop
-        // Drag & Drop
         collectionView.dragInteractionEnabled = true
         collectionView.dragDelegate = self
         collectionView.dropDelegate = self
 
         layout.sectionInset = UIEdgeInsets(top: 0, left: 2, bottom: 0, right: 2)
         collectionView.collectionViewLayout = layout
+        layoutType = NCManageDatabase.shared.getLayoutForView(account: activeAccount.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "")?.layout ?? NCGlobal.shared.mediaLayoutRatio
 
         tabBarSelect = NCMediaSelectTabBar(tabBarController: self.tabBarController, delegate: self)
 
@@ -100,7 +100,7 @@ class NCMedia: UIViewController {
         selectOrCancelButton.layer.cornerRadius = 15
         selectOrCancelButton.layer.masksToBounds = true
         selectOrCancelButton.setTitle( NSLocalizedString("_select_", comment: ""), for: .normal)
-        selectOrCancelButton.addBlur(style: .systemThinMaterial)
+        selectOrCancelButton.addBlur(style: .systemUltraThinMaterial)
 
         menuButton.backgroundColor = .clear
         menuButton.layer.cornerRadius = 15
@@ -109,15 +109,13 @@ class NCMedia: UIViewController {
         menuButton.configuration = UIButton.Configuration.plain()
         menuButton.setImage(NCUtility().loadImage(named: "ellipsis"), for: .normal)
         menuButton.changesSelectionAsPrimaryAction = false
-        menuButton.addBlur(style: .systemThinMaterial)
+        menuButton.addBlur(style: .systemUltraThinMaterial)
 
         gradient.startPoint = CGPoint(x: 0, y: 0.1)
         gradient.endPoint = CGPoint(x: 0, y: 1)
         gradient.colors = [UIColor.black.withAlphaComponent(UIAccessibility.isReduceTransparencyEnabled ? 0.8 : 0.4).cgColor, UIColor.clear.cgColor]
         gradientView.layer.insertSublayer(gradient, at: 0)
 
-        activeAccount = NCManageDatabase.shared.getActiveAccount() ?? tableAccount()
-
         collectionView.refreshControl = refreshControl
         refreshControl.action(for: .valueChanged) { _ in
             DispatchQueue.global(qos: .userInteractive).async {
@@ -128,6 +126,7 @@ class NCMedia: UIViewController {
 
         NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeUser), object: nil, queue: nil) { _ in
             self.activeAccount = NCManageDatabase.shared.getActiveAccount() ?? tableAccount()
+            self.layoutType = NCManageDatabase.shared.getLayoutForView(account: self.activeAccount.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "")?.layout ?? NCGlobal.shared.mediaLayoutRatio
             if let metadatas = self.metadatas,
                let metadata = metadatas.first {
                 if metadata.account != self.activeAccount.account {
@@ -148,6 +147,7 @@ class NCMedia: UIViewController {
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
 
+
         navigationController?.setMediaAppreance()
     }
 
@@ -206,7 +206,7 @@ class NCMedia: UIViewController {
     override var preferredStatusBarStyle: UIStatusBarStyle {
         if self.traitCollection.userInterfaceStyle == .dark {
             return .lightContent
-       } else if isTop {
+        } else if isTop {
             return .darkContent
         } else {
             return .lightContent

+ 1 - 1
iOSClient/Media/NCMediaDataSource.swift

@@ -126,7 +126,7 @@ extension NCMedia {
         }
         NextcloudKit.shared.nkCommonInstance.writeLog("[DEBUG] Start searchMedia with lessDate \(lessDate), greaterDate \(greaterDate)")
         let options = NKRequestOptions(timeout: timeout, taskDescription: self.taskDescriptionRetrievesProperties, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
-        let results = await NCNetworking.shared.searchMedia(path: mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: NCKeychain().showHiddenFiles, includeHiddenFiles: [], options: options)
+        let results = await NCNetworking.shared.searchMedia(path: mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: NCKeychain().showHiddenFiles, includeHiddenFiles: [], account: activeAccount.account, options: options)
         if results.account != self.activeAccount.account {
             let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "User changed")
             return(lessDate, greaterDate, 0, false, error)

+ 1 - 0
iOSClient/Media/NCMediaDownloadThumbnaill.swift

@@ -55,6 +55,7 @@ class NCMediaDownloadThumbnaill: ConcurrentOperation {
                                             heightPreview: Int(sizePreview.height),
                                             sizeIcon: NCGlobal.shared.sizeIcon,
                                             etag: etagResource,
+                                            account: metadata.account,
                                             options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, imagePreview, _, _, etag, error in
             if error == .success, let imagePreview {
                 NCManageDatabase.shared.setMetadataEtagResource(ocId: self.metadata.ocId, etagResource: etag)

+ 2 - 2
iOSClient/Menu/AppDelegate+Menu.swift

@@ -106,7 +106,7 @@ extension AppDelegate {
         actions.append(
             NCMenuAction(title: titleCreateFolder,
                          icon: imageCreateFolder, action: { _ in
-                             let alertController = UIAlertController.createFolder(serverUrl: serverUrl, urlBase: appDelegate, sceneIdentifier: controller.sceneIdentifier)
+                             let alertController = UIAlertController.createFolder(serverUrl: serverUrl, userBaseUrl: appDelegate, sceneIdentifier: controller.sceneIdentifier)
                              controller.present(alertController, animated: true, completion: nil)
                          }
                         )
@@ -118,7 +118,7 @@ extension AppDelegate {
                 NCMenuAction(title: NSLocalizedString("_create_folder_e2ee_", comment: ""),
                              icon: NCImageCache.images.folderEncrypted,
                              action: { _ in
-                                 let alertController = UIAlertController.createFolder(serverUrl: serverUrl, urlBase: appDelegate, markE2ee: true, sceneIdentifier: controller.sceneIdentifier)
+                                 let alertController = UIAlertController.createFolder(serverUrl: serverUrl, userBaseUrl: appDelegate, markE2ee: true, sceneIdentifier: controller.sceneIdentifier)
                                  controller.present(alertController, animated: true, completion: nil)
                              })
             )

+ 1 - 1
iOSClient/Menu/NCCollectionViewCommon+Menu.swift

@@ -171,7 +171,7 @@ extension NCCollectionViewCommon {
                     icon: utility.loadImage(named: "lock", colors: [NCBrandColor.shared.iconImageColor]),
                     order: 30,
                     action: { _ in
-                        NextcloudKit.shared.markE2EEFolder(fileId: metadata.fileId, delete: true) { _, error in
+                        NextcloudKit.shared.markE2EEFolder(fileId: metadata.fileId, delete: true, account: metadata.account) { _, error in
                             if error == .success {
                                 NCManageDatabase.shared.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", self.appDelegate.account, serverUrl))
                                 NCManageDatabase.shared.setDirectory(serverUrl: serverUrl, encrypted: false, account: metadata.account)

+ 1 - 1
iOSClient/Menu/NCViewer+Menu.swift

@@ -198,7 +198,7 @@ extension NCViewer {
         //
         // PDF
         //
-        if metadata.contentType == "com.adobe.pdf" || metadata.contentType == "application/pdf" {
+        if metadata.isPDF {
             actions.append(
                 NCMenuAction(
                     title: NSLocalizedString("_search_", comment: ""),

+ 1 - 2
iOSClient/Menu/UIViewController+Menu.swift

@@ -61,11 +61,10 @@ extension UIViewController {
     }
 
     func showProfileMenu(userId: String) {
-
         guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
         guard NCGlobal.shared.capabilityServerVersionMajor >= NCGlobal.shared.nextcloudVersion23 else { return }
 
-        NextcloudKit.shared.getHovercard(for: userId) { account, card, _, _ in
+        NextcloudKit.shared.getHovercard(for: userId, account: appDelegate.account) { account, card, _, _ in
             guard let card = card, account == appDelegate.account else { return }
 
             let personHeader = NCMenuAction(

+ 14 - 24
iOSClient/Networking/E2EE/NCNetworkingE2EE.swift

@@ -28,21 +28,18 @@ class NCNetworkingE2EE: NSObject {
     let e2EEApiVersion2 = "v2"
 
     func isInUpload(account: String, serverUrl: String) -> Bool {
-
         let counter = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND (status == %d OR status == %d)", account, serverUrl, NCGlobal.shared.metadataStatusWaitUpload, NCGlobal.shared.metadataStatusUploading)).count
 
         return counter > 0 ? true : false
     }
 
     func generateRandomIdentifier() -> String {
-
         var UUID = NSUUID().uuidString
         UUID = "E2EE" + UUID.replacingOccurrences(of: "-", with: "")
         return UUID
     }
 
     func getOptions() -> NKRequestOptions {
-
         let version = NCGlobal.shared.capabilityE2EEApiVersion == NCGlobal.shared.e2eeVersionV20 ? e2EEApiVersion2 : e2EEApiVersion1
         return NKRequestOptions(version: version)
     }
@@ -51,23 +48,23 @@ class NCNetworkingE2EE: NSObject {
 
     func getMetadata(fileId: String,
                      e2eToken: String?,
+                     account: String,
                      completion: @escaping (_ account: String, _ version: String?, _ e2eMetadata: String?, _ signature: String?, _ data: Data?, _ error: NKError) -> Void) {
-
         switch NCGlobal.shared.capabilityE2EEApiVersion {
         case NCGlobal.shared.e2eeVersionV11, NCGlobal.shared.e2eeVersionV12:
-            NextcloudKit.shared.getE2EEMetadata(fileId: fileId, e2eToken: e2eToken, options: NKRequestOptions(version: e2EEApiVersion1)) { account, e2eMetadata, signature, data, error in
+            NextcloudKit.shared.getE2EEMetadata(fileId: fileId, e2eToken: e2eToken, account: account, options: NKRequestOptions(version: e2EEApiVersion1)) { account, e2eMetadata, signature, data, error in
                 return completion(account, self.e2EEApiVersion1, e2eMetadata, signature, data, error)
             }
         case NCGlobal.shared.e2eeVersionV20:
             var options = NKRequestOptions(version: e2EEApiVersion2)
-            NextcloudKit.shared.getE2EEMetadata(fileId: fileId, e2eToken: e2eToken, options: options) { account, e2eMetadata, signature, data, error in
+            NextcloudKit.shared.getE2EEMetadata(fileId: fileId, e2eToken: e2eToken, account: account, options: options) { account, e2eMetadata, signature, data, error in
                 if error == .success {
                     return completion(account, self.e2EEApiVersion2, e2eMetadata, signature, data, error)
                 } else if error.errorCode == NCGlobal.shared.errorResourceNotFound {
                     return completion(account, self.e2EEApiVersion2, e2eMetadata, signature, data, error)
                 } else {
                     options = NKRequestOptions(version: self.e2EEApiVersion1)
-                    NextcloudKit.shared.getE2EEMetadata(fileId: fileId, e2eToken: e2eToken, options: options) { account, e2eMetadata, signature, data, error in
+                    NextcloudKit.shared.getE2EEMetadata(fileId: fileId, e2eToken: e2eToken, account: account, options: options) { account, e2eMetadata, signature, data, error in
                         completion(account, self.e2EEApiVersion1, e2eMetadata, signature, data, error)
                     }
                 }
@@ -78,10 +75,10 @@ class NCNetworkingE2EE: NSObject {
     }
 
     func getMetadata(fileId: String,
-                     e2eToken: String?) async -> (account: String, version: String?, e2eMetadata: String?, signature: String?, data: Data?, error: NKError) {
-
+                     e2eToken: String?,
+                     account: String) async -> (account: String, version: String?, e2eMetadata: String?, signature: String?, data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            getMetadata(fileId: fileId, e2eToken: e2eToken) { account, version, e2eMetadata, signature, data, error in
+            getMetadata(fileId: fileId, e2eToken: e2eToken, account: account) { account, version, e2eMetadata, signature, data, error in
                 continuation.resume(returning: (account: account, version: version, e2eMetadata: e2eMetadata, signature: signature, data: data, error: error))
             }
         })
@@ -95,7 +92,6 @@ class NCNetworkingE2EE: NSObject {
                         addUserId: String? = nil,
                         removeUserId: String? = nil,
                         updateVersionV1V2: Bool = false) async -> NKError {
-
         var addCertificate: String?
         var method = "POST"
         guard let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", account, serverUrl)) else {
@@ -103,7 +99,7 @@ class NCNetworkingE2EE: NSObject {
         }
 
         if let addUserId {
-            let results = await NCNetworking.shared.getE2EECertificate(user: addUserId, options: NCNetworkingE2EE().getOptions())
+            let results = await NCNetworking.shared.getE2EECertificate(user: addUserId, account: account, options: NCNetworkingE2EE().getOptions())
             if results.error == .success, let certificateUser = results.certificateUser {
                 addCertificate = certificateUser
             } else {
@@ -123,7 +119,7 @@ class NCNetworkingE2EE: NSObject {
         if updateVersionV1V2 {
             method = "PUT"
         } else {
-            let resultsGetE2EEMetadata = await getMetadata(fileId: fileId, e2eToken: e2eToken)
+            let resultsGetE2EEMetadata = await getMetadata(fileId: fileId, e2eToken: e2eToken, account: account)
             if resultsGetE2EEMetadata.error == .success {
                 method = "PUT"
             } else if resultsGetE2EEMetadata.error.errorCode != NCGlobal.shared.errorResourceNotFound {
@@ -166,7 +162,6 @@ class NCNetworkingE2EE: NSObject {
                         addUserId: String? = nil,
                         addCertificate: String? = nil,
                         removeUserId: String? = nil) async -> NKError {
-
         let resultsEncodeMetadata = NCEndToEndMetadata().encodeMetadata(account: account, serverUrl: serverUrl, userId: userId, addUserId: addUserId, addCertificate: addCertificate, removeUserId: removeUserId)
         guard resultsEncodeMetadata.error == .success, let e2eMetadata = resultsEncodeMetadata.metadata else {
             // Client Diagnostic
@@ -174,7 +169,7 @@ class NCNetworkingE2EE: NSObject {
             return resultsEncodeMetadata.error
         }
 
-        let putE2EEMetadataResults = await NCNetworking.shared.putE2EEMetadata(fileId: fileId, e2eToken: e2eToken, e2eMetadata: e2eMetadata, signature: resultsEncodeMetadata.signature, method: method, options: NCNetworkingE2EE().getOptions())
+        let putE2EEMetadataResults = await NCNetworking.shared.putE2EEMetadata(fileId: fileId, e2eToken: e2eToken, e2eMetadata: e2eMetadata, signature: resultsEncodeMetadata.signature, method: method, account: account, options: NCNetworkingE2EE().getOptions())
         guard putE2EEMetadataResults.error == .success else {
             return putE2EEMetadataResults.error
         }
@@ -196,8 +191,7 @@ class NCNetworkingE2EE: NSObject {
                           userId: String,
                           fileId: String,
                           e2eToken: String) async -> NKError {
-
-        let resultsGetE2EEMetadata = await getMetadata(fileId: fileId, e2eToken: e2eToken)
+        let resultsGetE2EEMetadata = await getMetadata(fileId: fileId, e2eToken: e2eToken, account: account)
         guard resultsGetE2EEMetadata.error == .success, let e2eMetadata = resultsGetE2EEMetadata.e2eMetadata else {
             return resultsGetE2EEMetadata.error
         }
@@ -216,10 +210,8 @@ class NCNetworkingE2EE: NSObject {
 
     func lock(account: String,
               serverUrl: String) async -> (fileId: String?, e2eToken: String?, error: NKError) {
-
         var e2eToken: String?
         var e2eCounter = "1"
-
         guard let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", account, serverUrl)) else {
             return (nil, nil, NKError(errorCode: NCGlobal.shared.errorUnexpectedResponseFromDB, errorDescription: "_e2e_error_"))
         }
@@ -233,7 +225,7 @@ class NCNetworkingE2EE: NSObject {
             e2eCounter = "\(counter)"
         }
 
-        let resultsLockE2EEFolder = await NCNetworking.shared.lockE2EEFolder(fileId: directory.fileId, e2eToken: e2eToken, e2eCounter: e2eCounter, method: "POST", options: NCNetworkingE2EE().getOptions())
+        let resultsLockE2EEFolder = await NCNetworking.shared.lockE2EEFolder(fileId: directory.fileId, e2eToken: e2eToken, e2eCounter: e2eCounter, method: "POST", account: account, options: NCNetworkingE2EE().getOptions())
         if resultsLockE2EEFolder.error == .success, let e2eToken = resultsLockE2EEFolder.e2eToken {
             NCManageDatabase.shared.setE2ETokenLock(account: account, serverUrl: serverUrl, fileId: directory.fileId, e2eToken: e2eToken)
         }
@@ -242,12 +234,11 @@ class NCNetworkingE2EE: NSObject {
     }
 
     func unlock(account: String, serverUrl: String) async {
-
         guard let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: account, serverUrl: serverUrl) else {
             return
         }
 
-        let resultsLockE2EEFolder = await NCNetworking.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, e2eCounter: nil, method: "DELETE", options: NCNetworkingE2EE().getOptions())
+        let resultsLockE2EEFolder = await NCNetworking.shared.lockE2EEFolder(fileId: tableLock.fileId, e2eToken: tableLock.e2eToken, e2eCounter: nil, method: "DELETE", account: account, options: NCNetworkingE2EE().getOptions())
         if resultsLockE2EEFolder.error == .success {
             NCManageDatabase.shared.deleteE2ETokenLock(account: account, serverUrl: serverUrl)
         }
@@ -256,12 +247,11 @@ class NCNetworkingE2EE: NSObject {
     }
 
     func unlockAll(account: String) {
-
         guard NCKeychain().isEndToEndEnabled(account: account) else { return }
 
         Task {
             for result in NCManageDatabase.shared.getE2EAllTokenLock(account: account) {
-                let resultsLockE2EEFolder = await NCNetworking.shared.lockE2EEFolder(fileId: result.fileId, e2eToken: result.e2eToken, e2eCounter: nil, method: "DELETE", options: NCNetworkingE2EE().getOptions())
+                let resultsLockE2EEFolder = await NCNetworking.shared.lockE2EEFolder(fileId: result.fileId, e2eToken: result.e2eToken, e2eCounter: nil, method: "DELETE", account: account, options: NCNetworkingE2EE().getOptions())
                 if resultsLockE2EEFolder.error == .success {
                     NCManageDatabase.shared.deleteE2ETokenLock(account: account, serverUrl: result.serverUrl)
                 }

+ 3 - 3
iOSClient/Networking/E2EE/NCNetworkingE2EECreateFolder.swift

@@ -123,7 +123,7 @@ class NCNetworkingE2EECreateFolder: NSObject {
 
         // CREATE FOLDER
         //
-        let resultsCreateFolder = await NCNetworking.shared.createFolder(serverUrlFileName: serverUrlFileName, options: NKRequestOptions(customHeader: ["e2e-token": e2eToken]))
+        let resultsCreateFolder = await NCNetworking.shared.createFolder(serverUrlFileName: serverUrlFileName, account: account, options: NKRequestOptions(customHeader: ["e2e-token": e2eToken]))
         guard resultsCreateFolder.error == .success, let ocId = resultsCreateFolder.ocId, let fileId = utility.ocIdToFileId(ocId: ocId) else {
             await networkingE2EE.unlock(account: account, serverUrl: serverUrl)
             return resultsCreateFolder.error
@@ -131,7 +131,7 @@ class NCNetworkingE2EECreateFolder: NSObject {
 
         // SET FOLDER AS E2EE
         //
-        let resultsMarkE2EEFolder = await NCNetworking.shared.markE2EEFolder(fileId: fileId, delete: false, options: NCNetworkingE2EE().getOptions())
+        let resultsMarkE2EEFolder = await NCNetworking.shared.markE2EEFolder(fileId: fileId, delete: false, account: account, options: NCNetworkingE2EE().getOptions())
         guard resultsMarkE2EEFolder.error == .success  else {
             await networkingE2EE.unlock(account: account, serverUrl: serverUrl)
             return resultsMarkE2EEFolder.error
@@ -143,7 +143,7 @@ class NCNetworkingE2EECreateFolder: NSObject {
 
         // WRITE DB (DIRECTORY - METADATA)
         //
-        let resultsReadFileOrFolder = await NCNetworking.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0")
+        let resultsReadFileOrFolder = await NCNetworking.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", account: account)
         guard resultsReadFileOrFolder.error == .success, let file = resultsReadFileOrFolder.files.first else {
             await networkingE2EE.unlock(account: account, serverUrl: serverUrl)
             return resultsReadFileOrFolder.error

+ 2 - 6
iOSClient/Networking/E2EE/NCNetworkingE2EEMarkFolder.swift

@@ -23,15 +23,11 @@ import Foundation
 import NextcloudKit
 
 class NCNetworkingE2EEMarkFolder: NSObject {
-
     func markFolderE2ee(account: String, fileName: String, serverUrl: String, userId: String) async -> NKError {
-
         let serverUrlFileName = serverUrl + "/" + fileName
-
-        let resultsReadFileOrFolder = await NCNetworking.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0")
+        let resultsReadFileOrFolder = await NCNetworking.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", account: account)
         guard resultsReadFileOrFolder.error == .success, let file = resultsReadFileOrFolder.files.first else { return resultsReadFileOrFolder.error }
-
-        let resultsMarkE2EEFolder = await NCNetworking.shared.markE2EEFolder(fileId: file.fileId, delete: false, options: NCNetworkingE2EE().getOptions())
+        let resultsMarkE2EEFolder = await NCNetworking.shared.markE2EEFolder(fileId: file.fileId, delete: false, account: account, options: NCNetworkingE2EE().getOptions())
         guard resultsMarkE2EEFolder.error == .success else { return resultsMarkE2EEFolder.error }
 
         file.e2eEncrypted = true

+ 51 - 28
iOSClient/Networking/NCNetworking+AsyncAwait.swift

@@ -38,34 +38,39 @@ extension NCNetworking {
 
     func setLivephoto(serverUrlfileNamePath: String,
                       livePhotoFile: String,
+                      account: String,
                       options: NKRequestOptions = NKRequestOptions()) async -> (account: String, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath, livePhotoFile: livePhotoFile, options: options) { account, error in
+            NextcloudKit.shared.setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath, livePhotoFile: livePhotoFile, account: account, options: options) { account, error in
                 continuation.resume(returning: (account: account, error: error))
             }
         })
     }
 
-    func getUserProfile(options: NKRequestOptions = NKRequestOptions()) async -> (account: String, userProfile: NKUserProfile?, data: Data?, error: NKError) {
+    func getUserProfile(account: String,
+                        options: NKRequestOptions = NKRequestOptions()) async -> (account: String, userProfile: NKUserProfile?, data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.getUserProfile(options: options) { account, userProfile, data, error in
+            NextcloudKit.shared.getUserProfile(account: account, options: options) { account, userProfile, data, error in
                 continuation.resume(returning: (account: account, userProfile: userProfile, data: data, error: error))
             }
         })
     }
 
     func sendClientDiagnosticsRemoteOperation(data: Data,
+                                              account: String,
                                               options: NKRequestOptions = NKRequestOptions()) async -> (account: String, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.sendClientDiagnosticsRemoteOperation(data: data, options: options) { account, error in
+            NextcloudKit.shared.sendClientDiagnosticsRemoteOperation(data: data, account: account, options: options) { account, error in
                 continuation.resume(returning: (account: account, error: error))
             }
         })
     }
 
-    func downloadPreview(url: URL, options: NKRequestOptions = NKRequestOptions()) async -> (account: String, data: Data?, error: NKError) {
+    func downloadPreview(url: URL,
+                         account: String,
+                         options: NKRequestOptions = NKRequestOptions()) async -> (account: String, data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.downloadPreview(url: url, options: options) { account, data, error in
+            NextcloudKit.shared.downloadPreview(url: url, account: account, options: options) { account, data, error in
                 continuation.resume(returning: (account: account, data: data, error: error))
             }
         })
@@ -78,18 +83,20 @@ extension NCNetworking {
                          heightPreview: Int = 512,
                          sizeIcon: Int = 512,
                          etag: String? = nil,
+                         account: String,
                          options: NKRequestOptions = NKRequestOptions()) async -> (account: String, imagePreview: UIImage?, imageIcon: UIImage?, imageOriginal: UIImage?, etag: String?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.downloadPreview(fileId: fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, fileNameIconLocalPath: fileNameIconLocalPath, widthPreview: widthPreview, heightPreview: heightPreview, sizeIcon: sizeIcon, etag: etag, options: options) { account, imagePreview, imageIcon, imageOriginal, etag, error in
+            NextcloudKit.shared.downloadPreview(fileId: fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, fileNameIconLocalPath: fileNameIconLocalPath, widthPreview: widthPreview, heightPreview: heightPreview, sizeIcon: sizeIcon, etag: etag, account: account, options: options) { account, imagePreview, imageIcon, imageOriginal, etag, error in
                 continuation.resume(returning: (account: account, imagePreview: imagePreview, imageIcon: imageIcon, imageOriginal: imageOriginal, etag: etag, error: error))
             }
         })
     }
 
     func deleteFileOrFolder(serverUrlFileName: String,
+                            account: String,
                             options: NKRequestOptions = NKRequestOptions()) async -> (account: String, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName, options: options) { account, error in
+            NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName, account: account, options: options) { account, error in
                 continuation.resume(returning: (account: account, error: error))
             }
         })
@@ -98,9 +105,10 @@ extension NCNetworking {
     func moveFileOrFolder(serverUrlFileNameSource: String,
                           serverUrlFileNameDestination: String,
                           overwrite: Bool,
+                          account: String,
                           options: NKRequestOptions = NKRequestOptions()) async -> (account: String, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite, options: options) { account, error in
+            NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite, account: account, options: options) { account, error in
                 continuation.resume(returning: (account: account, error: error))
             }
         })
@@ -109,18 +117,20 @@ extension NCNetworking {
     func copyFileOrFolder(serverUrlFileNameSource: String,
                           serverUrlFileNameDestination: String,
                           overwrite: Bool,
+                          account: String,
                           options: NKRequestOptions = NKRequestOptions()) async -> (account: String, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.copyFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite, options: options) { account, error in
+            NextcloudKit.shared.copyFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite, account: account, options: options) { account, error in
                 continuation.resume(returning: (account: account, error: error))
             }
         })
     }
 
     func createFolder(serverUrlFileName: String,
+                      account: String,
                       options: NKRequestOptions = NKRequestOptions()) async -> (account: String, ocId: String?, date: Date?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.createFolder(serverUrlFileName: serverUrlFileName, options: options) { account, ocId, date, error in
+            NextcloudKit.shared.createFolder(serverUrlFileName: serverUrlFileName, account: account, options: options) { account, ocId, date, error in
                 continuation.resume(returning: (account: account, ocId: ocId, date: date, error: error))
             }
         })
@@ -130,9 +140,10 @@ extension NCNetworking {
                           depth: String,
                           showHiddenFiles: Bool = true,
                           requestBody: Data? = nil,
+                          account: String,
                           options: NKRequestOptions = NKRequestOptions()) async -> (account: String, files: [NKFile], data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: depth, showHiddenFiles: showHiddenFiles, requestBody: requestBody, options: options) { account, files, data, error in
+            NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: depth, showHiddenFiles: showHiddenFiles, requestBody: requestBody, account: account, options: options) { account, files, data, error in
                 continuation.resume(returning: (account: account, files: files, data: data, error: error))
             }
         })
@@ -145,9 +156,10 @@ extension NCNetworking {
                      limit: Int,
                      showHiddenFiles: Bool,
                      includeHiddenFiles: [String] = [],
+                     account: String,
                      options: NKRequestOptions = NKRequestOptions()) async -> (account: String, files: [NKFile], data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.searchMedia(path: path, lessDate: lessDate, greaterDate: greaterDate, elementDate: elementDate, limit: limit, showHiddenFiles: showHiddenFiles, includeHiddenFiles: includeHiddenFiles, options: options) { account, files, data, error in
+            NextcloudKit.shared.searchMedia(path: path, lessDate: lessDate, greaterDate: greaterDate, elementDate: elementDate, limit: limit, showHiddenFiles: showHiddenFiles, includeHiddenFiles: includeHiddenFiles, account: account, options: options) { account, files, data, error in
                 continuation.resume(returning: (account, files, data, error))
             }
         })
@@ -155,9 +167,10 @@ extension NCNetworking {
 
     func markE2EEFolder(fileId: String,
                         delete: Bool,
+                        account: String,
                         options: NKRequestOptions = NKRequestOptions()) async -> (account: String, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.markE2EEFolder(fileId: fileId, delete: delete, options: options) { account, error in
+            NextcloudKit.shared.markE2EEFolder(fileId: fileId, delete: delete, account: account, options: options) { account, error in
                 continuation.resume(returning: (account: account, error: error))
             }
         })
@@ -167,9 +180,10 @@ extension NCNetworking {
                         e2eToken: String?,
                         e2eCounter: String?,
                         method: String,
+                        account: String,
                         options: NKRequestOptions = NKRequestOptions()) async -> (account: String, e2eToken: String?, data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.lockE2EEFolder(fileId: fileId, e2eToken: e2eToken, e2eCounter: e2eCounter, method: method, options: options) { account, e2eToken, data, error in
+            NextcloudKit.shared.lockE2EEFolder(fileId: fileId, e2eToken: e2eToken, e2eCounter: e2eCounter, method: method, account: account, options: options) { account, e2eToken, data, error in
                 continuation.resume(returning: (account: account, e2eToken: e2eToken, data: data, error: error))
             }
         })
@@ -177,9 +191,10 @@ extension NCNetworking {
 
     func getE2EEMetadata(fileId: String,
                          e2eToken: String?,
+                         account: String,
                          options: NKRequestOptions = NKRequestOptions()) async -> (account: String, e2eMetadata: String?, signature: String?, data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.getE2EEMetadata(fileId: fileId, e2eToken: e2eToken, options: options) { account, e2eMetadata, signature, data, error in
+            NextcloudKit.shared.getE2EEMetadata(fileId: fileId, e2eToken: e2eToken, account: account, options: options) { account, e2eMetadata, signature, data, error in
                 continuation.resume(returning: (account: account, e2eMetadata: e2eMetadata, signature: signature, data: data, error: error))
             }
         })
@@ -190,68 +205,76 @@ extension NCNetworking {
                          e2eMetadata: String?,
                          signature: String?,
                          method: String,
+                         account: String,
                          options: NKRequestOptions = NKRequestOptions()) async -> (account: String, metadata: String?, data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.putE2EEMetadata(fileId: fileId, e2eToken: e2eToken, e2eMetadata: e2eMetadata, signature: signature, method: method, options: options) { account, metadata, data, error in
+            NextcloudKit.shared.putE2EEMetadata(fileId: fileId, e2eToken: e2eToken, e2eMetadata: e2eMetadata, signature: signature, method: method, account: account, options: options) { account, metadata, data, error in
                 continuation.resume(returning: (account: account, metadata: metadata, data: data, error: error))
             }
         })
     }
 
     func getE2EECertificate(user: String? = nil,
+                            account: String,
                             options: NKRequestOptions = NKRequestOptions()) async -> (account: String, certificate: String?, certificateUser: String?, data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.getE2EECertificate(user: user, options: options) { account, certificate, certificateUser, data, error in
+            NextcloudKit.shared.getE2EECertificate(user: user, account: account, options: options) { account, certificate, certificateUser, data, error in
                 continuation.resume(returning: (account: account, certificate: certificate, certificateUser: certificateUser, data: data, error: error))
             }
         })
     }
 
-    func getE2EEPrivateKey(options: NKRequestOptions = NKRequestOptions()) async -> (account: String, privateKey: String?, data: Data?, error: NKError) {
+    func getE2EEPrivateKey(account: String,
+                           options: NKRequestOptions = NKRequestOptions()) async -> (account: String, privateKey: String?, data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.getE2EEPrivateKey(options: options) { account, privateKey, data, error in
+            NextcloudKit.shared.getE2EEPrivateKey(account: account, options: options) { account, privateKey, data, error in
                 continuation.resume(returning: (account: account, privateKey: privateKey, data: data, error: error))
             }
         })
     }
 
-    func getE2EEPublicKey(options: NKRequestOptions = NKRequestOptions()) async -> (account: String, publicKey: String?, data: Data?, error: NKError) {
+    func getE2EEPublicKey(account: String,
+                          options: NKRequestOptions = NKRequestOptions()) async -> (account: String, publicKey: String?, data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.getE2EEPublicKey(options: options) { account, publicKey, data, error in
+            NextcloudKit.shared.getE2EEPublicKey(account: account, options: options) { account, publicKey, data, error in
                 continuation.resume(returning: (account: account, publicKey: publicKey, data: data, error: error))
             }
         })
     }
 
     func signE2EECertificate(certificate: String,
+                             account: String,
                              options: NKRequestOptions = NKRequestOptions()) async -> (account: String, certificate: String?, data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.signE2EECertificate(certificate: certificate, options: options) { account, certificate, data, error in
+            NextcloudKit.shared.signE2EECertificate(certificate: certificate, account: account, options: options) { account, certificate, data, error in
                 continuation.resume(returning: (account: account, certificate: certificate, data: data, error: error))
             }
         })
     }
 
     func storeE2EEPrivateKey(privateKey: String,
+                             account: String,
                              options: NKRequestOptions = NKRequestOptions()) async -> (account: String, privateKey: String?, data: Data?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.storeE2EEPrivateKey(privateKey: privateKey, options: options) { account, privateKey, data, error in
+            NextcloudKit.shared.storeE2EEPrivateKey(privateKey: privateKey, account: account, options: options) { account, privateKey, data, error in
                 continuation.resume(returning: (account: account, privateKey: privateKey, data: data, error: error))
             }
         })
     }
 
-    func deleteE2EECertificate(options: NKRequestOptions = NKRequestOptions()) async -> (account: String, error: NKError) {
+    func deleteE2EECertificate(account: String,
+                               options: NKRequestOptions = NKRequestOptions()) async -> (account: String, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.deleteE2EECertificate(options: options) { account, error in
+            NextcloudKit.shared.deleteE2EECertificate(account: account, options: options) { account, error in
                 continuation.resume(returning: (account: account, error: error))
             }
         })
     }
 
-    func deleteE2EEPrivateKey(options: NKRequestOptions = NKRequestOptions()) async -> (account: String, error: NKError) {
+    func deleteE2EEPrivateKey(account: String,
+                              options: NKRequestOptions = NKRequestOptions()) async -> (account: String, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            NextcloudKit.shared.deleteE2EEPrivateKey(options: options) { account, error in
+            NextcloudKit.shared.deleteE2EEPrivateKey(account: account, options: options) { account, error in
                 continuation.resume(returning: (account: account, error: error))
             }
         })

+ 5 - 6
iOSClient/Networking/NCNetworking+Download.swift

@@ -67,7 +67,7 @@ extension NCNetworking {
             NCManageDatabase.shared.addMetadata(metadata)
         }
 
-        NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, options: options, requestHandler: { request in
+        NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, account: metadata.account, options: options, requestHandler: { request in
             self.downloadRequest[fileNameLocalPath] = request
             NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId,
                                                        status: NCGlobal.shared.metadataStatusDownloading)
@@ -126,7 +126,7 @@ extension NCNetworking {
 
         start()
 
-        if let task = nkBackground.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, session: session) {
+        if let task = nkBackground.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, account: metadata.account, session: session) {
             NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Download file \(metadata.fileNameView) with task with taskIdentifier \(task.taskIdentifier)")
             NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId,
                                                        status: NCGlobal.shared.metadataStatusDownloading,
@@ -273,18 +273,17 @@ extension NCNetworking {
                         cell: NCCellProtocol,
                         view: UIView?) {
         let fileNameLocalPath = utilityFileSystem.directoryUserData + "/" + fileName
+        guard let tableAccount = NCManageDatabase.shared.getActiveAccount() else { return }
 
         if let image = NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) {
             cell.fileAvatarImageView?.image = image
             return
         }
 
-        if let account = NCManageDatabase.shared.getActiveAccount() {
-            cell.fileAvatarImageView?.image = utility.loadUserImage(for: user, displayName: dispalyName, userBaseUrl: account)
-        }
+        cell.fileAvatarImageView?.image = utility.loadUserImage(for: user, displayName: dispalyName, userBaseUrl: tableAccount)
 
         for case let operation as NCOperationDownloadAvatar in downloadAvatarQueue.operations where operation.fileName == fileName { return }
-        downloadAvatarQueue.addOperation(NCOperationDownloadAvatar(user: user, fileName: fileName, fileNameLocalPath: fileNameLocalPath, cell: cell, view: view))
+        downloadAvatarQueue.addOperation(NCOperationDownloadAvatar(user: user, fileName: fileName, fileNameLocalPath: fileNameLocalPath, account: tableAccount.account, cell: cell, view: view))
     }
 #endif
 

+ 3 - 3
iOSClient/Networking/NCNetworking+LivePhoto.swift

@@ -41,7 +41,7 @@ extension NCNetworking {
         Task {
             let serverUrlfileNamePath = metadata.urlBase + metadata.path + metadata.fileName
             var livePhotoFile = metadata1.fileId
-            let results = await setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath, livePhotoFile: livePhotoFile)
+            let results = await setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath, livePhotoFile: livePhotoFile, account: metadata.account)
             if results.error == .success {
                 NCManageDatabase.shared.setMetadataLivePhotoByServer(account: metadata.account, ocId: metadata.ocId, livePhotoFile: livePhotoFile)
             } else {
@@ -50,7 +50,7 @@ extension NCNetworking {
 
             let serverUrlfileNamePath1 = metadata1.urlBase + metadata1.path + metadata1.fileName
             livePhotoFile = metadata.fileId
-            let results1 = await setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath1, livePhotoFile: livePhotoFile)
+            let results1 = await setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath1, livePhotoFile: livePhotoFile, account: metadata1.account)
             if results1.error == .success {
                 NCManageDatabase.shared.setMetadataLivePhotoByServer(account: metadata1.account, ocId: metadata1.ocId, livePhotoFile: livePhotoFile)
             } else {
@@ -98,7 +98,7 @@ class NCOperationConvertLivePhoto: ConcurrentOperation {
             return self.finish()
         }
 
-        NextcloudKit.shared.setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath, livePhotoFile: livePhotoFile, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, error in
+        NextcloudKit.shared.setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath, livePhotoFile: livePhotoFile, account: account, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, error in
             if error == .success {
                 NCManageDatabase.shared.setMetadataLivePhotoByServer(account: self.account, ocId: self.ocId, livePhotoFile: self.livePhotoFile)
             } else {

+ 1 - 0
iOSClient/Networking/NCNetworking+Synchronization.swift

@@ -38,6 +38,7 @@ extension NCNetworking {
         NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl,
                                              depth: "infinity",
                                              showHiddenFiles: NCKeychain().showHiddenFiles,
+                                             account: account,
                                              options: options) { resultAccount, files, _, error in
             guard account == resultAccount else { return }
             var metadatasDirectory: [tableMetadata] = []

+ 3 - 3
iOSClient/Networking/NCNetworking+Upload.swift

@@ -117,7 +117,7 @@ extension NCNetworking {
         let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
         let options = NKRequestOptions(customHeader: customHeaders, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
 
-        NextcloudKit.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: metadata.creationDate as Date, dateModificationFile: metadata.date as Date, options: options, requestHandler: { request in
+        NextcloudKit.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: metadata.creationDate as Date, dateModificationFile: metadata.date as Date, account: metadata.account, options: options, requestHandler: { request in
 
             self.uploadRequest[fileNameLocalPath] = request
             NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId,
@@ -178,7 +178,7 @@ extension NCNetworking {
         }
         let options = NKRequestOptions(customHeader: customHeaders, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
 
-        NextcloudKit.shared.uploadChunk(directory: directory, fileName: metadata.fileName, date: metadata.date as Date, creationDate: metadata.creationDate as Date, serverUrl: metadata.serverUrl, chunkFolder: chunkFolder, filesChunk: filesChunk, chunkSize: chunkSize, options: options) { num in
+        NextcloudKit.shared.uploadChunk(directory: directory, fileName: metadata.fileName, date: metadata.date as Date, creationDate: metadata.creationDate as Date, serverUrl: metadata.serverUrl, chunkFolder: chunkFolder, filesChunk: filesChunk, chunkSize: chunkSize, account: metadata.account, options: options) { num in
             numChunks(num)
         } counterChunk: { counter in
             counterChunk(counter)
@@ -249,7 +249,7 @@ extension NCNetworking {
             NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
             completion(NKError(errorCode: NCGlobal.shared.errorResourceNotFound, errorDescription: NSLocalizedString("_error_not_found_", value: "The requested resource could not be found", comment: "")))
         } else {
-            if let task = nkBackground.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: metadata.creationDate as Date, dateModificationFile: metadata.date as Date, session: session!) {
+            if let task = nkBackground.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: metadata.creationDate as Date, dateModificationFile: metadata.date as Date, account: metadata.account, session: session!) {
 
                 NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Upload file \(metadata.fileNameView) with task with taskIdentifier \(task.taskIdentifier)")
                 NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId,

+ 27 - 18
iOSClient/Networking/NCNetworking+WebDAV.swift

@@ -41,6 +41,7 @@ extension NCNetworking {
                                              depth: "1",
                                              showHiddenFiles: NCKeychain().showHiddenFiles,
                                              includeHiddenFiles: NCGlobal.shared.includeHiddenFiles,
+                                             account: account,
                                              options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { task in
             taskHandler(task)
         } completion: { account, files, _, error in
@@ -74,12 +75,13 @@ extension NCNetworking {
 
     func readFile(serverUrlFileName: String,
                   showHiddenFiles: Bool = NCKeychain().showHiddenFiles,
+                  account: String,
                   queue: DispatchQueue = NextcloudKit.shared.nkCommonInstance.backgroundQueue,
                   taskHandler: @escaping (_ task: URLSessionTask) -> Void = { _ in },
                   completion: @escaping (_ account: String, _ metadata: tableMetadata?, _ error: NKError) -> Void) {
         let options = NKRequestOptions(queue: queue)
 
-        NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: showHiddenFiles, options: options) { task in
+        NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: showHiddenFiles, account: account, options: options) { task in
             taskHandler(task)
         } completion: { account, files, _, error in
             guard error == .success, files.count == 1, let file = files.first else {
@@ -94,11 +96,13 @@ extension NCNetworking {
     }
 
     func fileExists(serverUrlFileName: String,
+                    account: String,
                     completion: @escaping (_ account: String, _ exists: Bool?, _ file: NKFile?, _ error: NKError) -> Void) {
         let options = NKRequestOptions(timeout: 10, createProperties: [], queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
 
         NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName,
                                              depth: "0",
+                                             account: account,
                                              options: options) { account, files, _, error in
             if error == .success, let file = files.first {
                 completion(account, true, file, error)
@@ -110,9 +114,9 @@ extension NCNetworking {
         }
     }
 
-    func fileExists(serverUrlFileName: String) async -> (account: String, exists: Bool?, file: NKFile?, error: NKError) {
+    func fileExists(serverUrlFileName: String, account: String) async -> (account: String, exists: Bool?, file: NKFile?, error: NKError) {
         await withUnsafeContinuation({ continuation in
-            fileExists(serverUrlFileName: serverUrlFileName) { account, exists, file, error in
+            fileExists(serverUrlFileName: serverUrlFileName, account: account) { account, exists, file, error in
                 continuation.resume(returning: (account, exists, file, error))
             }
         })
@@ -159,7 +163,7 @@ extension NCNetworking {
                 newFileName()
                 continue
             }
-            let results = await fileExists(serverUrlFileName: serverUrl + "/" + resultFileName)
+            let results = await fileExists(serverUrlFileName: serverUrl + "/" + resultFileName, account: account)
             if let exists = results.exists, exists {
                 newFileName()
             } else {
@@ -218,7 +222,7 @@ extension NCNetworking {
         }
         let fileNameFolderUrl = serverUrl + "/" + fileNameFolder
 
-        NextcloudKit.shared.createFolder(serverUrlFileName: fileNameFolderUrl) { account, _, _, error in
+        NextcloudKit.shared.createFolder(serverUrlFileName: fileNameFolderUrl, account: account) { account, _, _, error in
             guard error == .success else {
                 if error.errorCode == NCGlobal.shared.errorMethodNotSupported && overwrite {
                     completion(NKError())
@@ -228,7 +232,7 @@ extension NCNetworking {
                 return
             }
 
-            self.readFile(serverUrlFileName: fileNameFolderUrl) { account, metadataFolder, error in
+            self.readFile(serverUrlFileName: fileNameFolderUrl, account: account) { account, metadataFolder, error in
                 if error == .success {
                     if let metadata = metadataFolder {
                         NCManageDatabase.shared.addMetadata(metadata)
@@ -374,7 +378,7 @@ extension NCNetworking {
         }
         let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
         let options = NKRequestOptions(customHeader: customHeader)
-        let result = await NCNetworking.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName, options: options)
+        let result = await NCNetworking.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName, account: metadata.account ,options: options)
 
         if result.error == .success || result.error.errorCode == NCGlobal.shared.errorResourceNotFound {
             do {
@@ -466,7 +470,7 @@ extension NCNetworking {
         let fileNamePath = metadata.serverUrl + "/" + metadata.fileName
         let fileNameToPath = metadata.serverUrl + "/" + fileNameNew
 
-        NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePath, serverUrlFileNameDestination: fileNameToPath, overwrite: false) { _, error in
+        NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePath, serverUrlFileNameDestination: fileNameToPath, overwrite: false, account: metadata.account) { _, error in
             if error == .success {
                 NCManageDatabase.shared.renameMetadata(fileNameTo: fileNameNew, ocId: metadata.ocId)
                 if metadata.directory {
@@ -514,7 +518,7 @@ extension NCNetworking {
         let serverUrlFileNameSource = metadata.serverUrl + "/" + metadata.fileName
         let serverUrlFileNameDestination = serverUrlTo + "/" + metadata.fileName
 
-        let result = await NCNetworking.shared.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite)
+        let result = await NCNetworking.shared.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite, account: metadata.account)
         if result.error == .success {
             if metadata.directory {
                 NCManageDatabase.shared.deleteDirectoryAndSubDirectory(serverUrl: utilityFileSystem.stringAppendServerUrl(metadata.serverUrl, addFileName: metadata.fileName), account: result.account)
@@ -561,7 +565,7 @@ extension NCNetworking {
         let serverUrlFileNameSource = metadata.serverUrl + "/" + metadata.fileName
         let serverUrlFileNameDestination = serverUrlTo + "/" + metadata.fileName
 
-        let result = await NCNetworking.shared.copyFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite)
+        let result = await NCNetworking.shared.copyFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite, account: metadata.account)
         return result.error
     }
 
@@ -588,7 +592,7 @@ extension NCNetworking {
         let favorite = !metadata.favorite
         let ocId = metadata.ocId
 
-        NextcloudKit.shared.setFavorite(fileName: fileName, favorite: favorite) { account, error in
+        NextcloudKit.shared.setFavorite(fileName: fileName, favorite: favorite, account: metadata.account) { account, error in
             if error == .success && metadata.account == account {
                 metadata.favorite = favorite
                 NCManageDatabase.shared.addMetadata(metadata)
@@ -601,14 +605,14 @@ extension NCNetworking {
     // MARK: - Lock Files
 
     func lockUnlockFile(_ metadata: tableMetadata, shoulLock: Bool) {
-        NextcloudKit.shared.lockUnlockFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName, shouldLock: shoulLock) { _, error in
+        NextcloudKit.shared.lockUnlockFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName, shouldLock: shoulLock, account: metadata.account) { _, error in
             // 0: lock was successful; 412: lock did not change, no error, refresh
             guard error == .success || error.errorCode == NCGlobal.shared.errorPreconditionFailed else {
                 let error = NKError(errorCode: error.errorCode, errorDescription: "_files_lock_error_")
                 NCContentPresenter().messageNotification(metadata.fileName, error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
                 return
             }
-            NCNetworking.shared.readFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName) { _, metadata, error in
+            NCNetworking.shared.readFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName, account: metadata.account) { _, metadata, error in
                 guard error == .success, let metadata = metadata else { return }
                 NCManageDatabase.shared.addMetadata(metadata)
                 NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource)
@@ -629,7 +633,7 @@ extension NCNetworking {
         } else if utilityFileSystem.fileProviderStorageExists(metadata) {
             completition(URL(fileURLWithPath: utilityFileSystem.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)), false, .success)
         } else {
-            NextcloudKit.shared.getDirectDownload(fileId: metadata.fileId) { _, url, _, error in
+            NextcloudKit.shared.getDirectDownload(fileId: metadata.fileId, account: metadata.account) { _, url, _, error in
                 if error == .success && url != nil {
                     if let url = URL(string: url!) {
                         completition(url, false, error)
@@ -648,12 +652,14 @@ extension NCNetworking {
     /// WebDAV search
     func searchFiles(urlBase: NCUserBaseUrl,
                      literal: String,
+                     account: String,
                      taskHandler: @escaping (_ task: URLSessionTask) -> Void = { _ in },
                      completion: @escaping (_ metadatas: [tableMetadata]?, _ error: NKError) -> Void) {
         NextcloudKit.shared.searchLiteral(serverUrl: urlBase.urlBase,
                                           depth: "infinity",
                                           literal: literal,
                                           showHiddenFiles: NCKeychain().showHiddenFiles,
+                                          account: account,
                                           options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { task in
             taskHandler(task)
         } completion: { _, files, _, error in
@@ -680,7 +686,7 @@ extension NCNetworking {
             completion(userBaseUrl.account, NKError())
         }
 
-        NextcloudKit.shared.unifiedSearch(term: literal, timeout: 30, timeoutProvider: 90) { _ in
+        NextcloudKit.shared.unifiedSearch(term: literal, timeout: 30, timeoutProvider: 90, account: userBaseUrl.account) { _ in
             // example filter
             // ["calendar", "files", "fulltextsearch"].contains(provider.id)
             return true
@@ -752,7 +758,7 @@ extension NCNetworking {
                                     completion: @escaping (_ account: String, _ searchResult: NKSearchResult?, _ metadatas: [tableMetadata]?, _ error: NKError) -> Void) {
         var metadatas: [tableMetadata] = []
 
-        let request = NextcloudKit.shared.searchProvider(id, account: userBaseUrl.account, term: term, limit: limit, cursor: cursor, timeout: 60) { task in
+        let request = NextcloudKit.shared.searchProvider(id, term: term, limit: limit, cursor: cursor, timeout: 60, account: userBaseUrl.account) { task in
             taskHandler(task)
         } completion: { account, searchResult, _, error in
             guard let searchResult = searchResult else {
@@ -819,7 +825,7 @@ extension NCNetworking {
         let urlPath = userBaseUrl.urlBase + "/remote.php/dav/files/" + userBaseUrl.user + filePath
 
         dispatchGroup?.enter()
-        self.readFile(serverUrlFileName: urlPath) { account, metadata, error in
+        self.readFile(serverUrlFileName: urlPath, account: userBaseUrl.account) { account, metadata, error in
             defer { dispatchGroup?.leave() }
             guard let metadata = metadata else { return }
             let returnMetadata = tableMetadata.init(value: metadata)
@@ -846,11 +852,13 @@ class NCOperationDownloadAvatar: ConcurrentOperation {
     var fileNameLocalPath: String
     var cell: NCCellProtocol!
     var view: UIView?
+    var account: String
 
-    init(user: String, fileName: String, fileNameLocalPath: String, cell: NCCellProtocol, view: UIView?) {
+    init(user: String, fileName: String, fileNameLocalPath: String, account: String, cell: NCCellProtocol, view: UIView?) {
         self.user = user
         self.fileName = fileName
         self.fileNameLocalPath = fileNameLocalPath
+        self.account = account
         self.cell = cell
         self.view = view
         self.etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag
@@ -864,6 +872,7 @@ class NCOperationDownloadAvatar: ConcurrentOperation {
                                            sizeImage: NCGlobal.shared.avatarSize,
                                            avatarSizeRounded: NCGlobal.shared.avatarSizeRounded,
                                            etag: self.etag,
+                                           account: account,
                                            options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, imageAvatar, _, etag, error in
             if error == .success, let imageAvatar {
                 NCManageDatabase.shared.addAvatar(fileName: self.fileName, etag: etag ?? "")

+ 3 - 1
iOSClient/Networking/NCNetworking.swift

@@ -197,7 +197,9 @@ class NCNetworking: NSObject, NKCommonDelegate {
         if typeReachability == NKCommon.TypeReachability.reachableCellular || typeReachability == NKCommon.TypeReachability.reachableEthernetOrWiFi {
             if !lastReachability {
 #if !EXTENSION
-                NCService().startRequestServicesServer()
+                if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
+                    NCService().startRequestServicesServer(account: appDelegate.account, user: appDelegate.user, userId: appDelegate.userId)
+                }
 #endif
             }
             lastReachability = true

+ 2 - 2
iOSClient/Networking/NCNetworkingCheckRemoteUser.swift

@@ -34,12 +34,12 @@ class NCNetworkingCheckRemoteUser {
         NCNetworking.shared.cancelAllTask()
 
         if NCGlobal.shared.capabilityServerVersionMajor >= NCGlobal.shared.nextcloudVersion17 {
-            NextcloudKit.shared.getRemoteWipeStatus(serverUrl: tableAccount.urlBase, token: token) { account, wipe, _, error in
+            NextcloudKit.shared.getRemoteWipeStatus(serverUrl: tableAccount.urlBase, token: token, account: tableAccount.account) { account, wipe, _, error in
                 if wipe {
                     appDelegate.deleteAccount(account)
                     let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_wipe_account_")
                     NCContentPresenter().messageNotification(tableAccount.user, error: error, delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, priority: .max)
-                    NextcloudKit.shared.setRemoteWipeCompletition(serverUrl: tableAccount.urlBase, token: token) { _, _ in print("wipe") }
+                    NextcloudKit.shared.setRemoteWipeCompletition(serverUrl: tableAccount.urlBase, token: token, account: tableAccount.account) { _, _ in print("wipe") }
                     let accounts = NCManageDatabase.shared.getAccounts()
                     if accounts?.count ?? 0 > 0 {
                         if let newAccount = accounts?.first {

+ 1 - 1
iOSClient/Networking/NCNetworkingProcess.swift

@@ -205,7 +205,7 @@ class NCNetworkingProcess: NSObject {
                 }
                 // Verify QUOTA
                 if metadata.sessionError.contains("\(NCGlobal.shared.errorQuota)") {
-                    NextcloudKit.shared.getUserProfile { _, userProfile, _, error in
+                    NextcloudKit.shared.getUserProfile(account: metadata.account) { _, userProfile, _, error in
                         if error == .success, let userProfile, userProfile.quotaFree > 0, userProfile.quotaFree > metadata.size {
                             NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId,
                                                                        session: NCNetworking.shared.sessionUploadBackground,

+ 19 - 20
iOSClient/Networking/NCService.swift

@@ -32,25 +32,24 @@ class NCService: NSObject {
 
     // MARK: -
 
-    @objc public func startRequestServicesServer() {
+    public func startRequestServicesServer(account: String, user: String, userId: String) {
         guard !appDelegate.account.isEmpty, UIApplication.shared.applicationState != .background else {
             NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Service not start request service server with the application in background")
             return
         }
-        let account = appDelegate.account
 
         NCManageDatabase.shared.clearAllAvatarLoaded()
         NCPushNotification.shared.pushNotification()
 
         Task {
             addInternalTypeIdentifier()
-            let result = await requestServerStatus()
+            let result = await requestServerStatus(account: account)
             if result {
-                requestServerCapabilities()
-                getAvatar()
+                requestServerCapabilities(account: account)
+                getAvatar(account: account, userId: userId, user: user)
                 NCNetworkingE2EE().unlockAll(account: account)
                 sendClientDiagnosticsRemoteOperation(account: account)
-                synchronize()
+                synchronize(account: account)
             }
         }
     }
@@ -89,7 +88,7 @@ class NCService: NSObject {
 
     // MARK: -
 
-    private func requestServerStatus() async -> Bool {
+    private func requestServerStatus(account: String) async -> Bool {
         switch await NCNetworking.shared.getServerStatus(serverUrl: appDelegate.urlBase, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) {
         case .success(let serverInfo):
             if serverInfo.maintenance {
@@ -108,7 +107,7 @@ class NCService: NSObject {
             return false
         }
 
-        let resultUserProfile = await NCNetworking.shared.getUserProfile(options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue))
+        let resultUserProfile = await NCNetworking.shared.getUserProfile(account: account, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue))
         if resultUserProfile.error == .success, let userProfile = resultUserProfile.userProfile {
             NCManageDatabase.shared.setAccountUserProfile(account: resultUserProfile.account, userProfile: userProfile)
             return true
@@ -127,10 +126,10 @@ class NCService: NSObject {
         }
     }
 
-    func synchronize() {
+    func synchronize(account: String) {
         NextcloudKit.shared.listingFavorites(showHiddenFiles: NCKeychain().showHiddenFiles,
+                                             account: account,
                                              options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { account, files, _, error in
-
             guard error == .success else { return }
             NCManageDatabase.shared.convertFilesToMetadatas(files, useFirstAsMetadataFolder: false) { _, metadatas in
                 NCManageDatabase.shared.updateMetadatasFavorite(account: account, metadatas: metadatas)
@@ -140,18 +139,18 @@ class NCService: NSObject {
         }
     }
 
-    func getAvatar() {
-        let fileName = appDelegate.userBaseUrl + "-" + self.appDelegate.user + ".png"
+    func getAvatar(account: String, userId: String, user: String) {
+        let fileName = appDelegate.userBaseUrl + "-" + user + ".png"
         let fileNameLocalPath = utilityFileSystem.directoryUserData + "/" + fileName
         let etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag
 
-        NextcloudKit.shared.downloadAvatar(user: appDelegate.userId,
+        NextcloudKit.shared.downloadAvatar(user: userId,
                                            fileNameLocalPath: fileNameLocalPath,
                                            sizeImage: NCGlobal.shared.avatarSize,
                                            avatarSizeRounded: NCGlobal.shared.avatarSizeRounded,
                                            etag: etag,
+                                           account: account,
                                            options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, _, _, etag, error in
-
             if let etag = etag, error == .success {
                 NCManageDatabase.shared.addAvatar(fileName: fileName, etag: etag)
             } else if error.errorCode == NCGlobal.shared.errorNotModified {
@@ -161,10 +160,10 @@ class NCService: NSObject {
         }
     }
 
-    private func requestServerCapabilities() {
+    private func requestServerCapabilities(account: String) {
         guard !appDelegate.account.isEmpty else { return }
 
-        NextcloudKit.shared.getCapabilities(options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { account, data, error in
+        NextcloudKit.shared.getCapabilities(account: account, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { account, data, error in
             guard error == .success, let data = data else {
                 NCBrandColor.shared.settingThemingColor(account: account)
                 NCImageCache.shared.createImagesBrandCache()
@@ -185,7 +184,7 @@ class NCService: NSObject {
             // Text direct editor detail
             if NCGlobal.shared.capabilityServerVersionMajor >= NCGlobal.shared.nextcloudVersion18 {
                 let options = NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
-                NextcloudKit.shared.NCTextObtainEditorDetails(options: options) { account, editors, creators, _, error in
+                NextcloudKit.shared.NCTextObtainEditorDetails(account: account, options: options) { account, editors, creators, _, error in
                     if error == .success && account == self.appDelegate.account {
                         NCManageDatabase.shared.addDirectEditing(account: account, editors: editors, creators: creators)
                     }
@@ -194,7 +193,7 @@ class NCService: NSObject {
 
             // External file Server
             if NCGlobal.shared.capabilityExternalSites {
-                NextcloudKit.shared.getExternalSite(options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { account, externalSites, _, error in
+                NextcloudKit.shared.getExternalSite(account: account, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { account, externalSites, _, error in
                     if error == .success && account == self.appDelegate.account {
                         NCManageDatabase.shared.deleteExternalSites(account: account)
                         for externalSite in externalSites {
@@ -208,7 +207,7 @@ class NCService: NSObject {
 
             // User Status
             if NCGlobal.shared.capabilityUserStatusEnabled {
-                NextcloudKit.shared.getUserStatus(options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { account, clearAt, icon, message, messageId, messageIsPredefined, status, statusIsUserDefined, userId, _, error in
+                NextcloudKit.shared.getUserStatus(account: account, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { account, clearAt, icon, message, messageId, messageIsPredefined, status, statusIsUserDefined, userId, _, error in
                     if error == .success && account == self.appDelegate.account && userId == self.appDelegate.userId {
                         NCManageDatabase.shared.setAccountUserStatus(userStatusClearAt: clearAt, userStatusIcon: icon, userStatusMessage: message, userStatusMessageId: messageId, userStatusMessageIsPredefined: messageIsPredefined, userStatusStatus: status, userStatusStatusIsUserDefined: statusIsUserDefined, account: account)
                     }
@@ -351,7 +350,7 @@ class NCService: NSObject {
             let issues = Issues(syncConflicts: syncConflicts, virusDetected: virusDetected, e2eeErrors: e2eeErrors, problems: problems)
             let data = try JSONEncoder().encode(issues)
             data.printJson()
-            NextcloudKit.shared.sendClientDiagnosticsRemoteOperation(data: data, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, error in
+            NextcloudKit.shared.sendClientDiagnosticsRemoteOperation(data: data, account: account, options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { _, error in
                 if error == .success {
                     NCManageDatabase.shared.deleteDiagnostics(account: account, ids: ids)
                 }

+ 3 - 3
iOSClient/Notification/NCNotification.swift

@@ -230,7 +230,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate {
 
     func tapRemove(with notification: NKNotifications) {
 
-        NextcloudKit.shared.setNotification(serverUrl: nil, idNotification: notification.idNotification, method: "DELETE") { account, error in
+        NextcloudKit.shared.setNotification(serverUrl: nil, idNotification: notification.idNotification, method: "DELETE", account: self.appDelegate.account) { account, error in
             if error == .success && account == self.appDelegate.account {
                 if let index = self.notifications
                     .firstIndex(where: { $0.idNotification == notification.idNotification }) {
@@ -262,7 +262,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate {
                 return
             }
 
-            NextcloudKit.shared.setNotification(serverUrl: serverUrl, idNotification: 0, method: method) { account, error in
+            NextcloudKit.shared.setNotification(serverUrl: serverUrl, idNotification: 0, method: method, account: self.appDelegate.account) { account, error in
                 if error == .success && account == self.appDelegate.account {
                     if let index = self.notifications.firstIndex(where: { $0.idNotification == notification.idNotification }) {
                         self.notifications.remove(at: index)
@@ -290,7 +290,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate {
    @objc func getNetwokingNotification() {
 
        self.tableView.reloadData()
-       NextcloudKit.shared.getNotifications { task in
+       NextcloudKit.shared.getNotifications(account: self.appDelegate.account) { task in
            self.dataSourceTask = task
            self.tableView.reloadData()
        } completion: { account, notifications, _, error in

+ 4 - 4
iOSClient/PushNotification/NCPushNotification.swift

@@ -67,12 +67,12 @@ class NCPushNotification {
               let pushDevicePublicKey = String(data: pushPublicKey, encoding: .utf8)  else { return }
         let proxyServerPath = NCBrandOptions.shared.pushNotificationServerProxy
 
-        NextcloudKit.shared.subscribingPushNotification(serverUrl: urlBase, account: account, user: user, password: keychain.getPassword(account: account), pushTokenHash: pushTokenHash, devicePublicKey: pushDevicePublicKey, proxyServerUrl: proxyServerPath) { account, deviceIdentifier, signature, publicKey, _, error in
+        NextcloudKit.shared.subscribingPushNotification(serverUrl: urlBase, user: user, password: keychain.getPassword(account: account), pushTokenHash: pushTokenHash, devicePublicKey: pushDevicePublicKey, proxyServerUrl: proxyServerPath, account: account) { account, deviceIdentifier, signature, publicKey, _, error in
             if error == .success, let deviceIdentifier, let signature, let publicKey {
                 let userAgent = String(format: "%@  (Strict VoIP)", NCBrandOptions.shared.getUserAgent())
                 let options = NKRequestOptions(customUserAgent: userAgent)
 
-                NextcloudKit.shared.subscribingPushProxy(proxyServerUrl: proxyServerPath, pushToken: self.pushKitToken, deviceIdentifier: deviceIdentifier, signature: signature, publicKey: publicKey, options: options) { error in
+                NextcloudKit.shared.subscribingPushProxy(proxyServerUrl: proxyServerPath, pushToken: self.pushKitToken, deviceIdentifier: deviceIdentifier, signature: signature, publicKey: publicKey, account: account, options: options) { account, error in
                     if error == .success {
                         NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Subscribed to Push Notification server & proxy successfully")
                         self.keychain.setPushNotificationToken(account: account, token: self.pushKitToken)
@@ -90,13 +90,13 @@ class NCPushNotification {
               let signature = keychain.getPushNotificationDeviceIdentifierSignature(account: account),
               let publicKey = keychain.getPushNotificationSubscribingPublicKey(account: account) else { return }
 
-        NextcloudKit.shared.unsubscribingPushNotification(serverUrl: urlBase, account: account, user: user, password: keychain.getPassword(account: account)) { _, error in
+        NextcloudKit.shared.unsubscribingPushNotification(serverUrl: urlBase, user: user, password: keychain.getPassword(account: account), account: account) { _, error in
             if error == .success {
                 let proxyServerPath = NCBrandOptions.shared.pushNotificationServerProxy
                 let userAgent = String(format: "%@  (Strict VoIP)", NCBrandOptions.shared.getUserAgent())
                 let options = NKRequestOptions(customUserAgent: userAgent)
 
-                NextcloudKit.shared.unsubscribingPushProxy(proxyServerUrl: proxyServerPath, deviceIdentifier: deviceIdentifier, signature: signature, publicKey: publicKey, options: options) { error in
+                NextcloudKit.shared.unsubscribingPushProxy(proxyServerUrl: proxyServerPath, deviceIdentifier: deviceIdentifier, signature: signature, publicKey: publicKey, account: account, options: options) { account, error in
                     if error == .success {
                         NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Unsubscribed to Push Notification server & proxy successfully")
                         self.keychain.setPushNotificationPublicKey(account: account, data: nil)

+ 1 - 0
iOSClient/Recent/NCRecent.swift

@@ -133,6 +133,7 @@ class NCRecent: NCCollectionViewCommon {
         NextcloudKit.shared.searchBodyRequest(serverUrl: appDelegate.urlBase,
                                               requestBody: requestBody,
                                               showHiddenFiles: NCKeychain().showHiddenFiles,
+                                              account: appDelegate.account,
                                               options: NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)) { task in
             self.dataSourceTask = task
             self.collectionView.reloadData()

+ 2 - 21
iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift

@@ -25,37 +25,29 @@ import UIKit
 import NextcloudKit
 
 @objc class NCRichWorkspaceCommon: NSObject {
-
     let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
     let utilityFileSystem = NCUtilityFileSystem()
 
     @objc func createViewerNextcloudText(serverUrl: String, viewController: UIViewController) {
-
         if !NextcloudKit.shared.isNetworkReachable() {
             let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_go_online_")
             NCContentPresenter().showError(error: error)
             return
         }
-
         guard let directEditingCreator = NCManageDatabase.shared.getDirectEditingCreators(predicate: NSPredicate(format: "account == %@ AND editor == 'text'", appDelegate.account))?.first else { return }
 
         NCActivityIndicator.shared.start(backgroundView: viewController.view)
 
         let fileNamePath = utilityFileSystem.getFileNamePath(NCGlobal.shared.fileNameRichWorkspace, serverUrl: serverUrl, urlBase: appDelegate.urlBase, userId: appDelegate.userId)
-        NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: directEditingCreator.editor, creatorId: directEditingCreator.identifier, templateId: "") { account, url, _, error in
-
+        NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: directEditingCreator.editor, creatorId: directEditingCreator.identifier, templateId: "", account: appDelegate.account) { account, url, _, error in
             NCActivityIndicator.shared.stop()
 
             if error == .success && account == self.appDelegate.account {
-
                 if let viewerRichWorkspaceWebView = UIStoryboard(name: "NCViewerRichWorkspace", bundle: nil).instantiateViewController(withIdentifier: "NCViewerRichWorkspaceWebView") as? NCViewerRichWorkspaceWebView {
-
                     viewerRichWorkspaceWebView.url = url!
                     viewerRichWorkspaceWebView.presentationController?.delegate = viewController as? UIAdaptivePresentationControllerDelegate
-
                     viewController.present(viewerRichWorkspaceWebView, animated: true, completion: nil)
                 }
-
             } else if error != .success {
                 NCContentPresenter().showError(error: error)
             }
@@ -63,7 +55,6 @@ import NextcloudKit
     }
 
     @objc func openViewerNextcloudText(serverUrl: String, viewController: UIViewController) {
-
         if !NextcloudKit.shared.isNetworkReachable() {
             let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_go_online_")
             NCContentPresenter().showError(error: error)
@@ -73,38 +64,28 @@ import NextcloudKit
         if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", appDelegate.account, serverUrl, NCGlobal.shared.fileNameRichWorkspace.lowercased())) {
 
             if metadata.url.isEmpty {
-
                 NCActivityIndicator.shared.start(backgroundView: viewController.view)
 
                 let fileNamePath = utilityFileSystem.getFileNamePath(metadata.fileName, serverUrl: metadata.serverUrl, urlBase: appDelegate.urlBase, userId: appDelegate.userId)
-                NextcloudKit.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: "text") { account, url, _, error in
-
+                NextcloudKit.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: "text", account: metadata.account) { account, url, _, error in
                     NCActivityIndicator.shared.stop()
 
                     if error == .success && account == self.appDelegate.account {
-
                         if let viewerRichWorkspaceWebView = UIStoryboard(name: "NCViewerRichWorkspace", bundle: nil).instantiateViewController(withIdentifier: "NCViewerRichWorkspaceWebView") as? NCViewerRichWorkspaceWebView {
-
                             viewerRichWorkspaceWebView.url = url!
                             viewerRichWorkspaceWebView.metadata = metadata
                             viewerRichWorkspaceWebView.presentationController?.delegate = viewController as? UIAdaptivePresentationControllerDelegate
-
                             viewController.present(viewerRichWorkspaceWebView, animated: true, completion: nil)
                         }
-
                     } else if error != .success {
                         NCContentPresenter().showError(error: error)
                     }
                 }
-
             } else {
-
                 if let viewerRichWorkspaceWebView = UIStoryboard(name: "NCViewerRichWorkspace", bundle: nil).instantiateViewController(withIdentifier: "NCViewerRichWorkspaceWebView") as? NCViewerRichWorkspaceWebView {
-
                     viewerRichWorkspaceWebView.url = metadata.url
                     viewerRichWorkspaceWebView.metadata = metadata
                     viewerRichWorkspaceWebView.presentationController?.delegate = viewController as? UIAdaptivePresentationControllerDelegate
-
                     viewController.present(viewerRichWorkspaceWebView, animated: true, completion: nil)
                 }
             }

+ 1 - 1
iOSClient/RichWorkspace/NCViewerRichWorkspace.swift

@@ -62,7 +62,7 @@ import MarkdownKit
     override func viewDidAppear(_ animated: Bool) {
         super.viewDidAppear(animated)
 
-        NCNetworking.shared.readFile(serverUrlFileName: self.serverUrl, queue: .main) { _ in
+        NCNetworking.shared.readFile(serverUrlFileName: self.serverUrl, account: appDelegate.account, queue: .main) { _ in
         } completion: { account, metadata, error in
             if error == .success, account == self.appDelegate.account, let metadata {
                 NCManageDatabase.shared.setDirectory(serverUrl: self.serverUrl, richWorkspace: metadata.richWorkspace, account: account)

+ 3 - 2
iOSClient/SceneDelegate.swift

@@ -101,8 +101,9 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
 
         hidePrivacyProtectionWindow()
 
-        NCService().startRequestServicesServer()
-
+        if let appDelegate {
+            NCService().startRequestServicesServer(account: appDelegate.account, user: appDelegate.user, userId: appDelegate.userId)
+        }
         NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in
             NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Initialize Auto upload with \(items) uploads")
         }

+ 1 - 1
iOSClient/Select/NCSelect.swift

@@ -209,7 +209,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
     }
 
     func createFolderButtonPressed(_ sender: UIButton) {
-        let alertController = UIAlertController.createFolder(serverUrl: serverUrl, urlBase: activeAccount)
+        let alertController = UIAlertController.createFolder(serverUrl: serverUrl, userBaseUrl: activeAccount)
         self.present(alertController, animated: true, completion: nil)
     }
 

+ 9 - 9
iOSClient/Settings/Settings/E2EE/NCEndToEndInitialize.swift

@@ -40,7 +40,7 @@ class NCEndToEndInitialize: NSObject {
     // MARK: Initialize
     // --------------------------------------------------------------------------------------------
 
-    @objc func initEndToEndEncryption(viewController: UIViewController?, metadata: tableMetadata?) {
+    func initEndToEndEncryption(viewController: UIViewController?, metadata: tableMetadata?) {
         self.viewController = viewController
         self.metadata = metadata
 
@@ -49,15 +49,15 @@ class NCEndToEndInitialize: NSObject {
         self.getPublicKey()
     }
 
-    @objc func statusOfService(completion: @escaping (_ error: NKError?) -> Void) {
-        NextcloudKit.shared.getE2EECertificate { _, _, _, _, error in
+    func statusOfService(completion: @escaping (_ error: NKError?) -> Void) {
+        NextcloudKit.shared.getE2EECertificate(account: appDelegate.account) { _, _, _, _, error in
             completion(error)
         }
     }
 
     func getPublicKey() {
 
-        NextcloudKit.shared.getE2EECertificate { account, certificate, _, _, error in
+        NextcloudKit.shared.getE2EECertificate(account: appDelegate.account) { account, certificate, _, _, error in
 
             if error == .success, account == self.appDelegate.account, let certificate {
 
@@ -84,7 +84,7 @@ class NCEndToEndInitialize: NSObject {
                         return
                     }
 
-                    NextcloudKit.shared.signE2EECertificate(certificate: csr) { account, certificate, _, error in
+                    NextcloudKit.shared.signE2EECertificate(certificate: csr, account: account) { account, certificate, _, error in
 
                         if error == .success, account == self.appDelegate.account, let certificate {
 
@@ -134,7 +134,7 @@ class NCEndToEndInitialize: NSObject {
     func getPrivateKeyCipher() {
 
         // Request PrivateKey chiper to Server
-        NextcloudKit.shared.getE2EEPrivateKey { account, privateKeyChiper, _, error in
+        NextcloudKit.shared.getE2EEPrivateKey(account: appDelegate.account) { account, privateKeyChiper, _, error in
 
             if error == .success && account == self.appDelegate.account {
 
@@ -166,7 +166,7 @@ class NCEndToEndInitialize: NSObject {
                     NCKeychain().setEndToEndPassphrase(account: self.appDelegate.account, passphrase: passphrase)
 
                     // request server publicKey
-                    NextcloudKit.shared.getE2EEPublicKey { account, publicKey, _, error in
+                    NextcloudKit.shared.getE2EEPublicKey(account: account) { account, publicKey, _, error in
 
                         if error == .success, account == self.appDelegate.account, let publicKey {
 
@@ -262,7 +262,7 @@ class NCEndToEndInitialize: NSObject {
         // privateKeyChiper
         print(privateKeyCipher)
 
-        NextcloudKit.shared.storeE2EEPrivateKey(privateKey: privateKeyCipher) { account, _, _, error in
+        NextcloudKit.shared.storeE2EEPrivateKey(privateKey: privateKeyCipher, account: appDelegate.account) { account, _, _, error in
 
             if error == .success, account == self.appDelegate.account, let privateKey = privateKeyString {
 
@@ -270,7 +270,7 @@ class NCEndToEndInitialize: NSObject {
                 NCKeychain().setEndToEndPassphrase(account: account, passphrase: e2ePassphrase)
 
                 // request server publicKey
-                NextcloudKit.shared.getE2EEPublicKey { account, publicKey, _, error in
+                NextcloudKit.shared.getE2EEPublicKey(account: account) { account, publicKey, _, error in
 
                     if error == .success, account == self.appDelegate.account, let publicKey {
 

+ 2 - 2
iOSClient/Settings/Settings/E2EE/NCManageE2EEView.swift

@@ -149,7 +149,7 @@ struct NCManageE2EEView: View {
             }
             .contentShape(Rectangle())
             .onTapGesture {
-                NextcloudKit.shared.deleteE2EECertificate { _, error in
+                NextcloudKit.shared.deleteE2EECertificate(account: model.appDelegate.account) { _, error in
                     if error == .success {
                         NCContentPresenter().messageNotification("E2E delete certificate", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: .success)
                     } else {
@@ -172,7 +172,7 @@ struct NCManageE2EEView: View {
             }
             .contentShape(Rectangle())
             .onTapGesture {
-                NextcloudKit.shared.deleteE2EEPrivateKey { _, error in
+                NextcloudKit.shared.deleteE2EEPrivateKey(account: model.appDelegate.account) { _, error in
                     if error == .success {
                         NCContentPresenter().messageNotification("E2E delete privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: .success)
                     } else {

+ 8 - 3
iOSClient/Settings/Settings/NCSettingsView.swift

@@ -153,9 +153,14 @@ struct NCSettingsView: View {
                 }, header: {
                     Text(NSLocalizedString("_calendar_contacts_", comment: ""))
                 }, footer: {
-                    Text(NSLocalizedString("_calendar_contacts_footer_", comment: ""))
-                        .font(.system(size: 12))
-                        .lineSpacing(1)
+                    VStack(alignment: .leading) {
+                        Text(NSLocalizedString("_calendar_contacts_footer_warning_", comment: ""))
+                            .font(.system(size: 12))
+                        Spacer()
+                        Text(NSLocalizedString("_calendar_contacts_footer_", comment: ""))
+                            .font(.system(size: 12))
+                    }
+
                 })
             }
             /// Users

+ 1 - 1
iOSClient/Share/NCShare+NCCellDelegate.swift

@@ -30,7 +30,7 @@ extension NCShare: NCShareLinkCellDelegate, NCShareUserCellDelegate {
         guard let metadata = self.metadata, let appDelegate = appDelegate else { return }
 
         let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
-        NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName) { _, metadata, error in
+        NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName, account: metadata.account) { _, metadata, error in
             if error == .success, let metadata = metadata {
                 let internalLink = appDelegate.urlBase + "/index.php/f/" + metadata.fileId
                 self.shareCommon.copyLink(link: internalLink, viewController: self, sender: sender)

+ 3 - 2
iOSClient/Share/NCShare.swift

@@ -159,7 +159,8 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
                 fileNameLocalPath: fileNameLocalPath,
                 sizeImage: NCGlobal.shared.avatarSize,
                 avatarSizeRounded: NCGlobal.shared.avatarSizeRounded,
-                etag: etag) { _, imageAvatar, _, etag, error in
+                etag: etag,
+                account: metadata.account) { _, imageAvatar, _, etag, error in
                     if error == .success, let etag = etag, let imageAvatar = imageAvatar {
                         NCManageDatabase.shared.addAvatar(fileName: fileName, etag: etag)
                         self.sharedWithYouByImage.image = imageAvatar
@@ -272,7 +273,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
         dropDown.customCellConfiguration = { (index: Index, _, cell: DropDownCell) -> Void in
             guard let cell = cell as? NCSearchUserDropDownCell else { return }
             let sharee = sharees[index]
-            cell.setupCell(sharee: sharee, baseUrl: appDelegate)
+            cell.setupCell(sharee: sharee, userBaseUrl: appDelegate)
         }
 
         dropDown.selectionAction = { index, _ in

+ 6 - 7
iOSClient/Share/NCShareNetworking.swift

@@ -24,7 +24,6 @@ import UIKit
 import NextcloudKit
 
 class NCShareNetworking: NSObject {
-
     let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
     let utilityFileSystem = NCUtilityFileSystem()
     weak var delegate: NCShareNetworkingDelegate?
@@ -48,12 +47,12 @@ class NCShareNetworking: NSObject {
         let filenamePath = utilityFileSystem.getFileNamePath(metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, userId: metadata.userId)
         let parameter = NKShareParameter(path: filenamePath)
 
-        NextcloudKit.shared.readShares(parameters: parameter) { account, shares, _, error in
+        NextcloudKit.shared.readShares(parameters: parameter, account: metadata.account) { account, shares, _, error in
             if error == .success, let shares = shares {
                 NCManageDatabase.shared.deleteTableShare(account: account, path: "/" + filenamePath)
                 let home = self.utilityFileSystem.getHomeServer(urlBase: self.metadata.urlBase, userId: self.metadata.userId)
                 NCManageDatabase.shared.addShare(account: self.metadata.account, home: home, shares: shares)
-                NextcloudKit.shared.getGroupfolders { account, results, _, error in
+                NextcloudKit.shared.getGroupfolders(account: account) { account, results, _, error in
                     if showLoadingIndicator {
                         NCActivityIndicator.shared.stop()
                     }
@@ -83,7 +82,7 @@ class NCShareNetworking: NSObject {
         NCActivityIndicator.shared.start(backgroundView: view)
         let filenamePath = utilityFileSystem.getFileNamePath(metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, userId: metadata.userId)
 
-        NextcloudKit.shared.createShare(path: filenamePath, shareType: option.shareType, shareWith: option.shareWith, password: option.password, note: option.note, permissions: option.permissions, attributes: option.attributes) { _, share, _, error in
+        NextcloudKit.shared.createShare(path: filenamePath, shareType: option.shareType, shareWith: option.shareWith, password: option.password, note: option.note, permissions: option.permissions, attributes: option.attributes, account: metadata.account) { _, share, _, error in
             NCActivityIndicator.shared.stop()
             if error == .success, let share = share {
                 option.idShare = share.idShare
@@ -101,7 +100,7 @@ class NCShareNetworking: NSObject {
 
     func unShare(idShare: Int) {
         NCActivityIndicator.shared.start(backgroundView: view)
-        NextcloudKit.shared.deleteShare(idShare: idShare) { account, error in
+        NextcloudKit.shared.deleteShare(idShare: idShare, account: metadata.account) { account, error in
             NCActivityIndicator.shared.stop()
             if error == .success {
                 NCManageDatabase.shared.deleteTableShare(account: account, idShare: idShare)
@@ -114,7 +113,7 @@ class NCShareNetworking: NSObject {
 
     func updateShare(option: NCTableShareable) {
         NCActivityIndicator.shared.start(backgroundView: view)
-        NextcloudKit.shared.updateShare(idShare: option.idShare, password: option.password, expireDate: option.expDateString, permissions: option.permissions, note: option.note, label: option.label, hideDownload: option.hideDownload, attributes: option.attributes) { _, share, _, error in
+        NextcloudKit.shared.updateShare(idShare: option.idShare, password: option.password, expireDate: option.expDateString, permissions: option.permissions, note: option.note, label: option.label, hideDownload: option.hideDownload, attributes: option.attributes, account: metadata.account) { _, share, _, error in
             NCActivityIndicator.shared.stop()
             if error == .success, let share = share {
                 let home = self.utilityFileSystem.getHomeServer(urlBase: self.metadata.urlBase, userId: self.metadata.userId)
@@ -129,7 +128,7 @@ class NCShareNetworking: NSObject {
 
     func getSharees(searchString: String) {
         NCActivityIndicator.shared.start(backgroundView: view)
-        NextcloudKit.shared.searchSharees(search: searchString) { _, sharees, _, error in
+        NextcloudKit.shared.searchSharees(search: searchString, account: metadata.account) { _, sharees, _, error in
             NCActivityIndicator.shared.stop()
             if error == .success {
                 self.delegate?.getSharees(sharees: sharees)

+ 0 - 70
iOSClient/Share/NCSharePaging.swift

@@ -263,69 +263,19 @@ class NCSharePagingView: PagingView {
     }
 
     override func setupConstraints() {
-
-//        guard let headerView = Bundle.main.loadNibNamed("NCShareHeaderView", owner: self, options: nil)?.first as? NCShareHeaderView else { return }
-
         guard let headerView = Bundle.main.loadNibNamed("NCShareHeader", owner: self, options: nil)?.first as? NCShareHeader else { return }
         header = headerView
         headerView.backgroundColor = .systemBackground
-//        headerView.ocId = metadata.ocId
 
         let dateFormatter = DateFormatter()
         dateFormatter.dateStyle = .short
         dateFormatter.timeStyle = .short
         dateFormatter.locale = Locale.current
 
-//        if FileManager.default.fileExists(atPath: utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) {
-//            headerView.imageView.image = UIImage(contentsOfFile: utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag))
-//        } else {
-//            print(metadata.iconName)
-//            if metadata.directory {
-//                let image = metadata.e2eEncrypted ? UIImage(named: "folderEncrypted") : UIImage(named: "folder")
-//                headerView.imageView.image = image?.image(color: NCBrandColor.shared.brandElement, size: image?.size.width ?? 0)
-//                headerView.imageView.image = headerView.imageView.image?.colorizeFolder(metadata: metadata)
-//            } else if !metadata.iconName.isEmpty {
-//                headerView.imageView.image = utility.loadImage(named: metadata.iconName, useTypeIconFile: true)
-//            } else {
-//                headerView.imageView.image = NCImageCache.images.file
-//            }
-//        }
-//        headerView.path.text = utilityFileSystem.getPath(path: metadata.path, user: metadata.user, fileName: metadata.fileName)
-//        headerView.path.textColor = NCBrandColor.shared.textColor
-//        headerView.path.trailingBuffer = headerView.path.frame.width
-//        if metadata.favorite {
-//            headerView.favorite.setImage(utility.loadImage(named: "star.fill", colors: [NCBrandColor.shared.yellowFavorite], size: 20), for: .normal)
-//        } else {
-//            headerView.favorite.setImage(utility.loadImage(named: "star.fill", colors: [NCBrandColor.shared.iconImageColor2], size: 20), for: .normal)
-//        }
-//        headerView.info.text = utilityFileSystem.transformedSize(metadata.size) + ", " + NSLocalizedString("_modified_", comment: "") + " " + dateFormatter.string(from: metadata.date as Date)
-//        headerView.info.textColor = NCBrandColor.shared.textColor2
-//        headerView.creation.text = NSLocalizedString("_creation_", comment: "") + " " + dateFormatter.string(from: metadata.creationDate as Date)
-//        headerView.creation.textColor = NCBrandColor.shared.textColor2
-//        headerView.upload.text = NSLocalizedString("_upload_", comment: "") + " " + dateFormatter.string(from: metadata.uploadDate as Date)
-//        headerView.upload.textColor = NCBrandColor.shared.textColor2
-//
-//        headerView.details.setTitleColor(NCBrandColor.shared.textColor, for: .normal)
-//        headerView.details.setTitle(NSLocalizedString("_details_", comment: ""), for: .normal)
-//        headerView.details.layer.cornerRadius = 9
-//        headerView.details.layer.masksToBounds = true
-//        headerView.details.layer.backgroundColor = UIColor(red: 152.0 / 255.0, green: 167.0 / 255.0, blue: 181.0 / 255.0, alpha: 0.8).cgColor
-
-//        for tag in metadata.tags {
-////            headerView.tagListView.addTag(tag)
-//        }
-
-//        if headerView.fullWidthImageView?.image == nil {
-//            NCSharePagingView.tagHeaderHeight = 80
-//        } else {
-//            NCSharePagingView.tagHeaderHeight = 130
-//        }
-
         headerView.setupUI(with: metadata)
 
         addSubview(headerView)
 
-//        recalculateHeaderHeight()
         collectionView.translatesAutoresizingMaskIntoConstraints = false
         headerView.translatesAutoresizingMaskIntoConstraints = false
         pageView.translatesAutoresizingMaskIntoConstraints = false
@@ -339,33 +289,13 @@ class NCSharePagingView: PagingView {
             headerView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor),
             headerView.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor),
             headerView.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor),
-//            headerView.heightAnchor.constraint(equalToConstant: 260),
 
             pageView.leadingAnchor.constraint(equalTo: leadingAnchor),
             pageView.trailingAnchor.constraint(equalTo: trailingAnchor),
             pageView.bottomAnchor.constraint(equalTo: bottomAnchor),
             pageView.topAnchor.constraint(equalTo: headerView.bottomAnchor)
         ])
-
-
-//        setNeedsLayout()
-//        layoutIfNeeded()
     }
-
-//    func recalculateHeaderHeight() {
-//        guard let header else { return }
-//        // Deactivate existing height constraints
-//        for constraint in header.constraints {
-//                if constraint.firstAttribute == .height {
-//                    constraint.isActive = false
-//                }
-//            }
-//
-//        NSLayoutConstraint.activate([
-//            header.heightAnchor.constraint(equalToConstant: header.heightWithImage.constant)
-//        ])
-//
-//    }
 }
 
 class NCShareHeaderView: UIView {

+ 4 - 4
iOSClient/Share/NCShareUserCell.swift

@@ -152,7 +152,7 @@ class NCSearchUserDropDownCell: DropDownCell, NCCellProtocol {
         set { user = newValue ?? "" }
     }
 
-    func setupCell(sharee: NKSharee, baseUrl: NCUserBaseUrl) {
+    func setupCell(sharee: NKSharee, userBaseUrl: NCUserBaseUrl) {
         let utility = NCUtility()
         imageItem.image = NCShareCommon().getImageShareType(shareType: sharee.shareType)
         imageShareeType.image = NCShareCommon().getImageShareType(shareType: sharee.shareType)
@@ -173,9 +173,9 @@ class NCSearchUserDropDownCell: DropDownCell, NCCellProtocol {
         imageItem.image = utility.loadUserImage(
             for: sharee.shareWith,
                displayName: nil,
-               userBaseUrl: baseUrl)
+               userBaseUrl: userBaseUrl)
 
-        let fileName = baseUrl.userBaseUrl + "-" + sharee.shareWith + ".png"
+        let fileName = userBaseUrl.userBaseUrl + "-" + sharee.shareWith + ".png"
         if NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) == nil {
             let fileNameLocalPath = NCUtilityFileSystem().directoryUserData + "/" + fileName
             let etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag
@@ -185,7 +185,7 @@ class NCSearchUserDropDownCell: DropDownCell, NCCellProtocol {
                 fileNameLocalPath: fileNameLocalPath,
                 sizeImage: NCGlobal.shared.avatarSize,
                 avatarSizeRounded: NCGlobal.shared.avatarSizeRounded,
-                etag: etag) { _, imageAvatar, _, etag, error in
+                etag: etag, account: userBaseUrl.account) { _, imageAvatar, _, etag, error in
 
                     if error == .success, let etag = etag, let imageAvatar = imageAvatar {
                         NCManageDatabase.shared.addAvatar(fileName: fileName, etag: etag)

+ 2 - 2
iOSClient/Shares/NCShares.swift

@@ -71,7 +71,7 @@ class NCShares: NCCollectionViewCommon {
                 }
             } else {
                 let serverUrlFileName = share.serverUrl + "/" + share.fileName
-                NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName) { task in
+                NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName, account: appDelegate.account) { task in
                     self.dataSourceTask = task
                     self.collectionView.reloadData()
                 } completion: { _, metadata, _ in
@@ -92,7 +92,7 @@ class NCShares: NCCollectionViewCommon {
     override func reloadDataSourceNetwork(withQueryDB: Bool = false) {
         super.reloadDataSourceNetwork()
 
-        NextcloudKit.shared.readShares(parameters: NKShareParameter()) { task in
+        NextcloudKit.shared.readShares(parameters: NKShareParameter(), account: appDelegate.account) { task in
             self.dataSourceTask = task
             self.collectionView.reloadData()
         } completion: { account, shares, _, error in

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


BIN
iOSClient/Supporting Files/an.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/br.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


+ 2 - 1
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -939,7 +939,8 @@
 "_password_ascii_"          = "The password cannot contain special characters";
 "_calendar_contacts_"       = "Calendar and Contacts";
 "_mobile_config_"           = "Download the configuration profile";
-"_calendar_contacts_footer_"    = "After the downloading you need to go to the Settings app to install it. If a profile is not installed within 8 minutes of downloading it, it is automatically deleted.";
+"_calendar_contacts_footer_warning_"    = "Configuration profile can only be downloaded if Safari is set as default browser";
+"_calendar_contacts_footer_"    = "After downloading the profile you can install it from Settings.";
 "_preview_"                 = "Preview";
 "_crop_"                    = "Crop";
 "_modify_image_desc_"       = "Tap the image for modify";

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


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