diff --git a/pass.xcodeproj/project.pbxproj b/pass.xcodeproj/project.pbxproj index 249ecec..c997143 100644 --- a/pass.xcodeproj/project.pbxproj +++ b/pass.xcodeproj/project.pbxproj @@ -53,6 +53,7 @@ DCC277D21E30D6EA00402246 /* pass.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = DCC408C81E30BA1300F29B0E /* pass.xcdatamodeld */; }; DCC408A41E2FCC9E00F29B0E /* PasswordStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCC408A31E2FCC9E00F29B0E /* PasswordStore.swift */; }; DCC408C71E307DBB00F29B0E /* SVProgressHUD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCC408C61E307DBB00F29B0E /* SVProgressHUD.framework */; }; + DCC441521E8F6C06008A90C4 /* RawPasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCC441511E8F6C06008A90C4 /* RawPasswordViewController.swift */; }; DCDDEAB01E4639F300F68193 /* LabelTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DCDDEAAF1E4639F300F68193 /* LabelTableViewCell.xib */; }; DCDDEAB31E4896BF00F68193 /* PasswordDetailTitleTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCDDEAB11E4896BF00F68193 /* PasswordDetailTitleTableViewCell.swift */; }; DCE6C2671E71261C003038C6 /* PasswordWithFolderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCE6C2651E71261C003038C6 /* PasswordWithFolderTableViewCell.swift */; }; @@ -132,6 +133,7 @@ DCC408A31E2FCC9E00F29B0E /* PasswordStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordStore.swift; sourceTree = ""; }; DCC408C61E307DBB00F29B0E /* SVProgressHUD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SVProgressHUD.framework; path = Carthage/Build/iOS/SVProgressHUD.framework; sourceTree = ""; }; DCC408C91E30BA1300F29B0E /* pass.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = pass.xcdatamodel; sourceTree = ""; }; + DCC441511E8F6C06008A90C4 /* RawPasswordViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RawPasswordViewController.swift; sourceTree = ""; }; DCDDEAAF1E4639F300F68193 /* LabelTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LabelTableViewCell.xib; sourceTree = ""; }; DCDDEAB11E4896BF00F68193 /* PasswordDetailTitleTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordDetailTitleTableViewCell.swift; sourceTree = ""; }; DCE6C2651E71261C003038C6 /* PasswordWithFolderTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordWithFolderTableViewCell.swift; sourceTree = ""; }; @@ -207,6 +209,7 @@ DCA049991E335CC800522E8F /* GitServerSettingTableViewController.swift */, DC037CA51E4B883900609409 /* OpenSourceComponentsTableViewController.swift */, DC4914981E434600007FF592 /* PasswordDetailTableViewController.swift */, + DCC441511E8F6C06008A90C4 /* RawPasswordViewController.swift */, DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */, DC5734AD1E439AD400D09270 /* PasswordsViewController.swift */, DCA0499B1E3362F400522E8F /* PGPKeySettingTableViewController.swift */, @@ -541,6 +544,7 @@ DC037CB21E4CAB1700609409 /* AboutRepositoryTableViewController.swift in Sources */, DC037CB01E4CA51F00609409 /* GeneralSettingsTableViewController.swift in Sources */, DC037CB81E4DD1A500609409 /* AddPasswordTableViewController.swift in Sources */, + DCC441521E8F6C06008A90C4 /* RawPasswordViewController.swift in Sources */, DC1940001E49E1A60077E0A3 /* PasscodeLockConfiguration.swift in Sources */, DC917BD71E2E8231000FDF54 /* AppDelegate.swift in Sources */, DCFB779A1E4F3BCF008DE471 /* TitleTextFieldTableViewCell.swift in Sources */, diff --git a/pass/Base.lproj/Main.storyboard b/pass/Base.lproj/Main.storyboard index 696d31e..d9605fc 100644 --- a/pass/Base.lproj/Main.storyboard +++ b/pass/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -626,7 +626,7 @@ - + @@ -638,6 +638,7 @@ + @@ -736,6 +737,50 @@ + + + + + + + + + + + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1346,6 +1391,24 @@ pfZ36xQbOAQYKKf6ZTT5R/Y= + + + + + + + + + + + + + + + + + + diff --git a/pass/Controllers/PasswordDetailTableViewController.swift b/pass/Controllers/PasswordDetailTableViewController.swift index 64ab09a..7f715ff 100644 --- a/pass/Controllers/PasswordDetailTableViewController.swift +++ b/pass/Controllers/PasswordDetailTableViewController.swift @@ -72,15 +72,14 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni case name, main, addition, misc } - override func viewDidLoad() { super.viewDidLoad() tableView.register(UINib(nibName: "LabelTableViewCell", bundle: nil), forCellReuseIdentifier: "labelCell") tableView.register(UINib(nibName: "PasswordDetailTitleTableViewCell", bundle: nil), forCellReuseIdentifier: "passwordDetailTitleTableViewCell") passwordCategoryText = passwordEntity!.getCategoryText() - let tapGesture = UITapGestureRecognizer(target: self, action: #selector(PasswordDetailTableViewController.tapMenu(recognizer:))) + tapGesture.cancelsTouchesInView = false tableView.addGestureRecognizer(tapGesture) tapGesture.delegate = self @@ -302,6 +301,12 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni editController.password = password } } + } else if segue.identifier == "showRawPasswordSegue" { + if let controller = segue.destination as? UINavigationController { + if let controller = controller.viewControllers.first as? RawPasswordViewController { + controller.password = password + } + } } } @@ -362,6 +367,8 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni } } } + @IBAction func back(segue:UIStoryboardSegue) { + } func getNextHOTP() { guard password != nil, passwordEntity != nil, password?.otpType == .hotp else { @@ -426,6 +433,7 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni } cell.nameLabel.text = passwordName cell.categoryLabel.text = passwordCategoryText + cell.selectionStyle = .none return cell case .main, .addition: let cell = tableView.dequeueReusableCell(withIdentifier: "labelCell", for: indexPath) as! LabelTableViewCell @@ -436,10 +444,12 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni cell.isURLCell = (titleData.lowercased() == "url" ? true : false) cell.isHOTPCell = (titleData == "HMAC-based" ? true : false) cell.cellData = LabelTableViewCellData(title: titleData, content: contentData) + cell.selectionStyle = .none return cell case .misc: let cell = UITableViewCell() cell.textLabel?.text = tableDataItem.title + cell.selectionStyle = .default return cell } } @@ -470,10 +480,26 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni } override func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool { - return action == #selector(UIResponderStandardEditActions.copy(_:)) + let section = tableData[indexPath.section] + switch(section.type) { + case .main, .addition: + return action == #selector(UIResponderStandardEditActions.copy(_:)) + default: + return false + } } override func tableView(_ tableView: UITableView, shouldShowMenuForRowAt indexPath: IndexPath) -> Bool { return true } + + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let section = tableData[indexPath.section] + if section.type == .misc { + if section.item[indexPath.row].title == "Show Raw" { + performSegue(withIdentifier: "showRawPasswordSegue", sender: self) + } + } + tableView.deselectRow(at: indexPath, animated: true) + } } diff --git a/pass/Controllers/RawPasswordViewController.swift b/pass/Controllers/RawPasswordViewController.swift new file mode 100644 index 0000000..4b844a2 --- /dev/null +++ b/pass/Controllers/RawPasswordViewController.swift @@ -0,0 +1,21 @@ +// +// RawPasswordViewController.swift +// pass +// +// Created by Mingshen Sun on 31/3/2017. +// Copyright © 2017 Bob Sun. All rights reserved. +// + +import UIKit + +class RawPasswordViewController: UIViewController { + + @IBOutlet weak var rawPasswordTextView: UITextView! + var password: Password? + + override func viewDidLoad() { + super.viewDidLoad() + navigationItem.title = "Raw" + rawPasswordTextView.text = password?.plainText + } +} diff --git a/pass/Models/Password.swift b/pass/Models/Password.swift index 8c01939..2fec51e 100644 --- a/pass/Models/Password.swift +++ b/pass/Models/Password.swift @@ -24,8 +24,8 @@ class Password { var additions = [String: String]() var additionKeys = [String]() var changed = false + var plainText = "" - private var plainText = "" private var firstLineIsOTPField = false private var otpToken: Token?