marinofaggiana 5 年之前
父節點
當前提交
26f3739d97

+ 1 - 1
Cartfile

@@ -1,4 +1,4 @@
-github "nextcloud/ios-communication-library" "v0.5"
+github "nextcloud/ios-communication-library" "develop"
 github "tilltue/TLPhotoPicker" "2.0.7"
 github "kishikawakatsumi/UICKeyChainStore" "v2.1.2"
 github "danielsaidi/Sheeeeeeeeet" "3.0.9"

+ 2 - 2
Cartfile.resolved

@@ -14,10 +14,10 @@ github "huri000/SwiftEntryKit" "1.2.3"
 github "jdg/MBProgressHUD" "1.1.0"
 github "kishikawakatsumi/UICKeyChainStore" "v2.1.2"
 github "krzyzanowskim/OpenSSL" "1.0.218"
-github "malcommac/SwiftRichString" "3.6.1"
+github "malcommac/SwiftRichString" "3.7.1"
 github "marinofaggiana/AFNetworking" "2967678c3e0e98c9b8d7e06222ad12d1f49c26f2"
 github "marinofaggiana/FastScroll" "81967c2309d29bc2c330d422da612160a30bade8"
-github "nextcloud/ios-communication-library" "v0.5"
+github "nextcloud/ios-communication-library" "860e39ac5fb7955ad3f3dfd185060ead600d301d"
 github "realm/realm-cocoa" "v4.1.1"
 github "rechsteiner/Parchment" "v1.7.0"
 github "scenee/FloatingPanel" "v1.7.1"

+ 12 - 13
iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift

@@ -28,7 +28,8 @@ import NCCommunication
 
 class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
     
-    var typeEditor = ""
+    var editorId = ""
+    var creatorId = ""
     var typeTemplate = ""
     var serverUrl = ""
     var fileNameFolder = ""
@@ -266,9 +267,9 @@ class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICol
             fileName = CCUtility.returnFileNamePath(fromFileName: fileName, serverUrl: serverUrl, activeUrl: appDelegate.activeUrl)
         }
             
-        if self.typeEditor == k_editor_text || self.typeEditor == k_editor_onlyoffice {
+        if self.editorId == k_editor_text || self.editorId == k_editor_onlyoffice {
                                     
-            NCCommunication.sharedInstance.NCTextCreateFile(urlString: appDelegate.activeUrl, fileNamePath: fileName, editor: typeEditor, templateId: selectTemplate.identifier, account: self.appDelegate.activeAccount) { (account, url, errorCode, errorMessage) in
+            NCCommunication.sharedInstance.NCTextCreateFile(urlString: appDelegate.activeUrl, fileNamePath: fileName, editorId: editorId, creatorId: creatorId, templateId: selectTemplate.identifier, account: self.appDelegate.activeAccount) { (account, url, errorCode, errorMessage) in
                 
                 if errorCode == 0 && account == self.appDelegate.activeAccount {
                     
@@ -290,7 +291,7 @@ class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICol
             
         }
         
-        if self.typeEditor == k_editor_collabora {
+        if self.editorId == k_editor_collabora {
             
             OCNetworking.sharedManager().createNewRichdocuments(withAccount: appDelegate.activeAccount, fileName: fileName, serverUrl: serverUrl, templateID: selectTemplate.identifier, completion: { (account, url, message, errorCode) in
                        
@@ -326,7 +327,7 @@ class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICol
         indicator.color = NCBrandColor.sharedInstance.brand
         indicator.startAnimating()
         
-        if self.typeEditor == k_editor_text || self.typeEditor == k_editor_onlyoffice {
+        if self.editorId == k_editor_text || self.editorId == k_editor_onlyoffice {
             
             // default
             fileNameExtension = "md"
@@ -361,13 +362,13 @@ class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICol
                         let temp = NCEditorTemplates()
                         
                         temp.identifier = ""
-                        if self.typeEditor == k_editor_text {
+                        if self.editorId == k_editor_text {
                             temp.ext = "md"
-                        } else if self.typeEditor == k_editor_onlyoffice && self.typeTemplate == k_template_document {
+                        } else if self.editorId == k_editor_onlyoffice && self.typeTemplate == k_template_document {
                             temp.ext = "docx"
-                        } else if self.typeEditor == k_editor_onlyoffice && self.typeTemplate == k_template_spreadsheet {
+                        } else if self.editorId == k_editor_onlyoffice && self.typeTemplate == k_template_spreadsheet {
                             temp.ext = "xlsx"
-                        } else if self.typeEditor == k_editor_onlyoffice && self.typeTemplate == k_template_presentation {
+                        } else if self.editorId == k_editor_onlyoffice && self.typeTemplate == k_template_presentation {
                             temp.ext = "pptx"
                         }
                         temp.name = "Empty"
@@ -391,10 +392,8 @@ class NCCreateFormUploadDocuments: XLFormViewController, NCSelectDelegate, UICol
             
         }
         
-        if self.typeEditor == k_editor_collabora  {
-            
-            // default
-            
+        if self.editorId == k_editor_collabora  {
+                        
             OCNetworking.sharedManager().getTemplatesRichdocuments(withAccount: appDelegate.activeAccount, typeTemplate: typeTemplate, completion: { (account, templates, message, errorCode) in
                 
                 self.indicator.stopAnimating()

+ 19 - 11
iOSClient/Main/Menu/AppDelegate+Menu.swift

@@ -65,15 +65,17 @@ extension AppDelegate {
         }
         
         if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_text}) {
+            let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_text})!
             actions.append(
                 NCMenuAction(title: NSLocalizedString("_create_nextcloudtext_document_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage(named: "file_txt"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
                     guard let navigationController = UIStoryboard(name: "NCCreateFormUploadDocuments", bundle: nil).instantiateInitialViewController() else {
                         return
                     }
                     navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
-
+                    
                     let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
-                    viewController.typeEditor = k_editor_text
+                    viewController.editorId = k_editor_text
+                    viewController.creatorId = directEditingCreator.identifier
                     viewController.typeTemplate = k_template_document
                     viewController.serverUrl = appDelegate.activeMain.serverUrl
                     viewController.titleForm = NSLocalizedString("_create_nextcloudtext_document_", comment: "")
@@ -139,7 +141,8 @@ extension AppDelegate {
             }
         }
         
-        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice}) && directEditingCreators!.contains(where: { $0.identifier == k_onlyoffice_docx}) {
+        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_docx}) {
+            let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_docx})!
             actions.append(
                 NCMenuAction(
                     title: NSLocalizedString("_create_new_document_", comment: ""),
@@ -151,7 +154,8 @@ extension AppDelegate {
                         navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
 
                         let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
-                        viewController.typeEditor = k_editor_onlyoffice
+                        viewController.editorId = k_editor_onlyoffice
+                        viewController.creatorId = directEditingCreator.identifier
                         viewController.typeTemplate = k_template_document
                         viewController.serverUrl = appDelegate.activeMain.serverUrl
                         viewController.titleForm = NSLocalizedString("_create_new_document_", comment: "")
@@ -162,7 +166,8 @@ extension AppDelegate {
             )
         }
         
-        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice}) && directEditingCreators!.contains(where: { $0.identifier == k_onlyoffice_xlsx}) {
+        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_xlsx}) {
+            let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_xlsx})!
             actions.append(
                 NCMenuAction(
                     title: NSLocalizedString("_create_new_spreadsheet_", comment: ""),
@@ -174,7 +179,8 @@ extension AppDelegate {
                         navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
 
                         let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
-                        viewController.typeEditor = k_editor_onlyoffice
+                        viewController.editorId = k_editor_onlyoffice
+                        viewController.creatorId = directEditingCreator.identifier
                         viewController.typeTemplate = k_template_spreadsheet
                         viewController.serverUrl = appDelegate.activeMain.serverUrl
                         viewController.titleForm = NSLocalizedString("_create_new_spreadsheet_", comment: "")
@@ -185,7 +191,8 @@ extension AppDelegate {
             )
         }
         
-        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice}) && directEditingCreators!.contains(where: { $0.identifier == k_onlyoffice_pptx}) {
+        if appDelegate.reachability.isReachable() && directEditingCreators != nil && directEditingCreators!.contains(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_pptx}) {
+            let directEditingCreator = directEditingCreators!.first(where: { $0.editor == k_editor_onlyoffice && $0.identifier == k_onlyoffice_pptx})!
             actions.append(
                 NCMenuAction(
                     title: NSLocalizedString("_create_new_presentation_", comment: ""),
@@ -197,7 +204,8 @@ extension AppDelegate {
                         navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
 
                         let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
-                        viewController.typeEditor = k_editor_onlyoffice
+                        viewController.editorId = k_editor_onlyoffice
+                        viewController.creatorId = directEditingCreator.identifier
                         viewController.typeTemplate = k_template_presentation
                         viewController.serverUrl = appDelegate.activeMain.serverUrl
                         viewController.titleForm = NSLocalizedString("_create_new_presentation_", comment: "")
@@ -221,7 +229,7 @@ extension AppDelegate {
                             navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
 
                             let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
-                            viewController.typeEditor = k_editor_collabora
+                            viewController.editorId = k_editor_collabora
                             viewController.typeTemplate = k_template_document
                             viewController.serverUrl = appDelegate.activeMain.serverUrl
                             viewController.titleForm = NSLocalizedString("_create_nextcloudtext_document_", comment: "")
@@ -242,7 +250,7 @@ extension AppDelegate {
                             navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
 
                             let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
-                            viewController.typeEditor = k_editor_collabora
+                            viewController.editorId = k_editor_collabora
                             viewController.typeTemplate = k_template_spreadsheet
                             viewController.serverUrl = appDelegate.activeMain.serverUrl
                             viewController.titleForm = NSLocalizedString("_create_new_spreadsheet_", comment: "")
@@ -263,7 +271,7 @@ extension AppDelegate {
                             navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
 
                             let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
-                            viewController.typeEditor = k_editor_collabora
+                            viewController.editorId = k_editor_collabora
                             viewController.typeTemplate = k_template_presentation
                             viewController.serverUrl = appDelegate.activeMain.serverUrl
                             viewController.titleForm = NSLocalizedString("_create_new_presentation_", comment: "")

+ 1 - 1
iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift

@@ -40,7 +40,7 @@ import SwiftRichString
         NCUtility.sharedInstance.startActivityIndicator(view: viewController.view, bottom: 0)
         
         let fileNamePath = CCUtility.returnFileNamePath(fromFileName: k_fileNameRichWorkspace, serverUrl: serverUrl, activeUrl: appDelegate.activeUrl)!
-        NCCommunication.sharedInstance.NCTextCreateFile(urlString: appDelegate.activeUrl, fileNamePath: fileNamePath, editor: "text", templateId: "", account: appDelegate.activeAccount) { (account, url, errorCode, errorMessage) in
+        NCCommunication.sharedInstance.NCTextCreateFile(urlString: appDelegate.activeUrl, fileNamePath: fileNamePath, editorId: "text", creatorId: "" ,templateId: "", account: appDelegate.activeAccount) { (account, url, errorCode, errorMessage) in
             
             NCUtility.sharedInstance.stopActivityIndicator()