diff --git a/.travis.yml b/.travis.yml index e115d04..b93ab1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,12 @@ language: objective-c +<<<<<<< HEAD osx_image: xcode8.3 branches: only: - develop +======= +osx_image: xcode8.2 +>>>>>>> uiimprovement before_install: - echo -e "machine github.com\n login $GITHUB_ACCESS_TOKEN" >> ~/.netrc script: diff --git a/fastlane/Fastfile b/fastlane/Fastfile index ca14983..07e7ac1 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -52,13 +52,22 @@ platform :ios do keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"], readonly: true ) +<<<<<<< HEAD # ensure_git_status_clean +======= + ensure_git_status_clean +>>>>>>> uiimprovement increment_build_number( build_number: latest_testflight_build_number + 1, xcodeproj: "pass.xcodeproj" ) +<<<<<<< HEAD # commit_version_bump(xcodeproj: "pass.xcodeproj") # push_to_git_remote +======= + commit_version_bump(xcodeproj: "pass.xcodeproj") + push_to_git_remote(local_branch: "develop") +>>>>>>> uiimprovement gym(scheme: "pass") pilot(skip_waiting_for_build_processing: true) mailgun( diff --git a/pass/Assets.xcassets/Camera.imageset/Contents.json b/pass/Assets.xcassets/Camera.imageset/Contents.json new file mode 100644 index 0000000..3f581ce --- /dev/null +++ b/pass/Assets.xcassets/Camera.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Screenshot-50.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Screenshot-100.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/pass/Assets.xcassets/Camera.imageset/Screenshot-100.png b/pass/Assets.xcassets/Camera.imageset/Screenshot-100.png new file mode 100644 index 0000000..8375cf6 Binary files /dev/null and b/pass/Assets.xcassets/Camera.imageset/Screenshot-100.png differ diff --git a/pass/Assets.xcassets/Camera.imageset/Screenshot-50.png b/pass/Assets.xcassets/Camera.imageset/Screenshot-50.png new file mode 100644 index 0000000..59fd700 Binary files /dev/null and b/pass/Assets.xcassets/Camera.imageset/Screenshot-50.png differ diff --git a/pass/Assets.xcassets/Copy.imageset/Contents.json b/pass/Assets.xcassets/Copy.imageset/Contents.json new file mode 100644 index 0000000..96c0b79 --- /dev/null +++ b/pass/Assets.xcassets/Copy.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Copy-50.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Copy-100.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/pass/Assets.xcassets/Copy.imageset/Copy-100.png b/pass/Assets.xcassets/Copy.imageset/Copy-100.png new file mode 100644 index 0000000..7bbaf9a Binary files /dev/null and b/pass/Assets.xcassets/Copy.imageset/Copy-100.png differ diff --git a/pass/Assets.xcassets/Copy.imageset/Copy-50.png b/pass/Assets.xcassets/Copy.imageset/Copy-50.png new file mode 100644 index 0000000..fe26bc2 Binary files /dev/null and b/pass/Assets.xcassets/Copy.imageset/Copy-50.png differ diff --git a/pass/Assets.xcassets/HorizontalSettings.imageset/Contents.json b/pass/Assets.xcassets/HorizontalSettings.imageset/Contents.json new file mode 100644 index 0000000..f75fd31 --- /dev/null +++ b/pass/Assets.xcassets/HorizontalSettings.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Horizontal Settings Mixer-50.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Horizontal Settings Mixer-75.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/pass/Assets.xcassets/HorizontalSettings.imageset/Horizontal Settings Mixer-50.png b/pass/Assets.xcassets/HorizontalSettings.imageset/Horizontal Settings Mixer-50.png new file mode 100644 index 0000000..0d8ce8b Binary files /dev/null and b/pass/Assets.xcassets/HorizontalSettings.imageset/Horizontal Settings Mixer-50.png differ diff --git a/pass/Assets.xcassets/HorizontalSettings.imageset/Horizontal Settings Mixer-75.png b/pass/Assets.xcassets/HorizontalSettings.imageset/Horizontal Settings Mixer-75.png new file mode 100644 index 0000000..84f4783 Binary files /dev/null and b/pass/Assets.xcassets/HorizontalSettings.imageset/Horizontal Settings Mixer-75.png differ diff --git a/pass/Assets.xcassets/Invisible.imageset/Contents.json b/pass/Assets.xcassets/Invisible.imageset/Contents.json new file mode 100644 index 0000000..be7c464 --- /dev/null +++ b/pass/Assets.xcassets/Invisible.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Invisible-64.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Invisible-75.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/pass/Assets.xcassets/Invisible.imageset/Invisible-64.png b/pass/Assets.xcassets/Invisible.imageset/Invisible-64.png new file mode 100644 index 0000000..d5db588 Binary files /dev/null and b/pass/Assets.xcassets/Invisible.imageset/Invisible-64.png differ diff --git a/pass/Assets.xcassets/Invisible.imageset/Invisible-75.png b/pass/Assets.xcassets/Invisible.imageset/Invisible-75.png new file mode 100644 index 0000000..fe3500c Binary files /dev/null and b/pass/Assets.xcassets/Invisible.imageset/Invisible-75.png differ diff --git a/pass/Assets.xcassets/Refresh.imageset/Contents.json b/pass/Assets.xcassets/Refresh.imageset/Contents.json new file mode 100644 index 0000000..5932896 --- /dev/null +++ b/pass/Assets.xcassets/Refresh.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Refresh-64.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Refresh-75.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/pass/Assets.xcassets/Refresh.imageset/Refresh-64.png b/pass/Assets.xcassets/Refresh.imageset/Refresh-64.png new file mode 100644 index 0000000..4ce94ef Binary files /dev/null and b/pass/Assets.xcassets/Refresh.imageset/Refresh-64.png differ diff --git a/pass/Assets.xcassets/Refresh.imageset/Refresh-75.png b/pass/Assets.xcassets/Refresh.imageset/Refresh-75.png new file mode 100644 index 0000000..7a710ba Binary files /dev/null and b/pass/Assets.xcassets/Refresh.imageset/Refresh-75.png differ diff --git a/pass/Assets.xcassets/Visible.imageset/Contents.json b/pass/Assets.xcassets/Visible.imageset/Contents.json new file mode 100644 index 0000000..95be3a5 --- /dev/null +++ b/pass/Assets.xcassets/Visible.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Visible-64.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Visible-75.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/pass/Assets.xcassets/Visible.imageset/Visible-64.png b/pass/Assets.xcassets/Visible.imageset/Visible-64.png new file mode 100644 index 0000000..bfd6f0a Binary files /dev/null and b/pass/Assets.xcassets/Visible.imageset/Visible-64.png differ diff --git a/pass/Assets.xcassets/Visible.imageset/Visible-75.png b/pass/Assets.xcassets/Visible.imageset/Visible-75.png new file mode 100644 index 0000000..144e87d Binary files /dev/null and b/pass/Assets.xcassets/Visible.imageset/Visible-75.png differ 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/Helpers/Globals.swift b/pass/Helpers/Globals.swift index dda0746..069ff6b 100644 --- a/pass/Helpers/Globals.swift +++ b/pass/Helpers/Globals.swift @@ -21,15 +21,17 @@ class Globals { static let repositoryPath = "\(libraryPath)/password-store" static var passcodeConfiguration = PasscodeLockConfiguration() - static let red = UIColor(red:1.00, green:0.23, blue:0.19, alpha:1.0) - static let blue = UIColor(red:0.00, green:0.48, blue:1.00, alpha:1.0) - static let passwordDefaultLength = ["Random": (min: 6, max: 24, def: 16), "Apple": (min: 15, max: 15, def: 15)] static let passwordDots = "••••••••••••" static let passwordFonts = "Menlo" + // UI related + static let red = UIColor(red:1.00, green:0.23, blue:0.19, alpha:1.0) + static let blue = UIColor(red:0.00, green:0.48, blue:1.00, alpha:1.0) + static let tableCellButtonSize = CGFloat(20.0) + private init() { } } 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/LabelTableViewCell.swift b/pass/Views/LabelTableViewCell.swift index 726b535..2ffbc5c 100644 --- a/pass/Views/LabelTableViewCell.swift +++ b/pass/Views/LabelTableViewCell.swift @@ -27,6 +27,9 @@ class LabelTableViewCell: UITableViewCell { weak var delegatePasswordTableView : PasswordDetailTableViewController? + var passwordDisplayButton: UIButton? + var buttons: UIView? + var cellData: LabelTableViewCellData? { didSet { titleLabel.text = cellData?.title ?? "" @@ -43,9 +46,11 @@ class LabelTableViewCell: UITableViewCell { } else { contentLabel.text = Globals.passwordDots } + contentLabel.font = UIFont(name: Globals.passwordFonts, size: contentLabel.font.pointSize) } else { contentLabel.text = cellData?.content } + updateButtons() } } @@ -58,6 +63,13 @@ class LabelTableViewCell: UITableViewCell { override func awakeFromNib() { super.awakeFromNib() } + + override func layoutSubviews() { + super.layoutSubviews() + if buttons != nil { + self.accessoryView = buttons + } + } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) @@ -99,13 +111,26 @@ class LabelTableViewCell: UITableViewCell { contentLabel.text = "" } isReveal = true + passwordDisplayButton?.setImage(#imageLiteral(resourceName: "Invisible"), for: .normal) } func concealPassword(_ sender: Any?) { contentLabel.text = Globals.passwordDots isReveal = false + passwordDisplayButton?.setImage(#imageLiteral(resourceName: "Visible"), for: .normal) } + func reversePasswordDisplay(_ sender: Any?) { + if isReveal { + // conceal + concealPassword(sender) + } else { + // reveal + revealPassword(sender) + } + } + + func openLink(_ sender: Any?) { // if isURLCell, passwordTableView should not be nil delegatePasswordTableView!.openLink() @@ -115,4 +140,41 @@ class LabelTableViewCell: UITableViewCell { // if isHOTPCell, passwordTableView should not be nil delegatePasswordTableView!.getNextHOTP() } + + func updateButtons() { + passwordDisplayButton = nil + buttons = nil + if isPasswordCell { + // password button + passwordDisplayButton = UIButton(type: .system) + passwordDisplayButton!.frame = CGRect(x: 0, y: 0, width: Globals.tableCellButtonSize, height: Globals.tableCellButtonSize) + passwordDisplayButton!.setImage(#imageLiteral(resourceName: "Visible"), for: .normal) + passwordDisplayButton!.imageView?.contentMode = .scaleAspectFit + passwordDisplayButton!.addTarget(self, action: #selector(reversePasswordDisplay), for: UIControlEvents.touchUpInside) + buttons = passwordDisplayButton + } else if isHOTPCell { + let spacing = CGFloat(10.0) + + // hotp button + let nextButton = UIButton(type: .system) + nextButton.frame = CGRect(x: 0, y: 0, + width: Globals.tableCellButtonSize, height: Globals.tableCellButtonSize) + nextButton.setImage(#imageLiteral(resourceName: "Refresh"), for: .normal) + nextButton.imageView?.contentMode = .scaleAspectFit + nextButton.addTarget(self, action: #selector(getNextHOTP), for: UIControlEvents.touchUpInside) + + // password button + passwordDisplayButton = UIButton(type: .system) + passwordDisplayButton!.frame = CGRect(x: Globals.tableCellButtonSize + spacing, y: 0, + width: Globals.tableCellButtonSize, height: Globals.tableCellButtonSize) + passwordDisplayButton!.setImage(#imageLiteral(resourceName: "Visible"), for: .normal) + passwordDisplayButton!.imageView?.contentMode = .scaleAspectFit + passwordDisplayButton!.addTarget(self, action: #selector(reversePasswordDisplay), for: UIControlEvents.touchUpInside) + + buttons = UIView() + buttons!.frame = CGRect(x: 0, y: 0, width: Globals.tableCellButtonSize * 2 + spacing, height: Globals.tableCellButtonSize) + buttons!.addSubview(nextButton) + buttons!.addSubview(passwordDisplayButton!) + } + } } 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 @@ -