add authentication method selection UI
This commit is contained in:
parent
fcef83277f
commit
cc7a53781c
9 changed files with 273 additions and 7 deletions
|
|
@ -12,7 +12,10 @@
|
|||
DC1208581E35EBE60042942E /* ObjectiveGit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC1208571E35EBE60042942E /* ObjectiveGit.framework */; };
|
||||
DC286D461E37444D00DBF9C8 /* Former.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC286D451E37444D00DBF9C8 /* Former.framework */; };
|
||||
DC286D4A1E374AF100DBF9C8 /* SSHKeySettingFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC286D491E374AF100DBF9C8 /* SSHKeySettingFormViewController.swift */; };
|
||||
DC286D4E1E37B53F00DBF9C8 /* TextFieldTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC286D4C1E37B53E00DBF9C8 /* TextFieldTableViewCell.swift */; };
|
||||
DC286D4F1E37B53F00DBF9C8 /* TextFieldTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DC286D4D1E37B53F00DBF9C8 /* TextFieldTableViewCell.xib */; };
|
||||
DC3DC8391E2F63240062A988 /* PasswordDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC3DC8381E2F63240062A988 /* PasswordDetailViewController.swift */; };
|
||||
DC8963BE1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC8963BD1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift */; };
|
||||
DC917BD71E2E8231000FDF54 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC917BD61E2E8231000FDF54 /* AppDelegate.swift */; };
|
||||
DC917BDC1E2E8231000FDF54 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DC917BDA1E2E8231000FDF54 /* Main.storyboard */; };
|
||||
DC917BDE1E2E8231000FDF54 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC917BDD1E2E8231000FDF54 /* Assets.xcassets */; };
|
||||
|
|
@ -37,8 +40,11 @@
|
|||
DC1208571E35EBE60042942E /* ObjectiveGit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ObjectiveGit.framework; path = Carthage/Build/iOS/ObjectiveGit.framework; sourceTree = "<group>"; };
|
||||
DC286D451E37444D00DBF9C8 /* Former.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Former.framework; path = Carthage/Build/iOS/Former.framework; sourceTree = "<group>"; };
|
||||
DC286D491E374AF100DBF9C8 /* SSHKeySettingFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SSHKeySettingFormViewController.swift; sourceTree = "<group>"; };
|
||||
DC286D4C1E37B53E00DBF9C8 /* TextFieldTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldTableViewCell.swift; sourceTree = "<group>"; };
|
||||
DC286D4D1E37B53F00DBF9C8 /* TextFieldTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TextFieldTableViewCell.xib; sourceTree = "<group>"; };
|
||||
DC3DC8381E2F63240062A988 /* PasswordDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordDetailViewController.swift; sourceTree = "<group>"; };
|
||||
DC4A746D1E30FBDE00E8EB18 /* Objective-CBridgingHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Objective-CBridgingHeader.h"; sourceTree = "<group>"; };
|
||||
DC8963BD1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitRepositoryAuthenticationSettingTableViewController.swift; sourceTree = "<group>"; };
|
||||
DC917BD31E2E8231000FDF54 /* pass.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = pass.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DC917BD61E2E8231000FDF54 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
DC917BDB1E2E8231000FDF54 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
|
|
@ -105,10 +111,13 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
DC286D491E374AF100DBF9C8 /* SSHKeySettingFormViewController.swift */,
|
||||
DC286D4C1E37B53E00DBF9C8 /* TextFieldTableViewCell.swift */,
|
||||
DC286D4D1E37B53F00DBF9C8 /* TextFieldTableViewCell.xib */,
|
||||
DC1208551E35D0BA0042942E /* PasswordsTableViewController.swift */,
|
||||
DC4A746D1E30FBDE00E8EB18 /* Objective-CBridgingHeader.h */,
|
||||
DC917BD61E2E8231000FDF54 /* AppDelegate.swift */,
|
||||
DC917BDA1E2E8231000FDF54 /* Main.storyboard */,
|
||||
DC8963BD1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift */,
|
||||
DCA0499B1E3362F400522E8F /* PGPKeySettingTableViewController.swift */,
|
||||
DCA049991E335CC800522E8F /* GitServerSettingTableViewController.swift */,
|
||||
DCAAF7441E2FA66800AB94BC /* SettingsTableViewController.swift */,
|
||||
|
|
@ -204,6 +213,7 @@
|
|||
DC917BE11E2E8231000FDF54 /* LaunchScreen.storyboard in Resources */,
|
||||
DC917BDE1E2E8231000FDF54 /* Assets.xcassets in Resources */,
|
||||
DC917BDC1E2E8231000FDF54 /* Main.storyboard in Resources */,
|
||||
DC286D4F1E37B53F00DBF9C8 /* TextFieldTableViewCell.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -283,10 +293,12 @@
|
|||
DCC408A41E2FCC9E00F29B0E /* PasswordStore.swift in Sources */,
|
||||
DCA0499C1E3362F400522E8F /* PGPKeySettingTableViewController.swift in Sources */,
|
||||
DC1208561E35D0BA0042942E /* PasswordsTableViewController.swift in Sources */,
|
||||
DC286D4E1E37B53F00DBF9C8 /* TextFieldTableViewCell.swift in Sources */,
|
||||
DCAAF7451E2FA66800AB94BC /* SettingsTableViewController.swift in Sources */,
|
||||
DCA0499A1E335CC800522E8F /* GitServerSettingTableViewController.swift in Sources */,
|
||||
DC286D4A1E374AF100DBF9C8 /* SSHKeySettingFormViewController.swift in Sources */,
|
||||
DCC277D21E30D6EA00402246 /* pass.xcdatamodeld in Sources */,
|
||||
DC8963BE1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift in Sources */,
|
||||
DC917BD71E2E8231000FDF54 /* AppDelegate.swift in Sources */,
|
||||
DCA049981E33586A00522E8F /* DefaultKeys.swift in Sources */,
|
||||
DCA0499E1E33BAC100522E8F /* Globals.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@
|
|||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="K0b-qZ-UOk" kind="show" identifier="gitServerSetting" id="lTe-xz-AE8"/>
|
||||
<segue destination="K0b-qZ-UOk" kind="show" id="Y7o-EF-Fj2"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="sshKeyTableViewCell" textLabel="39M-pD-G4c" style="IBUITableViewCellStyleDefault" id="D5Y-70-cIk">
|
||||
|
|
@ -165,10 +165,10 @@
|
|||
</objects>
|
||||
<point key="canvasLocation" x="2425" y="2424"/>
|
||||
</scene>
|
||||
<!--Key Setting Form View Controller-->
|
||||
<!--SSH Key Setting Form View Controller-->
|
||||
<scene sceneID="o8D-OA-kri">
|
||||
<objects>
|
||||
<viewController id="2wS-CW-naM" customClass="SSHKeySettingFormViewController" customModule="pass" customModuleProvider="target" sceneMemberID="viewController"/>
|
||||
<viewController id="2wS-CW-naM" userLabel="SSH Key Setting Form View Controller" customClass="SSHKeySettingFormViewController" customModule="pass" customModuleProvider="target" sceneMemberID="viewController"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="DSc-wl-N2L" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="3430" y="2473"/>
|
||||
|
|
@ -273,6 +273,37 @@
|
|||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection id="s6v-aZ-kaD">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="Gar-Yh-ZKL" detailTextLabel="Tjx-af-c7u" style="IBUITableViewCellStyleValue1" id="skE-NA-SBb">
|
||||
<rect key="frame" x="0.0" y="227" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="skE-NA-SBb" id="xec-0B-cTD">
|
||||
<rect key="frame" x="0.0" y="0.0" width="342" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Authentication" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Gar-Yh-ZKL">
|
||||
<rect key="frame" x="15" y="11" width="111" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Not Set" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Tjx-af-c7u">
|
||||
<rect key="frame" x="282" y="11" width="58" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="4Hl-LX-rKS" kind="show" identifier="selectAuthenticationMethod" id="7nl-GC-PCz"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="ynQ-64-MfA" id="q89-h8-Hqq"/>
|
||||
|
|
@ -294,6 +325,7 @@
|
|||
</navigationItem>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
<connections>
|
||||
<outlet property="authenticationTableViewCell" destination="skE-NA-SBb" id="Tc1-FF-nhM"/>
|
||||
<outlet property="gitRepositoryURLTextField" destination="EVT-VU-sCi" id="2EH-Uq-tbU"/>
|
||||
<outlet property="passwordTextField" destination="hSW-BQ-SXN" id="uFS-s5-yfZ"/>
|
||||
<outlet property="usernameTextField" destination="cxu-dD-J2H" id="RjU-Hf-xyw"/>
|
||||
|
|
@ -302,7 +334,76 @@
|
|||
<placeholder placeholderIdentifier="IBFirstResponder" id="7c1-c7-Qyp" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<exit id="7K9-cE-9qq" userLabel="Exit" sceneMemberID="exit"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="4383" y="1752"/>
|
||||
<point key="canvasLocation" x="4381.6000000000004" y="1751.8740629685158"/>
|
||||
</scene>
|
||||
<!--Git Repository Authentication Setting Table View Controller-->
|
||||
<scene sceneID="xth-c9-Oea">
|
||||
<objects>
|
||||
<tableViewController id="4Hl-LX-rKS" customClass="GitRepositoryAuthenticationSettingTableViewController" customModule="pass" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="g4G-LT-2oZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
<sections>
|
||||
<tableViewSection id="gnN-PG-erQ">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="pyY-6T-Ar4" style="IBUITableViewCellStyleDefault" id="GZS-hV-7Yy">
|
||||
<rect key="frame" x="0.0" y="35" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="GZS-hV-7Yy" id="wRk-ML-bpj">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Password" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="pyY-6T-Ar4">
|
||||
<rect key="frame" x="15" y="0.0" width="345" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="MfG-VE-Ork" kind="unwind" unwindAction="saveWithSegue:" id="QZM-o4-88Q"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="844-Ya-Uiz" style="IBUITableViewCellStyleDefault" id="ahw-Sp-Et2">
|
||||
<rect key="frame" x="0.0" y="79" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ahw-Sp-Et2" id="gjE-7z-REN">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="SSH Key" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="844-Ya-Uiz">
|
||||
<rect key="frame" x="15" y="0.0" width="345" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="MfG-VE-Ork" kind="unwind" unwindAction="saveWithSegue:" id="eBA-wP-36P"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="4Hl-LX-rKS" id="eKS-rA-GFV"/>
|
||||
<outlet property="delegate" destination="4Hl-LX-rKS" id="ILw-Ae-IBj"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<connections>
|
||||
<outlet property="passwordCell" destination="GZS-hV-7Yy" id="wyf-vh-roY"/>
|
||||
<outlet property="sshKeyCell" destination="ahw-Sp-Et2" id="4QS-fY-Z5M"/>
|
||||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="e1d-uR-lAI" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<exit id="MfG-VE-Ork" userLabel="Exit" sceneMemberID="exit"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="5127" y="1751"/>
|
||||
</scene>
|
||||
<!--PGP Key-->
|
||||
<scene sceneID="8Hi-tl-elT">
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ extension DefaultsKeys {
|
|||
static let pgpKeyUserID = DefaultsKey<String>("pgpKeyUserID")
|
||||
|
||||
static let gitRepositoryURL = DefaultsKey<URL?>("gitRepositoryURL")
|
||||
static let gitRepositoryAuthenticationMethod = DefaultsKey<String>("gitRepositoryAuthenticationMethod")
|
||||
static let gitRepositoryUsername = DefaultsKey<String>("gitRepositoryUsername")
|
||||
static let gitRepositoryPassword = DefaultsKey<String>("gitRepositoryPassword")
|
||||
static let gitRepositorySSHPublicKeyURL = DefaultsKey<URL?>("gitRepositorySSHPublicKeyURL")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// GitRepositoryAuthenticationSettingTableViewController.swift
|
||||
// pass
|
||||
//
|
||||
// Created by Mingshen Sun on 25/1/2017.
|
||||
// Copyright © 2017 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class GitRepositoryAuthenticationSettingTableViewController: UITableViewController {
|
||||
|
||||
var selectedMethod: String?
|
||||
|
||||
@IBOutlet weak var sshKeyCell: UITableViewCell!
|
||||
@IBOutlet weak var passwordCell: UITableViewCell!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
switch selectedMethod! {
|
||||
case "Password":
|
||||
passwordCell.accessoryType = UITableViewCellAccessoryType.checkmark
|
||||
case "SSH Key":
|
||||
sshKeyCell.accessoryType = UITableViewCellAccessoryType.checkmark
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -26,6 +26,7 @@ class GitServerSettingTableViewController: UITableViewController {
|
|||
}
|
||||
usernameTextField.text = Defaults[.gitRepositoryUsername]
|
||||
passwordTextField.text = Defaults[.gitRepositoryPassword]
|
||||
authenticationTableViewCell.detailTextLabel?.text = Defaults[.gitRepositoryAuthenticationMethod]
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
|
|
@ -37,4 +38,21 @@ class GitServerSettingTableViewController: UITableViewController {
|
|||
super.viewWillDisappear(animated)
|
||||
view.endEditing(true)
|
||||
}
|
||||
@IBAction func save(segue: UIStoryboardSegue) {
|
||||
if let controller = segue.source as? UITableViewController {
|
||||
if controller.tableView.indexPathForSelectedRow == IndexPath(row: 0, section:0) {
|
||||
authenticationTableViewCell.detailTextLabel?.text = "Password"
|
||||
} else {
|
||||
authenticationTableViewCell.detailTextLabel?.text = "SSH Key"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
if segue.identifier == "selectAuthenticationMethod" {
|
||||
if let controller = segue.destination as? GitRepositoryAuthenticationSettingTableViewController {
|
||||
controller.selectedMethod = authenticationTableViewCell.detailTextLabel!.text
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,24 @@ class SSHKeySettingFormViewController: FormViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
let publicKeyURLTextFieldRow = TextFieldRowFormer<TextFieldTableViewCell>(instantiateType: .Nib(nibName: "TextFieldTableViewCell")) { (row: TextFieldTableViewCell) -> Void in
|
||||
row.titleLabel.text = "SSH Public Key URL"
|
||||
}.configure { (row) in
|
||||
row.rowHeight = 52
|
||||
}
|
||||
let privateKeyURLTextFieldRow = TextFieldRowFormer<TextFieldTableViewCell>(instantiateType: .Nib(nibName: "TextFieldTableViewCell")) { (row: TextFieldTableViewCell) -> Void in
|
||||
row.titleLabel.text = "SSH Private Key URL"
|
||||
}.configure { (row) in
|
||||
row.rowHeight = 52
|
||||
}
|
||||
|
||||
let privateKeyPhassphraseTextFieldRow = TextFieldRowFormer<TextFieldTableViewCell>(instantiateType: .Nib(nibName: "TextFieldTableViewCell")) { (row: TextFieldTableViewCell) -> Void in
|
||||
row.titleLabel.text = "Phassphrase"
|
||||
row.textField.isSecureTextEntry = true
|
||||
}.configure { (row) in
|
||||
row.rowHeight = 52
|
||||
}
|
||||
former.append(sectionFormer: SectionFormer(rowFormer: publicKeyURLTextFieldRow, privateKeyURLTextFieldRow, privateKeyPhassphraseTextFieldRow))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,13 @@ class SettingsTableViewController: UITableViewController {
|
|||
let gitRepostiroyURL = controller.gitRepositoryURLTextField.text!
|
||||
let username = controller.usernameTextField.text!
|
||||
let password = controller.passwordTextField.text!
|
||||
let auth = controller.authenticationTableViewCell.detailTextLabel!.text!
|
||||
|
||||
|
||||
Defaults[.gitRepositoryURL] = URL(string: gitRepostiroyURL)
|
||||
Defaults[.gitRepositoryUsername] = username
|
||||
Defaults[.gitRepositoryPassword] = password
|
||||
Defaults[.gitRepositoryAuthenticationMethod] = auth
|
||||
|
||||
if Defaults[.gitRepositoryURL] == nil || gitRepostiroyURL != Defaults[.gitRepositoryURL]!.absoluteString {
|
||||
SVProgressHUD.setDefaultMaskType(.black)
|
||||
|
|
@ -47,9 +54,6 @@ class SettingsTableViewController: UITableViewController {
|
|||
if ret {
|
||||
SVProgressHUD.showSuccess(withStatus: "Done")
|
||||
SVProgressHUD.dismiss(withDelay: 1)
|
||||
Defaults[.gitRepositoryURL] = URL(string: gitRepostiroyURL)
|
||||
Defaults[.gitRepositoryUsername] = username
|
||||
Defaults[.gitRepositoryPassword] = password
|
||||
|
||||
NotificationCenter.default.post(Notification(name: Notification.Name("passwordUpdated")))
|
||||
} else {
|
||||
|
|
|
|||
30
pass/TextFieldTableViewCell.swift
Normal file
30
pass/TextFieldTableViewCell.swift
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// TextFieldTableViewCell.swift
|
||||
// pass
|
||||
//
|
||||
// Created by Mingshen Sun on 25/1/2017.
|
||||
// Copyright © 2017 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Former
|
||||
|
||||
class TextFieldTableViewCell: UITableViewCell, TextFieldFormableRow {
|
||||
@IBOutlet weak var titleLabel: UILabel!
|
||||
@IBOutlet weak var textField: UITextField!
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
}
|
||||
|
||||
func formTextField() -> UITextField {
|
||||
return textField
|
||||
}
|
||||
|
||||
func formTitleLabel() -> UILabel? {
|
||||
return titleLabel
|
||||
}
|
||||
|
||||
func updateWithRowFormer(_ rowFormer: RowFormer) {}
|
||||
|
||||
}
|
||||
51
pass/TextFieldTableViewCell.xib
Normal file
51
pass/TextFieldTableViewCell.xib
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="TextFieldTableViewCell" customModule="pass" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="52"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="51.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SSH" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TXd-7c-hmg">
|
||||
<rect key="frame" x="15" y="8" width="297" height="15"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
|
||||
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="DT2-vj-95g">
|
||||
<rect key="frame" x="15" y="24.5" width="297" height="19"/>
|
||||
<nil key="textColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="alphabet"/>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="DT2-vj-95g" firstAttribute="leading" secondItem="TXd-7c-hmg" secondAttribute="leading" id="DOC-hb-j7C"/>
|
||||
<constraint firstItem="DT2-vj-95g" firstAttribute="trailing" secondItem="TXd-7c-hmg" secondAttribute="trailing" id="EHV-Co-Y1Q"/>
|
||||
<constraint firstAttribute="bottomMargin" secondItem="DT2-vj-95g" secondAttribute="bottom" id="dlf-Ny-wun"/>
|
||||
<constraint firstItem="TXd-7c-hmg" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="7" id="j7z-8j-948"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="TXd-7c-hmg" secondAttribute="trailing" id="kR8-St-nI0"/>
|
||||
<constraint firstAttribute="topMargin" secondItem="TXd-7c-hmg" secondAttribute="top" id="uQl-UG-MDc"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="textField" destination="DT2-vj-95g" id="zJm-Nj-9fR"/>
|
||||
<outlet property="titleLabel" destination="TXd-7c-hmg" id="oCI-QR-aFa"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="42" y="126.5"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
Loading…
Add table
Add a link
Reference in a new issue