|
@@ -484,24 +484,6 @@ import Queuer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- func uploadProgress(_ progress: Double, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask) {
|
|
|
- delegate?.uploadProgress?(progress, totalBytes: totalBytes, totalBytesExpected: totalBytesExpected, fileName: fileName, serverUrl: serverUrl, session: session, task: task)
|
|
|
-
|
|
|
- var metadata: tableMetadata?
|
|
|
- let description: String = task.taskDescription ?? ""
|
|
|
-
|
|
|
- if let metadataTmp = self.uploadMetadataInBackground[fileName+serverUrl] {
|
|
|
- metadata = metadataTmp
|
|
|
- } else if let metadataTmp = NCManageDatabase.shared.getMetadataFromOcId(description){
|
|
|
- self.uploadMetadataInBackground[fileName+serverUrl] = metadataTmp
|
|
|
- metadata = metadataTmp
|
|
|
- }
|
|
|
-
|
|
|
- if metadata != nil {
|
|
|
- NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterProgressTask, userInfo: ["account":metadata!.account, "ocId":metadata!.ocId, "serverUrl":serverUrl, "status":NSNumber(value: NCGlobal.shared.metadataStatusInUpload), "progress":NSNumber(value: progress), "totalBytes":NSNumber(value: totalBytes), "totalBytesExpected":NSNumber(value: totalBytesExpected)])
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
func uploadComplete(fileName: String, serverUrl: String, ocId: String?, etag: String?, date: NSDate?, size: Int64, description: String?, task: URLSessionTask, errorCode: Int, errorDescription: String) {
|
|
|
if delegate != nil {
|
|
|
delegate?.uploadComplete?(fileName: fileName, serverUrl: serverUrl, ocId: ocId, etag: etag, date: date, size:size, description: description, task: task, errorCode: errorCode, errorDescription: errorDescription)
|
|
@@ -605,6 +587,24 @@ import Queuer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ func uploadProgress(_ progress: Double, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask) {
|
|
|
+ delegate?.uploadProgress?(progress, totalBytes: totalBytes, totalBytesExpected: totalBytesExpected, fileName: fileName, serverUrl: serverUrl, session: session, task: task)
|
|
|
+
|
|
|
+ var metadata: tableMetadata?
|
|
|
+ let description: String = task.taskDescription ?? ""
|
|
|
+
|
|
|
+ if let metadataTmp = self.uploadMetadataInBackground[fileName+serverUrl] {
|
|
|
+ metadata = metadataTmp
|
|
|
+ } else if let metadataTmp = NCManageDatabase.shared.getMetadataFromOcId(description){
|
|
|
+ self.uploadMetadataInBackground[fileName+serverUrl] = metadataTmp
|
|
|
+ metadata = metadataTmp
|
|
|
+ }
|
|
|
+
|
|
|
+ if metadata != nil {
|
|
|
+ NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterProgressTask, userInfo: ["account":metadata!.account, "ocId":metadata!.ocId, "serverUrl":serverUrl, "status":NSNumber(value: NCGlobal.shared.metadataStatusInUpload), "progress":NSNumber(value: progress), "totalBytes":NSNumber(value: totalBytes), "totalBytesExpected":NSNumber(value: totalBytesExpected)])
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
func getOcIdInBackgroundSession(completion: @escaping (_ listOcId: [String])->()) {
|
|
|
|
|
|
var listOcId: [String] = []
|