marinofaggiana il y a 4 ans
Parent
commit
ebabe90ea5

+ 27 - 0
iOSClient/FileViewInFolder/NCFileViewInFolder.swift

@@ -27,6 +27,7 @@ import NCCommunication
 class NCFileViewInFolder: NCCollectionViewCommon  {
     
     internal var isRoot: Bool = true
+    internal var fileName: String?
 
     required init?(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)
@@ -40,11 +41,37 @@ class NCFileViewInFolder: NCCollectionViewCommon  {
         DZNdescription = "_no_file_pull_down_"
     }
     
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+
+        appDelegate.activeViewController = self
+        
+        self.navigationItem.title = titleCurrentFolder
+                
+        (layout, _, _, groupBy, _, titleButton, itemForLine) = NCUtility.shared.getLayoutForView(key: layoutKey, serverUrl: serverUrl)
+        gridLayout.itemForLine = CGFloat(itemForLine)
+        
+        if layout == k_layout_list {
+            collectionView?.collectionViewLayout = listLayout
+        } else {
+            collectionView?.collectionViewLayout = gridLayout
+        }
+
+        self.navigationItem.rightBarButtonItem = nil
+        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_close_", comment: ""), style: .plain, target: self, action: #selector(tapClose(sender:)))
+       
+        reloadDataSource()
+    }
+    
     override func reloadDataSource(_ notification: NSNotification) {
         if self.view?.window == nil { return }
         reloadDataSource()
     }
     
+    @objc func tapClose(sender: Any) {
+        dismiss(animated: true, completion: nil)
+    }
+    
     // MARK: - DataSource + NC Endpoint
     
     override func reloadDataSource() {

+ 1 - 0
iOSClient/Main/NCCollectionCommon.swift

@@ -131,6 +131,7 @@ class NCCollectionCommon: NSObject, NCSelectDelegate {
         let navigationController = UINavigationController.init(rootViewController: viewController)
 
         viewController.serverUrl = serverUrl
+        viewController.fileName = fileName
         
         navigationController.modalPresentationStyle = UIModalPresentationStyle.fullScreen
         appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil)

+ 2 - 2
iOSClient/Main/NCCollectionViewCommon.swift

@@ -51,8 +51,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     private var autoUploadFileName = ""
     private var autoUploadDirectory = ""
         
-    private var listLayout: NCListLayout!
-    private var gridLayout: NCGridLayout!
+    internal var listLayout: NCListLayout!
+    internal var gridLayout: NCGridLayout!
             
     private let headerHeight: CGFloat = 50
     private var headerRichWorkspaceHeight: CGFloat = 0