marinofaggiana 3 жил өмнө
parent
commit
cdf817899b

+ 1 - 1
Share/NCShareExtension.swift

@@ -89,7 +89,7 @@ class NCShareExtension: UIViewController, NCListCellDelegate, NCEmptyDataSetDele
         refreshControl.addTarget(self, action: #selector(reloadDatasource), for: .valueChanged)
         
         // Empty
-        emptyDataSet = NCEmptyDataSet.init(view: collectionView, offset: -100, delegate: self)
+        emptyDataSet = NCEmptyDataSet.init(view: collectionView, offset: 0, delegate: self)
         
         // Command view
         commandView.backgroundColor = NCBrandColor.shared.secondarySystemBackground

+ 14 - 10
iOSClient/EmptyView/NCEmptyDataSet.swift

@@ -30,20 +30,24 @@ class NCEmptyDataSet: NSObject {
             emptyView.isHidden = true
             emptyView.translatesAutoresizingMaskIntoConstraints = false
             
-            //emptyView.backgroundColor = .red
-            //emptyView.isHidden = false
+//            emptyView.backgroundColor = .red
+//            emptyView.isHidden = false
             
             emptyView.emptyTitle.sizeToFit()
             emptyView.emptyDescription.sizeToFit()
-            
+                          
             view.addSubview(emptyView)
-            
-            let constantTop: CGFloat = (view.frame.height - emptyView.frame.height) / 2 - offset
-            
-            emptyView.widthAnchor.constraint(equalToConstant: view.frame.width).isActive = true
-            emptyView.heightAnchor.constraint(equalToConstant: 350).isActive = true
-            emptyView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
-            emptyView.topAnchor.constraint(equalTo: view.topAnchor, constant: constantTop).isActive = true
+
+            emptyView.widthAnchor.constraint(equalToConstant: 350).isActive = true
+            emptyView.heightAnchor.constraint(equalToConstant: 250).isActive = true
+            if let view = view.superview {
+                emptyView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
+                emptyView.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: offset).isActive = true
+
+            } else {
+                emptyView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
+                emptyView.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: offset).isActive = true
+            }
         }
     }
     

+ 8 - 7
iOSClient/EmptyView/NCEmptyView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="retina3_5" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -12,24 +12,24 @@
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="NCEmptyView" customModule="Nextcloud" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
+            <rect key="frame" x="0.0" y="0.0" width="350" height="250"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
                 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="W3d-Us-kU4">
-                    <rect key="frame" x="85" y="0.0" width="150" height="150"/>
+                    <rect key="frame" x="100" y="0.0" width="150" height="150"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="150" id="A8B-y7-Fre"/>
                         <constraint firstAttribute="width" constant="150" id="g0C-P6-l3d"/>
                     </constraints>
                 </imageView>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="crs-DO-owR">
-                    <rect key="frame" x="0.0" y="180" width="320" height="24"/>
+                    <rect key="frame" x="0.0" y="180" width="350" height="24"/>
                     <fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
                     <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <nil key="highlightedColor"/>
                 </label>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D4p-sI-mNB">
-                    <rect key="frame" x="20" y="224" width="280" height="17"/>
+                    <rect key="frame" x="20" y="224" width="310" height="17"/>
                     <constraints>
                         <constraint firstAttribute="height" relation="lessThanOrEqual" constant="50" id="u7B-jW-bWI"/>
                     </constraints>
@@ -50,12 +50,13 @@
                 <constraint firstItem="W3d-Us-kU4" firstAttribute="centerX" secondItem="vUN-kp-3ea" secondAttribute="centerX" id="kma-1Q-c3Q"/>
                 <constraint firstItem="D4p-sI-mNB" firstAttribute="top" secondItem="crs-DO-owR" secondAttribute="bottom" constant="20" id="zbi-5P-raN"/>
             </constraints>
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
             <connections>
                 <outlet property="emptyDescription" destination="D4p-sI-mNB" id="4Rw-TK-oGc"/>
                 <outlet property="emptyImage" destination="W3d-Us-kU4" id="xtd-nV-OUc"/>
                 <outlet property="emptyTitle" destination="crs-DO-owR" id="IkU-6d-P64"/>
             </connections>
-            <point key="canvasLocation" x="-146" y="65"/>
+            <point key="canvasLocation" x="-146.25" y="32.5"/>
         </view>
     </objects>
     <resources>

+ 1 - 1
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -123,7 +123,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         refreshControl.addTarget(self, action: #selector(reloadDataSourceNetworkRefreshControl), for: .valueChanged)
         
         // Empty
-        emptyDataSet = NCEmptyDataSet.init(view: collectionView, offset: 0, delegate: self)
+        emptyDataSet = NCEmptyDataSet.init(view: collectionView, offset: headerHeight, delegate: self)
         
         // Long Press on CollectionView
         let longPressedGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPressCollecationView(_:)))

+ 2 - 1
iOSClient/Notification/NCNotification.swift

@@ -44,7 +44,8 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
         tableView.backgroundColor = NCBrandColor.shared.systemBackground
         
         // Empty
-        emptyDataSet = NCEmptyDataSet.init(view: tableView, offset: 0, delegate: self)
+        let offset = (self.navigationController?.navigationBar.bounds.height ?? 0) - 20
+        emptyDataSet = NCEmptyDataSet.init(view: tableView, offset: -offset, delegate: self)
         
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
         

+ 1 - 1
iOSClient/Select/NCSelect.swift

@@ -126,7 +126,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
         refreshControl.addTarget(self, action: #selector(loadDatasource), for: .valueChanged)
         
         // Empty
-        emptyDataSet = NCEmptyDataSet.init(view: collectionView, offset: 0, delegate: self)
+        emptyDataSet = NCEmptyDataSet.init(view: collectionView, offset: headerHeight, delegate: self)
 
         // Type of command view
         if typeOfCommandView == .select || typeOfCommandView == .selectCreateFolder {

+ 1 - 1
iOSClient/Trash/NCTrash.swift

@@ -81,7 +81,7 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
         refreshControl.addTarget(self, action: #selector(loadListingTrash), for: .valueChanged)
         
         // Empty
-        emptyDataSet = NCEmptyDataSet.init(view: collectionView, offset: -50, delegate: self)
+        emptyDataSet = NCEmptyDataSet.init(view: collectionView, offset: highHeader, delegate: self)
         
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSource), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadDataSource), object: nil)