소스 검색

improved code

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 년 전
부모
커밋
fcc75eafa0
2개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 2
      iOSClient/Networking/NCNetworking.swift
  2. 1 1
      iOSClient/Networking/NCNetworkingChunkedUpload.swift

+ 4 - 2
iOSClient/Networking/NCNetworking.swift

@@ -421,7 +421,7 @@ import Photos
     }
 
     func uploadFile(metadata: tableMetadata, fileNameLocalPath: String, withUploadComplete: Bool = true ,addCustomHeaders: [String: String]? = nil,
-                    start: @escaping () -> Void,
+                    start: @escaping () -> () = { },
                     progressHandler: @escaping (_ totalBytesExpected: Int64, _ totalBytes: Int64, _ fractionCompleted: Double) -> () = { _, _, _ in },
                     completion: @escaping (_ account: String, _ ocId: String?, _ etag: String?, _ date: NSDate?, _ size: Int64, _ allHeaderFields: [AnyHashable : Any]?, _ afError: AFError?, _ error: NKError) -> Void) {
 
@@ -466,7 +466,9 @@ import Photos
         }
     }
 
-    private func uploadFileInBackground(metadata: tableMetadata, start: @escaping () -> Void, completion: @escaping (_ error: NKError) -> Void) {
+    private func uploadFileInBackground(metadata: tableMetadata,
+                                        start: @escaping () -> () = { },
+                                        completion: @escaping (_ error: NKError) -> Void) {
 
         var session: URLSession?
         let metadata = tableMetadata.init(value: metadata)

+ 1 - 1
iOSClient/Networking/NCNetworkingChunkedUpload.swift

@@ -27,7 +27,7 @@ import NextcloudKit
 extension NCNetworking {
 
     internal func uploadChunkedFile(metadata: tableMetadata,
-                                    start: @escaping () -> Void,
+                                    start: @escaping () -> () = { },
                                     progressHandler: @escaping (_ totalBytesExpected: Int64, _ totalBytes: Int64, _ fractionCompleted: Double) -> () = { _, _, _ in },
                                     completion: @escaping (_ error: NKError) -> Void) {