Browse Source

move to NextcloudKit

Signed-off-by: marinofaggiana <marino.faggiana@nextcloud.com>
marinofaggiana 2 years ago
parent
commit
b9ae3f32ae

+ 1 - 1
iOSClient/Main/NCFunctionCenter.swift

@@ -167,7 +167,7 @@ import Photos
               account == appDelegate.account
         else { return }
 
-        if error != .success, error.errorCode != -999 {
+        if error != .success, error.errorCode != NSURLErrorCancelled, error.errorCode != NCGlobal.shared.errorRequestExplicityCancelled {
             NCContentPresenter.shared.messageNotification("_upload_file_", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
         }
     }

+ 1 - 0
iOSClient/NCGlobal.swift

@@ -230,6 +230,7 @@ class NCGlobal: NSObject {
     @objc let errorConflict: Int                    = 409
     @objc let errorPreconditionFailed: Int          = 412
     @objc let errorConnectionLost: Int              = -1005
+    @objc let errorNetworkNotAvailable: Int         = -1009
     @objc let errorBadServerResponse: Int           = -1011
     @objc let errorInternalError: Int               = -99999
     @objc let errorFileNotSaved: Int                = -99998

+ 1 - 1
iOSClient/Networking/NCNetworking.swift

@@ -120,7 +120,7 @@ import Photos
             lastReachability = true
         } else {
             if lastReachability {
-                let error = NKError(errorCode: -1009, errorDescription: "")
+                let error = NKError(errorCode: NCGlobal.shared.errorNetworkNotAvailable, errorDescription: "")
                 NCContentPresenter.shared.messageNotification("_network_not_available_", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info)
             }
             lastReachability = false

+ 1 - 3
iOSClient/Utility/NCContentPresenter.swift

@@ -97,9 +97,7 @@ class NCContentPresenter: NSObject {
     func messageNotification(_ title: String, error: NKError, delay: TimeInterval, type: messageType, priority: EKAttributes.Precedence.Priority = .normal, dropEnqueuedEntries: Bool = false) {
 
         // No notification message for:
-        if error.errorCode == -999 { return }         // Cancelled transfer
-        else if error.errorCode == 200 { return }     // Transfer stopped
-        else if error.errorCode == 207 { return }     // WebDAV multistatus
+        if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled { return }                                                   // Cancelled transfer
         else if error == .success && type == messageType.error { return }
 
         DispatchQueue.main.async {