marinofaggiana 4 жил өмнө
parent
commit
b300b454ff

+ 2 - 0
iOSClient/AppDelegate.h

@@ -37,6 +37,7 @@
 @class NCMedia;
 @class NCOffline;
 @class NCFavorite;
+@class NCTrash;
 @class NCAppConfigView;
 @class IMImagemeterViewer;
 @class NCDetailViewController;
@@ -94,6 +95,7 @@
 @property (nonatomic, retain) NCLoginWeb *activeLoginWeb;
 @property (nonatomic, retain) CCMore *activeMore;
 @property (nonatomic, retain) NCOffline *activeOffline;
+@property (nonatomic, retain) NCTrash *activeTrash;
 @property (nonatomic, retain) NCAppConfigView *appConfigView;
 @property (nonatomic, retain) IMImagemeterViewer *activeImagemeterView;
 

+ 1 - 1
iOSClient/Favorites/NCFavorite.swift

@@ -25,7 +25,7 @@ import Foundation
 
 class NCFavorite: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate  {
     
-    @IBOutlet fileprivate weak var collectionView: UICollectionView!
+    @IBOutlet weak var collectionView: UICollectionView!
 
     var titleCurrentFolder = NSLocalizedString("_favorites_", comment: "")
     @objc var serverUrl = ""

+ 0 - 1
iOSClient/Main/NCDetailViewController.swift

@@ -387,7 +387,6 @@ class NCDetailViewController: UIViewController {
                     navigationController.popViewController(animated: true)
                 }
             } else {
-                
                 closeAllSubView()
                 self.navigationController?.navigationBar.topItem?.title = ""
             }

+ 32 - 4
iOSClient/Main/NCSplitViewController.swift

@@ -65,12 +65,40 @@ class NCSplitViewController: UISplitViewController {
     }
     
     @objc func setPrimaryColumnWidth() {
-        if UIScreen.main.bounds.width > UIScreen.main.bounds.height {
-            self.maximumPrimaryColumnWidth = UIScreen.main.bounds.width
+        
+        var fraction: CGFloat = 0.4
+        let gap = 1.0 / self.traitCollection.displayScale
+        
+        if let detailNavigationController = self.viewControllers.last as? NCDetailNavigationController {
+            if let detailViewController = detailNavigationController.topViewController as? NCDetailViewController {
+                if detailViewController.metadata == nil {
+                    fraction = 1
+                }
+            }
+        }
+        
+        if fraction == 1 || self.isCollapsed {
+           if UIScreen.main.bounds.width > UIScreen.main.bounds.height {
+               self.maximumPrimaryColumnWidth = max(UIScreen.main.bounds.width - gap, UIScreen.main.bounds.height - gap)
+           } else {
+               self.maximumPrimaryColumnWidth = min(UIScreen.main.bounds.width - gap, UIScreen.main.bounds.height - gap)
+           }
         } else {
-            self.maximumPrimaryColumnWidth = UIScreen.main.bounds.height
+            if UIScreen.main.bounds.width > UIScreen.main.bounds.height {
+                self.maximumPrimaryColumnWidth = UIScreen.main.bounds.width
+            } else {
+                self.maximumPrimaryColumnWidth = UIScreen.main.bounds.height
+            }
+        }
+        
+        self.preferredPrimaryColumnWidthFraction = fraction
+        
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
+            self.appDelegate.activeMedia?.collectionView?.reloadData()
+            self.appDelegate.activeFavorite?.collectionView?.reloadData()
+            self.appDelegate.activeOffline?.collectionView?.reloadData()
+            self.appDelegate.activeTrash?.collectionView?.reloadData()
         }
-        self.preferredPrimaryColumnWidthFraction = 0.4
     }
 }
 

+ 1 - 1
iOSClient/Offline/NCOffline.swift

@@ -25,7 +25,7 @@ import Foundation
 
 class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate  {
     
-    @IBOutlet fileprivate weak var collectionView: UICollectionView!
+    @IBOutlet weak var collectionView: UICollectionView!
 
     var titleCurrentFolder = NSLocalizedString("_manage_file_offline_", comment: "")
     var serverUrl = ""

+ 7 - 1
iOSClient/Trash/NCTrash.swift

@@ -26,7 +26,7 @@ import NCCommunication
 
 class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDelegate, NCGridCellDelegate, NCTrashSectionHeaderMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate  {
     
-    @IBOutlet fileprivate weak var collectionView: UICollectionView!
+    @IBOutlet weak var collectionView: UICollectionView!
 
     var path = ""
     var titleCurrentFolder = NSLocalizedString("_trash_view_", comment: "")
@@ -51,6 +51,12 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
     
     private let refreshControl = UIRefreshControl()
 
+    required init?(coder aDecoder: NSCoder) {
+        super.init(coder: aDecoder)
+        
+        appDelegate.activeTrash = self
+    }
+    
     override func viewDidLoad() {
         super.viewDidLoad()