Browse Source

Fix share permission for iOS 12 iPhone SE 1st gen

- toggle icon too big
- tableHeader too small, cropped

Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
Henrik Storch 3 years ago
parent
commit
3f77c4454b

+ 0 - 0
iOSClient/Images.xcassets/lock.open.imageset/Contents.json → iOSClient/Images.xcassets/lock_open.imageset/Contents.json


+ 0 - 0
iOSClient/Images.xcassets/lock.open.imageset/lock-open-variant-outline.svg → iOSClient/Images.xcassets/lock_open.imageset/lock-open-variant-outline.svg


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

@@ -78,11 +78,13 @@ class NCShareAdvancePermission: UITableViewController, NCShareAdvanceFotterDeleg
         guard let headerView = (Bundle.main.loadNibNamed("NCShareAdvancePermissionHeader", owner: self, options: nil)?.first as? NCShareAdvancePermissionHeader) else { return }
         headerView.setupUI(with: metadata)
 
-        headerView.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: 200)
-        tableView.tableHeaderView = headerView
+        let container = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 220))
+        container.addSubview(headerView)
+        tableView.tableHeaderView = container
         headerView.translatesAutoresizingMaskIntoConstraints = false
-        headerView.heightAnchor.constraint(equalToConstant: 200).isActive = true
-        headerView.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor).isActive = true
+        headerView.topAnchor.constraint(equalTo: container.topAnchor).isActive = true
+        headerView.heightAnchor.constraint(equalTo: container.heightAnchor).isActive = true
+        headerView.widthAnchor.constraint(equalTo: container.widthAnchor).isActive = true
     }
 
     override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {

+ 8 - 8
iOSClient/Share/Advanced/NCShareAdvancePermissionHeader.xib

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
-    <device id="retina6_1" orientation="portrait" appearance="light"/>
+    <device id="retina4_7" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
@@ -11,24 +11,24 @@
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <view contentMode="scaleToFill" id="wbW-yR-MZC" customClass="NCShareAdvancePermissionHeader" customModule="Nextcloud" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="414" height="260"/>
+            <rect key="frame" x="0.0" y="0.0" width="414" height="210"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
                 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="cki-Ql-o1I">
-                    <rect key="frame" x="0.0" y="44" width="414" height="150"/>
+                    <rect key="frame" x="0.0" y="0.0" width="414" height="150"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="150" id="9GH-KF-f8P"/>
                     </constraints>
                 </imageView>
                 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Dkw-QP-be6">
-                    <rect key="frame" x="16" y="71" width="96" height="96"/>
+                    <rect key="frame" x="16" y="27" width="96" height="96"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="96" id="TW7-8v-NRJ"/>
                         <constraint firstAttribute="width" constant="96" id="Vbz-xZ-L5k"/>
                     </constraints>
                 </imageView>
                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bm4-az-bTg">
-                    <rect key="frame" x="16" y="210" width="24" height="24"/>
+                    <rect key="frame" x="16" y="166" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="width" constant="24" id="CkU-6s-pzs"/>
                         <constraint firstAttribute="height" constant="24" id="RfD-cs-o1s"/>
@@ -36,13 +36,13 @@
                     <state key="normal" image="star.fill"/>
                 </button>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pu4-Nd-M08">
-                    <rect key="frame" x="48" y="213" width="351" height="18"/>
+                    <rect key="frame" x="48" y="169" width="351" height="18"/>
                     <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
                     <nil key="textColor"/>
                     <nil key="highlightedColor"/>
                 </label>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VaC-Fz-kHk">
-                    <rect key="frame" x="48" y="235" width="351" height="16"/>
+                    <rect key="frame" x="48" y="191" width="351" height="16"/>
                     <fontDescription key="fontDescription" type="system" pointSize="13"/>
                     <color key="textColor" red="0.76862745099999996" green="0.77647058820000003" blue="0.77647058820000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     <nil key="highlightedColor"/>
@@ -72,7 +72,7 @@
                 <outlet property="imageView" destination="Dkw-QP-be6" id="wzX-Sb-Ajt"/>
                 <outlet property="info" destination="VaC-Fz-kHk" id="n9O-6c-qsd"/>
             </connections>
-            <point key="canvasLocation" x="36.231884057971016" y="59.598214285714285"/>
+            <point key="canvasLocation" x="35.625" y="27.5"/>
         </view>
     </objects>
     <resources>

+ 2 - 2
iOSClient/Share/Advanced/NCShareCells.swift

@@ -170,7 +170,7 @@ enum NCShareDetails: CaseIterable, NCShareCellConfig {
             return NCShareToggleCell(isOn: share.hideDownload)
         case .expirationDate:
             return NCShareDateCell(share: share)
-        case .password: return NCShareToggleCell(isOn: !share.password.isEmpty, customIcons: ("lock", "lock.open"))
+        case .password: return NCShareToggleCell(isOn: !share.password.isEmpty, customIcons: ("lock", "lock_open"))
         case .note:
             let cell = UITableViewCell(style: .value1, reuseIdentifier: "shareNote")
             cell.detailTextLabel?.text = share.note
@@ -246,7 +246,7 @@ class NCShareToggleCell: UITableViewCell {
             self.accessoryType = isOn ? .checkmark : .none
             return
         }
-        let image = NCUtility.shared.loadImage(named: iconName, color: NCBrandColor.shared.brandElement)
+        let image = NCUtility.shared.loadImage(named: iconName, color: NCBrandColor.shared.brandElement, size: self.frame.height - 26)
         self.accessoryView = UIImageView(image: image)
     }