marinofaggiana 4 years ago
parent
commit
8df1b1ce71
1 changed files with 13 additions and 1 deletions
  1. 13 1
      iOSClient/Media/NCMedia.swift

+ 13 - 1
iOSClient/Media/NCMedia.swift

@@ -422,7 +422,19 @@ class NCMedia: UIViewController, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate,
         if let userInfo = notification.userInfo as NSDictionary? {
             if let metadata = userInfo["metadata"] as? tableMetadata {
                 if metadata.account == appDelegate.account {
-                    self.reloadDataSource()
+                    
+                    let indexes = self.metadatas.indices.filter { self.metadatas[$0].ocId == metadata.ocId }
+                    let metadatas = self.metadatas.filter { $0.ocId != metadata.ocId }
+                    self.metadatas = metadatas
+                    
+                    if self.metadatas.count == 0 {
+                        collectionView?.reloadData()
+                    } else if let row = indexes.first {
+                        let indexPath = IndexPath(row: row, section: 0)
+                        collectionView?.deleteItems(at: [indexPath])
+                    }
+                    
+                    self.updateMediaControlVisibility()
                 }
             }
         }