Эх сурвалжийг харах

Fix share permission footerView

- can't use auto layout, use container view instead and apply autplayout to container
- tableView only reads frame.x and height, rest is ignored

Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
Henrik Storch 3 жил өмнө
parent
commit
d3c85de1d7

+ 9 - 6
iOSClient/Share/Advanced/NCShareAdvancePermission.swift

@@ -64,12 +64,15 @@ class NCShareAdvancePermission: UITableViewController, NCShareAdvanceFotterDeleg
         guard let footerView = (Bundle.main.loadNibNamed("NCShareAdvancePermissionFooter", owner: self, options: nil)?.first as? NCShareAdvancePermissionFooter) else { return }
         footerView.setupUI(delegate: self)
 
-        footerView.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: 120)
-        tableView.tableFooterView = footerView
-        tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 120, right: 0)
-        footerView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true
-        footerView.heightAnchor.constraint(equalToConstant: 120).isActive = true
-        footerView.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor).isActive = true
+        // tableFooterView can't use auto layout directly
+        let container = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 120))
+        container.backgroundColor = .blue
+        container.addSubview(footerView)
+        tableView.tableFooterView = container
+        footerView.translatesAutoresizingMaskIntoConstraints = false
+        footerView.bottomAnchor.constraint(equalTo: container.bottomAnchor).isActive = true
+        footerView.heightAnchor.constraint(equalTo: container.heightAnchor).isActive = true
+        footerView.widthAnchor.constraint(equalTo: container.widthAnchor).isActive = true
     }
 
     func setupHeaderView() {

+ 1 - 1
iOSClient/Share/Advanced/NCShareAdvancePermissionFooter.swift

@@ -36,7 +36,7 @@ class NCShareAdvancePermissionFooter: UIView {
     func setupUI(delegate: NCShareAdvanceFotterDelegate?) {
         self.delegate = delegate
 
-        backgroundColor = .clear
+        backgroundColor = .red
 
         buttonCancel.addTarget(self, action: #selector(cancelClicked), for: .touchUpInside)
         buttonCancel.setTitle(NSLocalizedString("_cancel_", comment: ""), for: .normal)

+ 3 - 3
iOSClient/Share/Advanced/NCShareAdvancePermissionFooter.xib

@@ -15,7 +15,7 @@
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
                 <button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="249" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Mg2-Ou-yoX">
-                    <rect key="frame" x="16" y="212" width="351" height="50"/>
+                    <rect key="frame" x="16" y="128" width="351" height="50"/>
                     <color key="backgroundColor" red="0.8862745098" green="0.0" blue="0.4549019608" alpha="1" colorSpace="calibratedRGB"/>
                     <state key="normal" title="Send share"/>
                     <state key="highlighted">
@@ -23,7 +23,7 @@
                     </state>
                 </button>
                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rCI-63-PtL">
-                    <rect key="frame" x="383" y="212" width="351" height="50"/>
+                    <rect key="frame" x="383" y="128" width="351" height="50"/>
                     <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="50" id="vdI-sH-cTb"/>
@@ -38,7 +38,7 @@
             <constraints>
                 <constraint firstItem="rCI-63-PtL" firstAttribute="leading" secondItem="Mg2-Ou-yoX" secondAttribute="trailing" constant="16" id="4Px-cS-Hta"/>
                 <constraint firstItem="Mg2-Ou-yoX" firstAttribute="leading" secondItem="sWQ-1v-CIt" secondAttribute="leading" constant="16" id="Jdi-WJ-zVF"/>
-                <constraint firstItem="sWQ-1v-CIt" firstAttribute="bottom" secondItem="Mg2-Ou-yoX" secondAttribute="bottom" id="SzT-aI-aUz"/>
+                <constraint firstItem="sWQ-1v-CIt" firstAttribute="centerY" secondItem="Mg2-Ou-yoX" secondAttribute="centerY" id="SzT-aI-aUz"/>
                 <constraint firstItem="Mg2-Ou-yoX" firstAttribute="height" secondItem="rCI-63-PtL" secondAttribute="height" id="bNp-Nf-uMw"/>
                 <constraint firstItem="Mg2-Ou-yoX" firstAttribute="width" secondItem="rCI-63-PtL" secondAttribute="width" id="dfu-GZ-P99"/>
                 <constraint firstItem="rCI-63-PtL" firstAttribute="centerY" secondItem="Mg2-Ou-yoX" secondAttribute="centerY" id="hEl-ij-sMX"/>

+ 4 - 12
iOSClient/Share/NCShareCommentsCell.swift

@@ -38,24 +38,16 @@ class NCShareCommentsCell: UITableViewCell, NCCellProtocol {
     weak var delegate: NCShareCommentsCellDelegate?
 
     var filePreviewImageView: UIImageView? {
-        get {
-            return nil
-        }
+        return nil
     }
     var fileAvatarImageView: UIImageView? {
-        get {
-            return imageItem
-        }
+        return imageItem
     }
     var fileObjectId: String? {
-        get {
-            return nil
-        }
+        return nil
     }
     var fileUser: String? {
-        get {
-            return tableComments?.actorId
-        }
+        return tableComments?.actorId
     }
 
     override func awakeFromNib() {