marinofaggiana 4 years ago
parent
commit
b4f8724274
1 changed files with 11 additions and 1 deletions
  1. 11 1
      iOSClient/Files/NCFiles.swift

+ 11 - 1
iOSClient/Files/NCFiles.swift

@@ -26,6 +26,8 @@ import NCCommunication
 
 class NCFiles: NCCollectionViewCommon  {
     
+    internal var moveToOcId: String?
+
     required init?(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)
         
@@ -82,10 +84,18 @@ class NCFiles: NCCollectionViewCommon  {
             }
         }
         
-        self.dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, filterLivePhoto: true)
+        dataSource = NCDataSource.init(metadatasSource: metadatasSource, directoryOnTop: directoryOnTop, filterLivePhoto: true)
         
         refreshControl.endRefreshing()
         collectionView.reloadData()
+        
+        // Aumomatic move to
+        if moveToOcId != nil {
+            if let row = dataSource.getIndexMetadata(ocId: moveToOcId!) {
+                collectionView.scrollToItem(at: IndexPath(row: row, section: 0), at: .centeredVertically, animated: true)
+                moveToOcId = nil
+            }
+        }
     }
     
     override func reloadDataSourceNetwork(forced: Bool = false) {