diff --git a/pass/Controllers/PasswordEditorTableViewController.swift b/pass/Controllers/PasswordEditorTableViewController.swift index cdef75f..afa1773 100644 --- a/pass/Controllers/PasswordEditorTableViewController.swift +++ b/pass/Controllers/PasswordEditorTableViewController.swift @@ -56,11 +56,6 @@ class PasswordEditorTableViewController: UITableViewController, FillPasswordTabl tableView.estimatedRowHeight = 48 self.tableView.sectionFooterHeight = UITableViewAutomaticDimension; self.tableView.estimatedSectionFooterHeight = 0; - - let tapGesture = UITapGestureRecognizer(target: self, action: #selector(tableTapped)) - tapGesture.delegate = self - tapGesture.cancelsTouchesInView = false - tableView.addGestureRecognizer(tapGesture) } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { @@ -166,35 +161,8 @@ class PasswordEditorTableViewController: UITableViewController, FillPasswordTabl fillPasswordCell?.setContent(content: plainPassword) } - func tableTapped(recognizer: UITapGestureRecognizer) { - if recognizer.state == UIGestureRecognizerState.ended { - let tapLocation = recognizer.location(in: self.tableView) - let tapIndexPath = self.tableView.indexPathForRow(at: tapLocation) - - // do nothing, if delete is tapped (a temporary solution) - if tapIndexPath != nil, deletePasswordCell != nil, - tableView.cellForRow(at: tapIndexPath!) == deletePasswordCell { - return - } - - // hide password settings (e.g., the length slider) - if tapIndexPath?.section != passwordSection, hidePasswordSettings == false { - hidePasswordSettings = true - tableView.reloadSections([passwordSection], with: .fade) - // select the row at tapIndexPath manually - if tapIndexPath != nil { - self.tableView(self.tableView, didSelectRowAt: tapIndexPath!) - } - } - } - } - - func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { - if gestureRecognizer is UITapGestureRecognizer { - // so that the tap gesture could be passed by - return true - } else { - return false - } + func showHidePasswordSettings() { + hidePasswordSettings = !hidePasswordSettings + tableView.reloadSections([passwordSection], with: .fade) } } diff --git a/pass/Views/FillPasswordTableViewCell.swift b/pass/Views/FillPasswordTableViewCell.swift index e97edde..9861cae 100644 --- a/pass/Views/FillPasswordTableViewCell.swift +++ b/pass/Views/FillPasswordTableViewCell.swift @@ -10,6 +10,7 @@ import UIKit protocol FillPasswordTableViewCellDelegate { func generateAndCopyPassword() + func showHidePasswordSettings() } class FillPasswordTableViewCell: ContentTableViewCell { @@ -17,10 +18,17 @@ class FillPasswordTableViewCell: ContentTableViewCell { @IBOutlet weak var contentTextField: UITextField! var delegate: FillPasswordTableViewCellDelegate? + @IBOutlet weak var settingButton: UIButton! + @IBOutlet weak var generateButton: UIButton! + override func awakeFromNib() { super.awakeFromNib() // Initialization code contentTextField.font = UIFont(name: Globals.passwordFonts, size: (contentTextField.font?.pointSize)!) + + // Force aspect ratio of button images + settingButton.imageView?.contentMode = .scaleAspectFit + generateButton.imageView?.contentMode = .scaleAspectFit } override func setSelected(_ selected: Bool, animated: Bool) { @@ -33,6 +41,10 @@ class FillPasswordTableViewCell: ContentTableViewCell { self.delegate?.generateAndCopyPassword() } + @IBAction func showHidePasswordSettings() { + self.delegate?.showHidePasswordSettings() + } + // re-color @IBAction func textFieldDidChange(_ sender: UITextField) { contentTextField.attributedText = Utils.attributedPassword(plainPassword: sender.text ?? "") diff --git a/pass/Views/FillPasswordTableViewCell.xib b/pass/Views/FillPasswordTableViewCell.xib index c27362f..228c84a 100644 --- a/pass/Views/FillPasswordTableViewCell.xib +++ b/pass/Views/FillPasswordTableViewCell.xib @@ -16,13 +16,13 @@ - + - - + + - + @@ -31,31 +31,49 @@ - + - - - - - - - + + + + + + + + + + + + + + + diff --git a/pass/Views/SliderTableViewCell.xib b/pass/Views/SliderTableViewCell.xib index 09698e8..11e5b85 100644 --- a/pass/Views/SliderTableViewCell.xib +++ b/pass/Views/SliderTableViewCell.xib @@ -16,7 +16,7 @@ - + @@ -34,7 +34,7 @@ -