marinofaggiana 4 жил өмнө
parent
commit
7c81b62288

+ 2 - 2
iOSClient/CCGlobal.h

@@ -318,9 +318,9 @@
 #define k_notificationCenter_reloadDataSource           @"reloadDataSource"                 // userInfo: ocId?, serverUrl?
 #define k_notificationCenter_reloadMediaDataSource      @"reloadMediaDataSource"
 
-#define k_notificationCenter_uploadFileStart            @"uploadFileStart"                  // userInfo: metadata, task, serverUrl, account
+#define k_notificationCenter_uploadFileStart            @"uploadFileStart"                  // userInfo: metadata
 #define k_notificationCenter_uploadedFile               @"uploadedFile"                     // userInfo: metadata, errorCode, errorDescription
-#define k_notificationCenter_downloadFileStart          @"downloadFileStart"                // userInfo: metadata, serverUrl, account
+#define k_notificationCenter_downloadFileStart          @"downloadFileStart"                // userInfo: metadata
 #define k_notificationCenter_downloadedFile             @"downloadedFile"                   // userInfo: metadata, selector, errorCode, errorDescription
 #define k_notificationCenter_progressTask               @"progressTask"                     // userInfo: account, ocId, serverUrl, status, progress, totalBytes, totalBytesExpected
 #define k_notificationCenter_createFolder               @"createFolder"                     // userInfo: fileName, serverUrl, errorCode, errorDescription

+ 2 - 2
iOSClient/Favorites/NCFavorite.swift

@@ -184,8 +184,8 @@ class NCFavorite: UIViewController, UIGestureRecognizerDelegate, NCListCellDeleg
         if self.view?.window == nil { return }
         
         if let userInfo = notification.userInfo as NSDictionary? {
-            if let metadata = userInfo["metadata"] as? tableMetadata , let serverUrl = userInfo["serverUrl"] as? String{
-                if serverUrl == self.serverUrl {
+            if let metadata = userInfo["metadata"] as? tableMetadata {
+                if metadata.serverUrl == self.serverUrl && metadata.account == appDelegate.account {
                     self.dataSource?.addMetadata(metadata)
                     collectionView.reloadData()
                 }

+ 2 - 2
iOSClient/Networking/NCNetworking.swift

@@ -248,7 +248,7 @@ import Queuer
             self.downloadRequest[fileNameLocalPath] = request
             
             NCManageDatabase.sharedInstance.setMetadataSession(ocId: metadata.ocId, status: Int(k_metadataStatusDownloading))
-            NotificationCenter.default.postOnMainThread(name: k_notificationCenter_downloadFileStart, userInfo: ["metadata":metadata, "serverUrl":metadata.serverUrl, "account":metadata.account])
+            NotificationCenter.default.postOnMainThread(name: k_notificationCenter_downloadFileStart, userInfo: ["metadata":metadata])
             
         }, progressHandler: { (progress) in
             
@@ -409,7 +409,7 @@ import Queuer
             CCGraphics.createNewImage(from: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, typeFile: metadata.typeFile)
             #endif
             
-            NotificationCenter.default.postOnMainThread(name: k_notificationCenter_uploadFileStart, userInfo: ["metadata":metadata, "task":task, "serverUrl":metadata.serverUrl, "account":metadata.account])
+            NotificationCenter.default.postOnMainThread(name: k_notificationCenter_uploadFileStart, userInfo: ["metadata":metadata])
             NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSource, userInfo: ["ocId":metadata.ocId, "serverUrl":metadata.serverUrl])
             
             completion(0, "")

+ 1 - 1
iOSClient/Networking/NCNetworkingE2EE.swift

@@ -232,7 +232,7 @@ import Alamofire
                     NCNetworking.shared.uploadRequest[fileNameLocalPath] = request
                     NCManageDatabase.sharedInstance.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: nil, sessionSelector: nil, sessionTaskIdentifier: nil, status: Int(k_metadataStatusUploading))
                     
-                    NotificationCenter.default.postOnMainThread(name: k_notificationCenter_uploadFileStart, userInfo: ["metadata":metadata, "serverUrl":serverUrl, "account": metadata.account])
+                    NotificationCenter.default.postOnMainThread(name: k_notificationCenter_uploadFileStart, userInfo: ["metadata":metadata])
                     
                 }, progressHandler: { (progress) in
                     

+ 0 - 8
iOSClient/Networking/NCNetworkingNotificationCenter.swift

@@ -27,10 +27,8 @@ import Foundation
     @objc public static let shared: NCNetworkingNotificationCenter = {
         let instance = NCNetworkingNotificationCenter()
         
-        NotificationCenter.default.addObserver(instance, selector: #selector(downloadFileStart(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_downloadFileStart), object: nil)
         NotificationCenter.default.addObserver(instance, selector: #selector(downloadedFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_downloadedFile), object: nil)
 
-        NotificationCenter.default.addObserver(instance, selector: #selector(uploadFileStart(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_uploadFileStart), object: nil)
         NotificationCenter.default.addObserver(instance, selector: #selector(uploadedFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_uploadedFile), object: nil)
         
         return instance
@@ -41,9 +39,6 @@ import Foundation
     
     //MARK: - Download
 
-    @objc func downloadFileStart(_ notification: NSNotification) {
-    }
-    
     @objc func downloadedFile(_ notification: NSNotification) {
             
         if let userInfo = notification.userInfo as NSDictionary? {
@@ -137,9 +132,6 @@ import Foundation
     
     //MARK: - Upload
 
-    @objc func uploadFileStart(_ notification: NSNotification) {
-    }
-    
     @objc func uploadedFile(_ notification: NSNotification) {
     
         if let userInfo = notification.userInfo as NSDictionary? {