marinofaggiana 4 жил өмнө
parent
commit
eb8f978b05

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -2806,8 +2806,8 @@
 			isa = XCRemoteSwiftPackageReference;
 			repositoryURL = "https://github.com/nextcloud/ios-communication-library/";
 			requirement = {
-				kind = exactVersion;
-				version = 0.90.0;
+				kind = revision;
+				revision = bf4a7a044ff9df2f334649314858ed0299cf21e2;
 			};
 		};
 		F7C4D88B2534887E00C142DA /* XCRemoteSwiftPackageReference "Parchment" */ = {

+ 2 - 2
Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -24,8 +24,8 @@
         "repositoryURL": "https://github.com/nextcloud/ios-communication-library/",
         "state": {
           "branch": null,
-          "revision": "8a886596b9f11af97e7a5ba296356cfa9c5bf8b5",
-          "version": "0.90.0"
+          "revision": "bf4a7a044ff9df2f334649314858ed0299cf21e2",
+          "version": null
         }
       },
       {

+ 40 - 0
iOSClient/Networking/NCNetworking.swift

@@ -1254,4 +1254,44 @@ import Queuer
             completion(errorCode, errorDescription)
         }
     }
+    
+    //MARK: - TEST API
+    
+    /*
+    @objc public func getAppPassword(serverUrl: String, username: String, password: String, customUserAgent: String? = nil, completionHandler: @escaping (_ token: String?, _ errorCode: Int, _ errorDescription: String) -> Void) {
+                
+        let endpoint = "/ocs/v2.php/core/getapppassword"
+        
+        let url:URLConvertible = try! (serverUrl + endpoint).asURL() as URLConvertible
+        var headers: HTTPHeaders = [.authorization(username: username, password: password)]
+        if customUserAgent != nil {
+            headers.update(.userAgent(customUserAgent!))
+        }
+        //headers.update(.contentType("application/json"))
+        headers.update(name: "OCS-APIRequest", value: "true")
+               
+        var urlRequest: URLRequest
+        do {
+            try urlRequest = URLRequest(url: url, method: HTTPMethod(rawValue: "GET"), headers: headers)
+        } catch {
+            completionHandler(nil, error._code, error.localizedDescription)
+            return
+        }
+        
+        AF.request(urlRequest).validate(statusCode: 200..<300).response { (response) in
+            debugPrint(response)
+            
+            switch response.result {
+            case .failure(let error):
+                completionHandler(nil, 0, "")
+            case .success(let data):
+                if let data = data {
+                    completionHandler("", 0, "")
+                } else {
+                    completionHandler(nil, NSURLErrorBadServerResponse, NSLocalizedString("_error_decode_xml_", value: "Invalid response, error decode XML", comment: ""))
+                }
+            }
+        }
+    }
+    */
 }