瀏覽代碼

coding

Signed-off-by: marinofaggiana <marino.faggiana@nextcloud.com>
marinofaggiana 2 年之前
父節點
當前提交
9500417fee
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      iOSClient/Networking/NCAutoUpload.swift

+ 7 - 2
iOSClient/Networking/NCAutoUpload.swift

@@ -241,10 +241,15 @@ class NCAutoUpload: NSObject {
                     #endif
                     let isWiFi = NCNetworking.shared.networkReachability == NCCommunicationCommon.typeReachability.reachableEthernetOrWiFi
                     if metadata.session == NCNetworking.shared.sessionIdentifierBackgroundWWan && !isWiFi { continue }
-                    if let metadata = NCManageDatabase.shared.setMetadataStatus(ocId: metadata.ocId, status: NCGlobal.shared.metadataStatusInUpload) {
-                        NCNetworking.shared.upload(metadata: metadata)
+                    guard let metadata = NCManageDatabase.shared.setMetadataStatus(ocId: metadata.ocId, status: NCGlobal.shared.metadataStatusInUpload) else { continue }
+                    // Upload 
+                    let semaphoreUpload = Semaphore()
+                    NCNetworking.shared.upload(metadata: metadata) {
                         numStartUpload += 1
+                    } completion: { errorCode, errorDescription in
+                        semaphoreUpload.continue()
                     }
+                    semaphoreUpload.wait()
                 }
                 semaphore.continue()
             }