Эх сурвалжийг харах

normalized

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 жил өмнө
parent
commit
c9b2aedd99

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

@@ -311,16 +311,15 @@ import XLForm
         self.navigationItem.rightBarButtonItem?.isEnabled = false
 
         if self.editorId == NCGlobal.shared.editorText || self.editorId == NCGlobal.shared.editorOnlyoffice {
-
-            var customUserAgent: String?
-
+            
+            var options = NKRequestOptions()
             if self.editorId == NCGlobal.shared.editorOnlyoffice {
-                customUserAgent = NCUtility.shared.getCustomUserAgentOnlyOffice()
+                options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentOnlyOffice())
             } else if editorId == NCGlobal.shared.editorText {
-                customUserAgent = NCUtility.shared.getCustomUserAgentNCText()
-            } // else: use default
-
-            NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: editorId, creatorId: creatorId, templateId: templateIdentifier, customUserAgent: customUserAgent) { account, url, error in
+                options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentNCText())
+            }
+            
+            NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: editorId, creatorId: creatorId, templateId: templateIdentifier, options: options) { account, url, error in
                 guard error == .success, account == self.appDelegate.account, let url = url else {
                     self.navigationItem.rightBarButtonItem?.isEnabled = true
                     NCContentPresenter.shared.showError(error: error)
@@ -376,14 +375,14 @@ import XLForm
 
         if self.editorId == NCGlobal.shared.editorText || self.editorId == NCGlobal.shared.editorOnlyoffice {
 
-            var customUserAgent: String?
+            var options = NKRequestOptions()
             if self.editorId == NCGlobal.shared.editorOnlyoffice {
-                customUserAgent = NCUtility.shared.getCustomUserAgentOnlyOffice()
+                options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentOnlyOffice())
             } else if editorId == NCGlobal.shared.editorText {
-                customUserAgent = NCUtility.shared.getCustomUserAgentNCText()
-            } // else: use default
+                options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentNCText())
+            }
 
-            NextcloudKit.shared.NCTextGetListOfTemplates(customUserAgent: customUserAgent) { account, templates, error in
+            NextcloudKit.shared.NCTextGetListOfTemplates(options: options) { account, templates, error in
 
                 self.indicator.stopAnimating()
 

+ 2 - 1
iOSClient/Networking/NCService.swift

@@ -194,7 +194,8 @@ class NCService: NSObject {
 
             // Text direct editor detail
             if serverVersionMajor >= NCGlobal.shared.nextcloudVersion18 {
-                NextcloudKit.shared.NCTextObtainEditorDetails(queue: NKCommon.shared.backgroundQueue) { account, editors, creators, error in
+                let options = NKRequestOptions(queue: NKCommon.shared.backgroundQueue)
+                NextcloudKit.shared.NCTextObtainEditorDetails(options: options) { account, editors, creators, error in
                     if error == .success && account == self.appDelegate.account {
                         NCManageDatabase.shared.addDirectEditing(account: account, editors: editors, creators: creators)
                     }

+ 4 - 4
iOSClient/PushNotification/NCPushNotification.m

@@ -106,10 +106,10 @@
     NSString *pushDevicePublicKey = [[NSString alloc] initWithData:pushPublicKey encoding:NSUTF8StringEncoding];
     NSString *proxyServerPath = [NCBrandOptions shared].pushNotificationServerProxy;
     
-    [[NextcloudKit shared] subscribingPushNotificationWithServerUrl:urlBase account:account user:user password:[CCUtility getPassword:account] pushTokenHash:pushTokenHash devicePublicKey:pushDevicePublicKey proxyServerUrl:proxyServerPath customUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completionHandler:^(NSString *account, NSString *deviceIdentifier, NSString *signature, NSString *publicKey, NKError *error) {
+    [[NextcloudKit shared] subscribingPushNotificationWithServerUrl:urlBase account:account user:user password:[CCUtility getPassword:account] pushTokenHash:pushTokenHash devicePublicKey:pushDevicePublicKey proxyServerUrl:proxyServerPath customUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completion:^(NSString *account, NSString *deviceIdentifier, NSString *signature, NSString *publicKey, NKError *error) {
         if (error == NKError.success) {
             NSString *userAgent = [NSString stringWithFormat:@"%@  (Strict VoIP)", [CCUtility getUserAgent]];
-            [[NextcloudKit shared] subscribingPushProxyWithProxyServerUrl:proxyServerPath pushToken:self.pushKitToken deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completionHandler:^(NKError *error) {
+            [[NextcloudKit shared] subscribingPushProxyWithProxyServerUrl:proxyServerPath pushToken:self.pushKitToken deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completion:^(NKError *error) {
                 if (error == NKError.success) {
                     
                     [[NKCommon shared] writeLog:@"Subscribed to Push Notification server & proxy successfully"];
@@ -132,11 +132,11 @@
     NSString *signature = [CCUtility getPushNotificationDeviceIdentifierSignature:account];
     NSString *publicKey = [CCUtility getPushNotificationSubscribingPublicKey:account];
 
-    [[NextcloudKit shared] unsubscribingPushNotificationWithServerUrl:urlBase account:account user:user password:[CCUtility getPassword:account] customUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completionHandler:^(NSString *account, NKError *error) {
+    [[NextcloudKit shared] unsubscribingPushNotificationWithServerUrl:urlBase account:account user:user password:[CCUtility getPassword:account] customUserAgent:nil addCustomHeaders:nil queue:dispatch_get_main_queue() completion:^(NSString *account, NKError *error) {
         if (error == NKError.success) {
             NSString *userAgent = [NSString stringWithFormat:@"%@  (Strict VoIP)", [CCUtility getUserAgent]];
             NSString *proxyServerPath = [NCBrandOptions shared].pushNotificationServerProxy;
-            [[NextcloudKit shared] unsubscribingPushProxyWithProxyServerUrl:proxyServerPath deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completionHandler:^(NKError *error) {
+            [[NextcloudKit shared] unsubscribingPushProxyWithProxyServerUrl:proxyServerPath deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completion:^(NKError *error) {
                 if (error == NKError.success) {
                 
                     [[NKCommon shared] writeLog:@"Unsubscribed to Push Notification server & proxy successfully."];

+ 4 - 4
iOSClient/Viewer/NCViewer.swift

@@ -157,17 +157,17 @@ class NCViewer: NSObject {
 
                     if metadata.url == "" {
 
-                        var customUserAgent: String?
                         let fileNamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, account: metadata.account)!
 
+                        var options = NKRequestOptions()
                         if editor == NCGlobal.shared.editorOnlyoffice {
-                            customUserAgent = NCUtility.shared.getCustomUserAgentOnlyOffice()
+                            options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentOnlyOffice())
                         } else {
-                            customUserAgent = NCUtility.shared.getCustomUserAgentNCText()
+                            options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentNCText())
                         }
 
                         NCActivityIndicator.shared.start(backgroundView: viewController.view)
-                        NextcloudKit.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: editor, customUserAgent: customUserAgent) { account, url, error in
+                        NextcloudKit.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: editor, options: options) { account, url, error in
 
                             NCActivityIndicator.shared.stop()