Browse Source

Update NCCollectionViewCommon.swift

Marino Faggiana 1 year ago
parent
commit
1e0c0d95d2
1 changed files with 7 additions and 8 deletions
  1. 7 8
      iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

+ 7 - 8
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -484,22 +484,19 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         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 }
 
-        guard !isSearchingMode,
-              let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { return }
+        guard !isSearchingMode, let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { return }
 
         // Header view trasfer
         if metadata.isTransferInForeground() {
             self.ocIdTransferInForeground = ocId
-        } else {
+            self.collectionView?.reloadData()
+        } else if serverUrl == self.serverUrl, account == appDelegate.account {
             dataSource.addMetadata(metadata)
+            self.collectionView?.reloadData()
         }
-
-        self.collectionView?.reloadData()
     }
 
     @objc func uploadedFile(_ notification: NSNotification) {
@@ -511,6 +508,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
               account == appDelegate.account
         else { return }
 
+        self.ocIdTransferInForeground = nil
         reloadDataSource()
     }
 
@@ -523,6 +521,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
               account == appDelegate.account
         else { return }
 
+        self.ocIdTransferInForeground = nil
         reloadDataSource()
     }