Browse Source

Improvements

Marino Faggiana 1 year ago
parent
commit
bc775da8a5
1 changed files with 20 additions and 10 deletions
  1. 20 10
      iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

+ 20 - 10
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -502,27 +502,37 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     @objc func uploadedFile(_ notification: NSNotification) {
 
         guard let userInfo = notification.userInfo as NSDictionary?,
+              let ocId = userInfo["ocId"] as? String,
               let serverUrl = userInfo["serverUrl"] as? String,
-              serverUrl == self.serverUrl,
-              let account = userInfo["account"] as? String,
-              account == appDelegate.account
+              let account = userInfo["account"] as? String
         else { return }
 
-        self.ocIdTransferInForeground = nil
-        reloadDataSource()
+        if ocId == ocIdTransferInForeground {
+            ocIdTransferInForeground = nil
+            self.collectionView?.reloadData()
+        }
+
+        if account == appDelegate.account, serverUrl == self.serverUrl {
+            reloadDataSource()
+        }
     }
 
     @objc func uploadCancelFile(_ notification: NSNotification) {
 
         guard let userInfo = notification.userInfo as NSDictionary?,
+              let ocId = userInfo["ocId"] as? String,
               let serverUrl = userInfo["serverUrl"] as? String,
-              serverUrl == self.serverUrl,
-              let account = userInfo["account"] as? String,
-              account == appDelegate.account
+              let account = userInfo["account"] as? String
         else { return }
 
-        self.ocIdTransferInForeground = nil
-        reloadDataSource()
+        if ocId == ocIdTransferInForeground {
+            ocIdTransferInForeground = nil
+            self.collectionView?.reloadData()
+        }
+
+        if account == appDelegate.account, serverUrl == self.serverUrl {
+            reloadDataSource()
+        }
     }
 
     @objc func triggerProgressTask(_ notification: NSNotification) {