IOS-1823- layout improvements IOS-1823
authorMartin Brude
Wed, 05 Feb 2020 16:35:04 +0100
branchIOS-1823
changeset 116717cd6dd6dc713
parent 11670 4f013cbb0114
child 11672 d39001d2062c
IOS-1823- layout improvements
pEpForiOS/Base.lproj/Handshake.storyboard
pEpForiOS/UI/Handshake/CellsAndSections/HandshakePartnerTableViewCell.swift
pEpForiOS/UI/Handshake/HandshakeViewController.swift
     1.1 --- a/pEpForiOS/Base.lproj/Handshake.storyboard	Wed Feb 05 16:13:23 2020 +0100
     1.2 +++ b/pEpForiOS/Base.lproj/Handshake.storyboard	Wed Feb 05 16:35:04 2020 +0100
     1.3 @@ -11,7 +11,7 @@
     1.4          <scene sceneID="IVD-QH-CTl">
     1.5              <objects>
     1.6                  <tableViewController storyboardIdentifier="HandshakeViewControllerID" id="Jbh-LP-Jl1" customClass="HandshakeViewController" customModule="pEpForiOS" customModuleProvider="target" sceneMemberID="viewController">
     1.7 -                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="297" sectionHeaderHeight="28" sectionFooterHeight="28" id="oZy-Mt-k2w" userLabel="HandshakeTableView">
     1.8 +                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="297" sectionHeaderHeight="28" sectionFooterHeight="28" id="oZy-Mt-k2w" userLabel="HandshakeTableView">
     1.9                          <rect key="frame" x="0.0" y="0.0" width="375" height="623"/>
    1.10                          <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
    1.11                          <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
    1.12 @@ -47,7 +47,7 @@
    1.13                                                                      <nil key="textColor"/>
    1.14                                                                      <nil key="highlightedColor"/>
    1.15                                                                  </label>
    1.16 -                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" text="Privacy Status: Mistrusted" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5RJ-Gx-qBT" userLabel="PrivacyStatusLabel">
    1.17 +                                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" text="Mistrusted" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5RJ-Gx-qBT" userLabel="PrivacyStatusLabel">
    1.18                                                                      <rect key="frame" x="78" y="57" width="221" height="18"/>
    1.19                                                                      <accessibility key="accessibilityConfiguration" identifier="privacyStatusTitle"/>
    1.20                                                                      <fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
    1.21 @@ -94,13 +94,13 @@
    1.22                                                      <edgeInsets key="layoutMargins" top="0.0" left="8" bottom="0.0" right="8"/>
    1.23                                                  </stackView>
    1.24                                                  <stackView opaque="NO" contentMode="scaleToFill" verticalCompressionResistancePriority="751" distribution="fillProportionally" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="YPS-lz-S3W" userLabel="TrustwordsStackView">
    1.25 -                                                    <rect key="frame" x="0.0" y="152.5" width="335" height="42.5"/>
    1.26 +                                                    <rect key="frame" x="0.0" y="152.5" width="335" height="45"/>
    1.27                                                      <subviews>
    1.28                                                          <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oHb-H9-PNk">
    1.29 -                                                            <rect key="frame" x="8" y="0.0" width="335" height="42.5"/>
    1.30 +                                                            <rect key="frame" x="8" y="0.0" width="335" height="45"/>
    1.31                                                              <subviews>
    1.32                                                                  <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="OUTDISTANCE BLAH BLAH2 BLAH3 BLAH4 BLAH5" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lHS-sc-yWR" userLabel="TrustWordsLabel">
    1.33 -                                                                    <rect key="frame" x="0.0" y="0.0" width="225.5" height="42.5"/>
    1.34 +                                                                    <rect key="frame" x="0.0" y="0.0" width="225.5" height="45"/>
    1.35                                                                      <accessibility key="accessibilityConfiguration" label="trustWordsLabel"/>
    1.36                                                                      <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
    1.37                                                                      <nil key="textColor"/>
    1.38 @@ -129,10 +129,10 @@
    1.39                                                      <edgeInsets key="layoutMargins" top="0.0" left="8" bottom="0.0" right="8"/>
    1.40                                                  </stackView>
    1.41                                                  <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gRz-Yh-xsS" userLabel="TrustButtonsView">
    1.42 -                                                    <rect key="frame" x="0.0" y="215" width="335" height="36.5"/>
    1.43 +                                                    <rect key="frame" x="0.0" y="217.5" width="335" height="50"/>
    1.44                                                      <subviews>
    1.45                                                          <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="wordWrap" translatesAutoresizingMaskIntoConstraints="NO" id="dbO-2K-SpB" userLabel="WrongButton">
    1.46 -                                                            <rect key="frame" x="5" y="0.0" width="60" height="36.5"/>
    1.47 +                                                            <rect key="frame" x="5" y="0.0" width="60" height="50"/>
    1.48                                                              <accessibility key="accessibilityConfiguration" label="wrongButton"/>
    1.49                                                              <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
    1.50                                                              <state key="normal" title="Decline"/>
    1.51 @@ -141,7 +141,7 @@
    1.52                                                              </connections>
    1.53                                                          </button>
    1.54                                                          <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="wordWrap" translatesAutoresizingMaskIntoConstraints="NO" id="Jgi-7k-Ymf" userLabel="ConfirmButton">
    1.55 -                                                            <rect key="frame" x="75" y="2" width="65" height="33"/>
    1.56 +                                                            <rect key="frame" x="75" y="8.5" width="65" height="33"/>
    1.57                                                              <accessibility key="accessibilityConfiguration" label="confirmButton"/>
    1.58                                                              <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
    1.59                                                              <state key="normal" title="Confirm"/>
    1.60 @@ -162,16 +162,16 @@
    1.61                                                      </constraints>
    1.62                                                  </view>
    1.63                                                  <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UNj-9e-eiX" userLabel="ResetContainer">
    1.64 -                                                    <rect key="frame" x="0.0" y="271.5" width="335" height="58.5"/>
    1.65 +                                                    <rect key="frame" x="0.0" y="287.5" width="335" height="42.5"/>
    1.66                                                      <subviews>
    1.67                                                          <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Reset all pEp data for this comunication partner:" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="L03-Re-fn4" userLabel="Reset Label">
    1.68 -                                                            <rect key="frame" x="0.0" y="8" width="199.5" height="42.5"/>
    1.69 +                                                            <rect key="frame" x="0.0" y="0.0" width="199.5" height="42.5"/>
    1.70                                                              <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
    1.71                                                              <nil key="textColor"/>
    1.72                                                              <nil key="highlightedColor"/>
    1.73                                                          </label>
    1.74                                                          <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ekO-aK-vFP">
    1.75 -                                                            <rect key="frame" x="207.5" y="13.5" width="54" height="32"/>
    1.76 +                                                            <rect key="frame" x="207.5" y="5.5" width="54" height="32"/>
    1.77                                                              <color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
    1.78                                                              <fontDescription key="fontDescription" type="system" pointSize="17"/>
    1.79                                                              <inset key="contentEdgeInsets" minX="5" minY="0.0" maxX="5" maxY="0.0"/>
    1.80 @@ -183,11 +183,11 @@
    1.81                                                      <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
    1.82                                                      <constraints>
    1.83                                                          <constraint firstItem="L03-Re-fn4" firstAttribute="leading" secondItem="UNj-9e-eiX" secondAttribute="leading" id="3Ch-7r-I1a"/>
    1.84 -                                                        <constraint firstAttribute="bottom" secondItem="L03-Re-fn4" secondAttribute="bottom" constant="8" id="7fe-zD-5fZ"/>
    1.85 +                                                        <constraint firstItem="L03-Re-fn4" firstAttribute="centerY" secondItem="UNj-9e-eiX" secondAttribute="centerY" id="3lF-bs-hBM"/>
    1.86 +                                                        <constraint firstAttribute="bottom" secondItem="L03-Re-fn4" secondAttribute="bottom" id="7fe-zD-5fZ"/>
    1.87                                                          <constraint firstItem="ekO-aK-vFP" firstAttribute="leading" secondItem="L03-Re-fn4" secondAttribute="trailing" constant="8" id="VUi-Wn-eJv"/>
    1.88                                                          <constraint firstItem="ekO-aK-vFP" firstAttribute="centerY" secondItem="UNj-9e-eiX" secondAttribute="centerY" id="Xt1-q4-Kqi"/>
    1.89                                                          <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ekO-aK-vFP" secondAttribute="trailing" constant="8" id="qam-G7-eu8"/>
    1.90 -                                                        <constraint firstItem="L03-Re-fn4" firstAttribute="top" relation="greaterThanOrEqual" secondItem="UNj-9e-eiX" secondAttribute="top" constant="8" id="yqI-CS-vGg"/>
    1.91                                                      </constraints>
    1.92                                                  </view>
    1.93                                              </subviews>
     2.1 --- a/pEpForiOS/UI/Handshake/CellsAndSections/HandshakePartnerTableViewCell.swift	Wed Feb 05 16:13:23 2020 +0100
     2.2 +++ b/pEpForiOS/UI/Handshake/CellsAndSections/HandshakePartnerTableViewCell.swift	Wed Feb 05 16:35:04 2020 +0100
     2.3 @@ -161,7 +161,7 @@
     2.4              let spacedTrustwords = trustwords.replacingOccurrences(of: " ", with: "   ")
     2.5              trustWordsLabel.text = "\(spacedTrustwords) …"
     2.6          } else {
     2.7 -            trustWordsLabel.text = viewModel?.trustwords
     2.8 +            trustWordsLabel.text = viewModel?.trustwords?.replacingOccurrences(of: " ", with: "   ")
     2.9          }
    2.10      }
    2.11  
    2.12 @@ -202,9 +202,7 @@
    2.13              pEpStatusImageView.image = color.statusIconForMessage()
    2.14          }
    2.15  
    2.16 -        let privacyStatus = NSLocalizedString("Privacy Status",
    2.17 -                                              comment: "Privacy status title part in handshake list")
    2.18 -        privacyStatusTitle.text = "\(privacyStatus): \(color.privacyStatusTitle)"
    2.19 +        privacyStatusTitle.text = "\(color.privacyStatusTitle)"
    2.20      }
    2.21  
    2.22      // MARK: - Gestures
     3.1 --- a/pEpForiOS/UI/Handshake/HandshakeViewController.swift	Wed Feb 05 16:13:23 2020 +0100
     3.2 +++ b/pEpForiOS/UI/Handshake/HandshakeViewController.swift	Wed Feb 05 16:35:04 2020 +0100
     3.3 @@ -136,57 +136,14 @@
     3.4          return UIModalPresentationStyle.none
     3.5      }
     3.6  
     3.7 -    /// Creates an overlay view of the globe and adds it to the given view in such a way
     3.8 -    /// that it will cover as much space as possible while not exceeding the parent view
     3.9 -    /// and maintaining aspect ratio.
    3.10 -    ///
    3.11 -    /// - Parameter parentView: The view (which is probably a button) to overlay.
    3.12 -    /// - Returns: The newly created overlay view that has been added to the given view.
    3.13 -    @discardableResult private func addLanguageButtonView(parentView: UIView) -> UIView {
    3.14 -        let totalHeightGap: CGFloat = 16 // Combined max gap to parent, top and bottom
    3.15 -        let img = UIImage(named: "pEpForiOS-icon-languagechange")
    3.16 -
    3.17 -        let imgView = UIImageView(image: img)
    3.18 -        parentView.addSubview(imgView)
    3.19 -
    3.20 -        // Turn off automatically created constraints that come into the way.
    3.21 -        imgView.translatesAutoresizingMaskIntoConstraints = false
    3.22 -
    3.23 -        // aspect ratio
    3.24 -        imgView.heightAnchor.constraint(equalTo: imgView.widthAnchor).isActive = true
    3.25 -
    3.26 -        // center in parent
    3.27 -        imgView.centerYAnchor.constraint(equalTo: parentView.centerYAnchor).isActive = true
    3.28 -
    3.29 -        // glue to the right/trailing
    3.30 -        imgView.trailingAnchor.constraint(lessThanOrEqualTo: parentView.trailingAnchor).isActive = true
    3.31 -
    3.32 -        // leave some space on top and bottom
    3.33 -        imgView.heightAnchor.constraint(lessThanOrEqualTo: parentView.heightAnchor,
    3.34 -                                        constant: -totalHeightGap).isActive = true
    3.35 -
    3.36 -        return imgView
    3.37 -    }
    3.38 -
    3.39 -    /// Creates a bar button item for invoking the trustwords language list.
    3.40 -    ///
    3.41 -    /// - Returns: UIBarButtonItem suitable for adding to the navigation bar.
    3.42 -    private func languageButton() -> UIBarButtonItem {
    3.43 -        let button = UIButton(type: .custom)
    3.44 -        button.addTarget(self,
    3.45 -                         action: #selector(self.languageSelectedAction(_:)),
    3.46 -                         for: .touchUpInside)
    3.47 -        addLanguageButtonView(parentView: button)
    3.48 -        return UIBarButtonItem(customView: button)
    3.49 -    }
    3.50 -    
    3.51      private func optionsButton() -> UIBarButtonItem {
    3.52          let button = UIButton(type: .custom)
    3.53          button.addTarget(self,
    3.54                           action: #selector(self.languageSelectedAction(_:)),
    3.55                           for: .touchUpInside)
    3.56 -        let text = NSLocalizedString("Remove", comment: "Remove")
    3.57 +        let text = NSLocalizedString("Options", comment: "Options")
    3.58          button.setTitle(text, for: .normal)
    3.59 +        button.setTitleColor(UIColor.pEpGreen, for: .normal)
    3.60          return UIBarButtonItem(customView: button)
    3.61      }
    3.62