From a3837e9ce8d8d3ab4f48e452c64ba797dd93cc4f Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Sat, 28 Jan 2017 00:21:17 +0800 Subject: [PATCH] finish UI of SSH key --- pass.xcodeproj/project.pbxproj | 4 + pass/Base.lproj/Main.storyboard | 135 +++++++++++++++++++- pass/SSHKeySettingTableViewController.swift | 37 ++++++ 3 files changed, 169 insertions(+), 7 deletions(-) create mode 100644 pass/SSHKeySettingTableViewController.swift diff --git a/pass.xcodeproj/project.pbxproj b/pass.xcodeproj/project.pbxproj index 7a2399d..4e5be19 100644 --- a/pass.xcodeproj/project.pbxproj +++ b/pass.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ DC1208581E35EBE60042942E /* ObjectiveGit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC1208571E35EBE60042942E /* ObjectiveGit.framework */; }; DC3DC8391E2F63240062A988 /* PasswordDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC3DC8381E2F63240062A988 /* PasswordDetailViewController.swift */; }; DC8963BE1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC8963BD1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift */; }; + DC8963C01E38EEB900828B09 /* SSHKeySettingTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC8963BF1E38EEB900828B09 /* SSHKeySettingTableViewController.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,6 +38,7 @@ DC3DC8381E2F63240062A988 /* PasswordDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordDetailViewController.swift; sourceTree = ""; }; DC4A746D1E30FBDE00E8EB18 /* Objective-CBridgingHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Objective-CBridgingHeader.h"; sourceTree = ""; }; DC8963BD1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitRepositoryAuthenticationSettingTableViewController.swift; sourceTree = ""; }; + DC8963BF1E38EEB900828B09 /* SSHKeySettingTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SSHKeySettingTableViewController.swift; sourceTree = ""; }; 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 = ""; }; DC917BDB1E2E8231000FDF54 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -105,6 +107,7 @@ DC4A746D1E30FBDE00E8EB18 /* Objective-CBridgingHeader.h */, DC917BD61E2E8231000FDF54 /* AppDelegate.swift */, DC917BDA1E2E8231000FDF54 /* Main.storyboard */, + DC8963BF1E38EEB900828B09 /* SSHKeySettingTableViewController.swift */, DC8963BD1E38AD8300828B09 /* GitRepositoryAuthenticationSettingTableViewController.swift */, DCA0499B1E3362F400522E8F /* PGPKeySettingTableViewController.swift */, DCA049991E335CC800522E8F /* GitServerSettingTableViewController.swift */, @@ -276,6 +279,7 @@ buildActionMask = 2147483647; files = ( DCC408A41E2FCC9E00F29B0E /* PasswordStore.swift in Sources */, + DC8963C01E38EEB900828B09 /* SSHKeySettingTableViewController.swift in Sources */, DCA0499C1E3362F400522E8F /* PGPKeySettingTableViewController.swift in Sources */, DC1208561E35D0BA0042942E /* PasswordsTableViewController.swift in Sources */, DCAAF7451E2FA66800AB94BC /* SettingsTableViewController.swift in Sources */, diff --git a/pass/Base.lproj/Main.storyboard b/pass/Base.lproj/Main.storyboard index c93dab5..527a226 100644 --- a/pass/Base.lproj/Main.storyboard +++ b/pass/Base.lproj/Main.storyboard @@ -64,7 +64,7 @@ - + @@ -113,6 +113,9 @@ + + + @@ -392,7 +395,7 @@ - + @@ -491,7 +494,7 @@ - + @@ -546,7 +549,7 @@ - + @@ -565,7 +568,7 @@ - + @@ -584,7 +587,7 @@ - + @@ -604,6 +607,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -620,7 +741,7 @@ - + diff --git a/pass/SSHKeySettingTableViewController.swift b/pass/SSHKeySettingTableViewController.swift new file mode 100644 index 0000000..de2fdbb --- /dev/null +++ b/pass/SSHKeySettingTableViewController.swift @@ -0,0 +1,37 @@ +// +// SSHKeySettingTableViewController.swift +// pass +// +// Created by Mingshen Sun on 25/1/2017. +// Copyright © 2017 Bob Sun. All rights reserved. +// + +import UIKit +import SwiftyUserDefaults + +class SSHKeySettingTableViewController: UITableViewController { + + @IBOutlet weak var passphraseTextField: UITextField! + @IBOutlet weak var privateKeyURLTextField: UITextField! + @IBOutlet weak var publicKeyURLTextField: UITextField! + + override func viewDidLoad() { + super.viewDidLoad() + var doneBarButtonItem: UIBarButtonItem? + + doneBarButtonItem = UIBarButtonItem(title: "Done", + style: UIBarButtonItemStyle.done, + target: self, + action: #selector(doneButtonTapped(_:))) + navigationItem.rightBarButtonItem = doneBarButtonItem + } + + func doneButtonTapped(_ sender: UIButton) { + print("done pressed") + Defaults[.gitRepositorySSHPublicKeyURL] = URL(string: publicKeyURLTextField.text!) + Defaults[.gitRepositorySSHPrivateKeyURL] = URL(string: privateKeyURLTextField.text!) + Defaults[.gitRepositorySSHPrivateKeyPassphrase] = passphraseTextField.text! + dismiss(animated: true, completion: nil) + } + +}