Browse Source

improved code

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 years ago
parent
commit
ea966cacde
1 changed files with 3 additions and 5 deletions
  1. 3 5
      iOSClient/Networking/NCConfigServer.swift

+ 3 - 5
iOSClient/Networking/NCConfigServer.swift

@@ -37,12 +37,11 @@ import NextcloudKit
         let defaultSession = URLSession(configuration: defaultSessionConfiguration, delegate: self, delegateQueue: nil)
 
         var urlRequest = URLRequest(url: url)
-        urlRequest.headers = NKCommon.shared.getStandardHeaders(nil, customUserAgent: nil)
+        urlRequest.headers = NKCommon.shared.getStandardHeaders()
 
         let dataTask = defaultSession.dataTask(with: urlRequest) { (data, response, error) in
             if let error = error {
-                let error = NKError(errorCode: error._code, errorDescription: error.localizedDescription)
-                NCContentPresenter.shared.showInfo(error: error)
+                NCContentPresenter.shared.showInfo(error: NKError(error: error))
             } else if let data = data {
                 DispatchQueue.main.async { self.start(data: data) }
             }
@@ -90,8 +89,7 @@ import NextcloudKit
                 registerForNotifications()
                 UIApplication.shared.open(url)
             } catch {
-                let error = NKError(errorCode: error._code, errorDescription: error.localizedDescription)
-                NCContentPresenter.shared.showInfo(error: error)
+                NCContentPresenter.shared.showInfo(error: NKError(error: error))
                 self.stop()
             }
         }