marinofaggiana 4 gadi atpakaļ
vecāks
revīzija
fa7aac6e58

+ 1 - 0
iOSClient/NCGlobal.swift

@@ -137,6 +137,7 @@ class NCGlobal: NSObject {
     @objc let errorResourceNotFound: Int            = 404
     @objc let errordMethodNotSupported: Int         = 405
     @objc let errorConflict: Int                    = 409
+    @objc let errorConnectionLost: Int              = -1005
     @objc let errorBadServerResponse: Int           = -1011
     @objc let errorInternalError: Int               = -99999
     @objc let errorFileNotSaved: Int                = -99998

+ 10 - 3
iOSClient/Networking/NCNetworkingChunkedUpload.swift

@@ -191,6 +191,8 @@ extension NCNetworking {
     }
 
     private func uploadChunkFileError(metadata: tableMetadata, chunkFolderPath: String, directoryProviderStorageOcId: String, errorCode: Int, errorDescription: String) {
+              
+        var errorDescription = errorDescription
         
         if errorCode == NSURLErrorCancelled || errorCode == NCGlobal.shared.errorRequestExplicityCancelled {
             
@@ -204,11 +206,16 @@ extension NCNetworking {
             NCCommunication.shared.deleteFileOrFolder(chunkFolderPath) { (_, _, _) in }
             
         } else {
+            
+            // NO report for the connection lost
+            if errorCode == NCGlobal.shared.errorConnectionLost {
+                errorDescription = ""
+            } else {
+                let description = errorDescription + " code: \(errorCode)"
+                NCContentPresenter.shared.messageNotification("_error_", description: description, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError, forced: true)
+            }
                         
             NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: errorDescription, sessionTaskIdentifier: NCGlobal.shared.metadataStatusNormal, status: NCGlobal.shared.metadataStatusUploadError)
-            
-            let description = errorDescription + " code: \(errorCode)"
-            NCContentPresenter.shared.messageNotification("_error_", description: description, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError, forced: true)
         }
         
         NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource, userInfo: ["serverUrl":metadata.serverUrl])