Skip to content

Commit 788adee

Browse files
committed
Unify cell style for the password generator
1 parent 6c790f8 commit 788adee

File tree

10 files changed

+72
-34
lines changed

10 files changed

+72
-34
lines changed

pass.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@
193193
DC037CC01E4ED4E100609409 /* TextViewTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DC037CBE1E4ED4E100609409 /* TextViewTableViewCell.xib */; };
194194
DC0F7692283C00220042DA74 /* passKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A26075781EEC6F34005DB03E /* passKit.framework */; };
195195
DC193FFA1E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC193FF91E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift */; };
196+
DC30F83829BED4E2001EB12B /* PasswordGeneratorUISwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC30F83729BED4E2001EB12B /* PasswordGeneratorUISwitch.swift */; };
197+
DC30F83A29BED611001EB12B /* PasswordGeneratorUISlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC30F83929BED611001EB12B /* PasswordGeneratorUISlider.swift */; };
196198
DC3E64E61E656F11009A83DE /* CommitLogsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC3E64E51E656F11009A83DE /* CommitLogsTableViewController.swift */; };
197199
DC4914961E434301007FF592 /* LabelTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC4914941E434301007FF592 /* LabelTableViewCell.swift */; };
198200
DC4914991E434600007FF592 /* PasswordDetailTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC4914981E434600007FF592 /* PasswordDetailTableViewController.swift */; };
@@ -484,6 +486,8 @@
484486
DC13B1521E8640810097803F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
485487
DC193FF91E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AdvancedSettingsTableViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
486488
DC30F83629BAFD2E001EB12B /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Main.strings; sourceTree = "<group>"; };
489+
DC30F83729BED4E2001EB12B /* PasswordGeneratorUISwitch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordGeneratorUISwitch.swift; sourceTree = "<group>"; };
490+
DC30F83929BED611001EB12B /* PasswordGeneratorUISlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordGeneratorUISlider.swift; sourceTree = "<group>"; };
487491
DC3E64E51E656F11009A83DE /* CommitLogsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommitLogsTableViewController.swift; sourceTree = "<group>"; };
488492
DC4914941E434301007FF592 /* LabelTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LabelTableViewCell.swift; sourceTree = "<group>"; };
489493
DC4914981E434600007FF592 /* PasswordDetailTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordDetailTableViewController.swift; sourceTree = "<group>"; };
@@ -1004,6 +1008,8 @@
10041008
A2802BF81E70813A00879216 /* SliderTableViewCell.xib */,
10051009
306D970D24091CDD006C0E2E /* SwitchTableViewCell.swift */,
10061010
306D971124091EE7006C0E2E /* SwitchTableViewCell.xib */,
1011+
DC30F83729BED4E2001EB12B /* PasswordGeneratorUISwitch.swift */,
1012+
DC30F83929BED611001EB12B /* PasswordGeneratorUISlider.swift */,
10071013
DC037CB91E4DD47B00609409 /* TextFieldTableViewCell.swift */,
10081014
DC037CBA1E4DD47B00609409 /* TextFieldTableViewCell.xib */,
10091015
DC037CBD1E4ED4E100609409 /* TextViewTableViewCell.swift */,
@@ -1652,13 +1658,15 @@
16521658
306D970E24091CDD006C0E2E /* SwitchTableViewCell.swift in Sources */,
16531659
A2A61C201EEFABAD00CFE063 /* UtilsExtension.swift in Sources */,
16541660
DC8963C01E38EEB900828B09 /* SSHKeyURLImportTableViewController..swift in Sources */,
1661+
DC30F83829BED4E2001EB12B /* PasswordGeneratorUISwitch.swift in Sources */,
16551662
9AFC87F025B514AD008D6060 /* PasswordDecryptor.swift in Sources */,
16561663
3066AD6823EE0D6500F65535 /* PGPKeyImporter.swift in Sources */,
16571664
9AFC87E225B3B5C6008D6060 /* PasswordNavigationDataSource.swift in Sources */,
16581665
30650E7123F82AF8005CCD5E /* SSHKeyFileImportTableViewController.swift in Sources */,
16591666
DC193FFA1E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift in Sources */,
16601667
9AFC880025B51EC3008D6060 /* PasswordEncryptor.swift in Sources */,
16611668
DCA0499C1E3362F400522E8F /* PGPKeyURLImportTableViewController.swift in Sources */,
1669+
DC30F83A29BED611001EB12B /* PasswordGeneratorUISlider.swift in Sources */,
16621670
DC4914961E434301007FF592 /* LabelTableViewCell.swift in Sources */,
16631671
DC5F385B1E56AADB00C69ACA /* PGPKeyArmorImportTableViewController.swift in Sources */,
16641672
DCAAF7451E2FA66800AB94BC /* SettingsTableViewController.swift in Sources */,

pass/Base.lproj/Main.storyboard

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2222
<subviews>
2323
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Tn1-q5-vaJ">
24-
<rect key="frame" x="-2" y="-1" width="391" height="844"/>
24+
<rect key="frame" x="-1" y="-1" width="391" height="844"/>
2525
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2626
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
2727
<prototypes>
@@ -1099,7 +1099,7 @@ Secret Question 1: What is your childhood best friend's most bizarre superhero f
10991099
<autoresizingMask key="autoresizingMask"/>
11001100
<subviews>
11011101
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Encrypt in ASCII-Armored" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="Jwg-mt-woS">
1102-
<rect key="frame" x="20" y="0.0" width="350" height="43.666667938232422"/>
1102+
<rect key="frame" x="20" y="0.0" width="362" height="43.666667938232422"/>
11031103
<autoresizingMask key="autoresizingMask"/>
11041104
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
11051105
<nil key="textColor"/>
@@ -1151,7 +1151,7 @@ Secret Question 1: What is your childhood best friend's most bizarre superhero f
11511151
<autoresizingMask key="autoresizingMask"/>
11521152
<subviews>
11531153
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Clear Saved Suggetions" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="BDw-4m-VXK">
1154-
<rect key="frame" x="20" y="0.0" width="350" height="43.666667938232422"/>
1154+
<rect key="frame" x="20" y="0.0" width="362" height="43.666667938232422"/>
11551155
<autoresizingMask key="autoresizingMask"/>
11561156
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
11571157
<nil key="textColor"/>
@@ -1189,7 +1189,7 @@ Secret Question 1: What is your childhood best friend's most bizarre superhero f
11891189
<autoresizingMask key="autoresizingMask"/>
11901190
<subviews>
11911191
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Erase All Password Store Data" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="K2K-Bx-g7Z">
1192-
<rect key="frame" x="20" y="0.0" width="350" height="43.666667938232422"/>
1192+
<rect key="frame" x="20" y="0.0" width="362" height="43.666667938232422"/>
11931193
<autoresizingMask key="autoresizingMask"/>
11941194
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
11951195
<color key="textColor" systemColor="systemRedColor"/>
@@ -1985,7 +1985,7 @@ Secret Question 1: What is your childhood best friend's most bizarre superhero f
19851985
<inferredMetricsTieBreakers>
19861986
<segue reference="wCk-aN-a4J"/>
19871987
<segue reference="oxP-I1-Mke"/>
1988-
<segue reference="yyD-4H-pLE"/>
1988+
<segue reference="UfP-k3-XeR"/>
19891989
</inferredMetricsTieBreakers>
19901990
<resources>
19911991
<image name="Lock" width="25" height="25"/>

pass/Controllers/PasswordEditorTableViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ class PasswordEditorTableViewController: UITableViewController {
8282

8383
passwordFlavorCell = UITableViewCell(style: .default, reuseIdentifier: "default")
8484
passwordFlavorCell?.textLabel?.text = "PasswordGeneratorFlavor".localize()
85+
passwordFlavorCell?.textLabel?.font = .preferredFont(forTextStyle: .footnote)
86+
passwordFlavorCell!.layoutMargins.left = passKit.Globals.passwordGeneratorLeftLayoutMargin
8587
passwordFlavorCell?.selectionStyle = .none
8688

8789
let passwordFlavorSelector = UISegmentedControl(items: PasswordGeneratorFlavor.allCases.map(\.localized))
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//
2+
// PasswordGeneratorUISlider.swift
3+
//
4+
5+
import UIKit
6+
7+
class PasswordGeneratorUISlider: UISlider {
8+
override func draw(_: CGRect) {
9+
transform = CGAffineTransform(scaleX: 0.8, y: 0.8)
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//
2+
// PasswordGeneratorUISwitch.swift
3+
//
4+
5+
import UIKit
6+
7+
class PasswordGeneratorUISwitch: UISwitch {
8+
override func draw(_: CGRect) {
9+
transform = CGAffineTransform(scaleX: 0.8, y: 0.8)
10+
}
11+
}

pass/Views/SliderTableViewCell.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class SliderTableViewCell: UITableViewCell {
3333
delegate.generateAndCopyPassword()
3434
}
3535

36+
override func layoutMarginsDidChange() {
37+
layoutMargins.left = passKit.Globals.passwordGeneratorLeftLayoutMargin
38+
}
39+
3640
func set(title: String) -> SliderTableViewCell {
3741
titleLabel.text = title
3842
return self

pass/Views/SliderTableViewCell.xib

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16G8c" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
3-
<device id="retina4_7" orientation="portrait">
4-
<adaptation id="fullscreen"/>
5-
</device>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
3+
<device id="retina4_7" orientation="portrait" appearance="light"/>
64
<dependencies>
75
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
9-
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
107
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
118
</dependencies>
129
<objects>
1310
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
1411
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
15-
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" rowHeight="71" id="KGk-i7-Jjw" customClass="SliderTableViewCell" customModule="pass" customModuleProvider="target">
12+
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" rowHeight="71" id="KGk-i7-Jjw" customClass="SliderTableViewCell" customModule="Pass" customModuleProvider="target">
1613
<rect key="frame" x="0.0" y="0.0" width="320" height="74"/>
1714
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
1815
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
19-
<rect key="frame" x="0.0" y="0.0" width="320" height="73.5"/>
16+
<rect key="frame" x="0.0" y="0.0" width="320" height="74"/>
2017
<autoresizingMask key="autoresizingMask"/>
2118
<subviews>
22-
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="MwT-Jl-hhE">
23-
<rect key="frame" x="53.5" y="22.5" width="212.5" height="31"/>
19+
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="MwT-Jl-hhE" customClass="PasswordGeneratorUISlider" customModule="Pass" customModuleProvider="target">
20+
<rect key="frame" x="48.5" y="20.5" width="222.5" height="34"/>
2421
<connections>
2522
<action selector="handleSliderValueChange:" destination="KGk-i7-Jjw" eventType="valueChanged" id="WwM-ZE-yIB"/>
2623
</connections>
2724
</slider>
2825
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="88" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GJP-Fj-VZt" userLabel="Value">
29-
<rect key="frame" x="278" y="11" width="20" height="52"/>
26+
<rect key="frame" x="277" y="11" width="20" height="52"/>
3027
<constraints>
3128
<constraint firstAttribute="width" constant="20" id="tOG-yp-eFw"/>
3229
</constraints>
@@ -35,22 +32,19 @@
3532
<nil key="highlightedColor"/>
3633
</label>
3734
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="t7T-HC-hUd" userLabel="Title">
38-
<rect key="frame" x="15" y="11" width="26.5" height="52"/>
39-
<constraints>
40-
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="38" id="8Tz-Qo-Mkg"/>
41-
</constraints>
42-
<fontDescription key="fontDescription" type="system" pointSize="13"/>
35+
<rect key="frame" x="16" y="11" width="26.5" height="52"/>
36+
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
4337
<nil key="textColor"/>
4438
<nil key="highlightedColor"/>
4539
</label>
4640
</subviews>
4741
<constraints>
48-
<constraint firstItem="MwT-Jl-hhE" firstAttribute="leading" secondItem="t7T-HC-hUd" secondAttribute="trailing" constant="14" id="Cc9-kV-nZf"/>
42+
<constraint firstItem="MwT-Jl-hhE" firstAttribute="leading" secondItem="t7T-HC-hUd" secondAttribute="trailing" constant="8" symbolic="YES" id="Cc9-kV-nZf"/>
4943
<constraint firstItem="t7T-HC-hUd" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="Kje-Zj-RaX"/>
5044
<constraint firstAttribute="trailingMargin" secondItem="GJP-Fj-VZt" secondAttribute="trailing" constant="7" id="LjD-JH-dRT"/>
5145
<constraint firstItem="MwT-Jl-hhE" firstAttribute="centerY" secondItem="t7T-HC-hUd" secondAttribute="centerY" id="MHN-Vl-1le"/>
5246
<constraint firstAttribute="bottomMargin" secondItem="GJP-Fj-VZt" secondAttribute="bottom" id="NmC-sS-9Yt"/>
53-
<constraint firstItem="GJP-Fj-VZt" firstAttribute="leading" secondItem="MwT-Jl-hhE" secondAttribute="trailing" constant="14" id="VAG-Y2-0Lu"/>
47+
<constraint firstItem="GJP-Fj-VZt" firstAttribute="leading" secondItem="MwT-Jl-hhE" secondAttribute="trailing" constant="8" symbolic="YES" id="VAG-Y2-0Lu"/>
5448
<constraint firstAttribute="bottomMargin" secondItem="t7T-HC-hUd" secondAttribute="bottom" id="mng-Ic-Ciy"/>
5549
<constraint firstItem="GJP-Fj-VZt" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="oYC-wl-Lyg"/>
5650
<constraint firstItem="t7T-HC-hUd" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="vhu-L7-r5I"/>

pass/Views/SwitchTableViewCell.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ class SwitchTableViewCell: UITableViewCell {
2828
return self
2929
}
3030

31+
override func layoutMarginsDidChange() {
32+
layoutMargins.left = passKit.Globals.passwordGeneratorLeftLayoutMargin
33+
}
34+
3135
func set(initialValue: Bool) -> SwitchTableViewCell {
3236
controlSwitch.isOn = initialValue
3337
return self

0 commit comments

Comments
 (0)