marinofaggiana 4 years ago
parent
commit
b4c3dc8da6

+ 1 - 1
Nextcloud.xcodeproj/project.pbxproj

@@ -2811,7 +2811,7 @@
 			repositoryURL = "https://github.com/nextcloud/ios-communication-library/";
 			requirement = {
 				kind = revision;
-				revision = 653af65b02be51b14eaeed992015949c6b465f30;
+				revision = edf64f2145cf2205adfd502194643e3de2a00ea7;
 			};
 		};
 		F7C4D88B2534887E00C142DA /* XCRemoteSwiftPackageReference "Parchment" */ = {

+ 1 - 1
Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -24,7 +24,7 @@
         "repositoryURL": "https://github.com/nextcloud/ios-communication-library/",
         "state": {
           "branch": null,
-          "revision": "653af65b02be51b14eaeed992015949c6b465f30",
+          "revision": "edf64f2145cf2205adfd502194643e3de2a00ea7",
           "version": null
         }
       },

+ 1 - 6
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -549,16 +549,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     @objc func triggerProgressTask(_ notification: NSNotification) {
         if self.view?.window == nil { return }
         
-        if let userInfo = notification.userInfo as NSDictionary? {
+        if let userInfo = notification.userInfo as NSDictionary?, let progressNumber = userInfo["progress"] as? NSNumber, let totalBytes = userInfo["totalBytes"] as? Int64, let totalBytesExpected = userInfo["totalBytesExpected"] as? Int64 {
             if let ocId = userInfo["ocId"] as? String {
                 
-                let _ = userInfo["account"] as? String ?? ""
-                let _ = userInfo["serverUrl"] as? String ?? ""
-                let progressNumber = userInfo["progress"] as? NSNumber ?? 0
                 let progress = progressNumber.floatValue
                 let status = userInfo["status"] as? Int ?? NCGlobal.shared.metadataStatusNormal
-                let totalBytes = userInfo["totalBytes"] as? Int64 ?? 0
-                let totalBytesExpected = userInfo["totalBytesExpected"] as? Int64 ?? 0
                         
                 let progressType = NCGlobal.progressType(progress: progress, totalBytes: totalBytes, totalBytesExpected: totalBytesExpected)
                 appDelegate.listProgress[ocId] = progressType

+ 4 - 4
iOSClient/Networking/NCNetworking.swift

@@ -28,8 +28,8 @@ import Alamofire
 import Queuer
 
 @objc public protocol NCNetworkingDelegate {
-    @objc optional func downloadProgress(_ progress: Double, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask)
-    @objc optional func uploadProgress(_ progress: Double, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask)
+    @objc optional func downloadProgress(_ progress: Float, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask)
+    @objc optional func uploadProgress(_ progress: Float, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask)
     @objc optional func downloadComplete(fileName: String, serverUrl: String, etag: String?, date: NSDate?, dateLastModified: NSDate?, length: Int64, description: String?, task: URLSessionTask, errorCode: Int, errorDescription: String)
     @objc optional func uploadComplete(fileName: String, serverUrl: String, ocId: String?, etag: String?, date: NSDate?, size: Int64, description: String?, task: URLSessionTask, errorCode: Int, errorDescription: String)
 }
@@ -136,7 +136,7 @@ import Queuer
         }
     }
     
-    func downloadProgress(_ progress: Double, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask) {
+    func downloadProgress(_ progress: Float, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask) {
         delegate?.downloadProgress?(progress, totalBytes: totalBytes, totalBytesExpected: totalBytesExpected, fileName: fileName, serverUrl: serverUrl, session: session, task: task)
     }
     
@@ -587,7 +587,7 @@ import Queuer
         }
     }
     
-    func uploadProgress(_ progress: Double, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String, session: URLSession, task: URLSessionTask) {
+    func uploadProgress(_ progress: Float, 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?

+ 1 - 2
iOSClient/Viewer/NCViewerImage/NCViewerImage.swift

@@ -153,9 +153,8 @@ class NCViewerImage: UIViewController {
         if self.view?.window == nil { return }
         
         if let userInfo = notification.userInfo as NSDictionary? {
-            if let ocId = userInfo["ocId"] as? String {
+            if let ocId = userInfo["ocId"] as? String, let progressNumber = userInfo["progress"] as? NSNumber {
                 if self.metadatas.first(where: { $0.ocId == ocId }) != nil {
-                    let progressNumber = userInfo["progress"] as? NSNumber ?? 0
                     let progress = progressNumber.floatValue
                     if progress == 1 {
                         self.progressView.progress = 0