From 3605e59c30ab98fdd25de58372ece5158c6b5b84 Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Sat, 7 Oct 2017 23:05:26 -0700 Subject: [PATCH] Tweak password font --- pass/Views/FillPasswordTableViewCell.swift | 2 +- pass/Views/LabelTableViewCell.swift | 4 ++-- passKit/Helpers/Globals.swift | 5 +++-- passKit/Helpers/Utils.swift | 2 ++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pass/Views/FillPasswordTableViewCell.swift b/pass/Views/FillPasswordTableViewCell.swift index 97c702d..0042ba1 100644 --- a/pass/Views/FillPasswordTableViewCell.swift +++ b/pass/Views/FillPasswordTableViewCell.swift @@ -25,7 +25,7 @@ class FillPasswordTableViewCell: ContentTableViewCell { override func awakeFromNib() { super.awakeFromNib() // Initialization code - contentTextField.font = UIFont(name: Globals.passwordFonts, size: (contentTextField.font?.pointSize)!) + contentTextField.font = Globals.passwordFont // Force aspect ratio of button images settingButton.imageView?.contentMode = .scaleAspectFit diff --git a/pass/Views/LabelTableViewCell.swift b/pass/Views/LabelTableViewCell.swift index fd72303..b1d8def 100644 --- a/pass/Views/LabelTableViewCell.swift +++ b/pass/Views/LabelTableViewCell.swift @@ -51,7 +51,7 @@ class LabelTableViewCell: UITableViewCell { contentLabel.text = Globals.passwordDots } } - contentLabel.font = UIFont(name: Globals.passwordFonts, size: contentLabel.font.pointSize) + contentLabel.font = Globals.passwordFont case "hmac-based": type = .HOTP if isReveal { @@ -59,7 +59,7 @@ class LabelTableViewCell: UITableViewCell { } else { contentLabel.text = Globals.oneTimePasswordDots } - contentLabel.font = UIFont(name: Globals.passwordFonts, size: contentLabel.font.pointSize) + contentLabel.font = Globals.passwordFont case "url": type = .URL contentLabel.text = content diff --git a/passKit/Helpers/Globals.swift b/passKit/Helpers/Globals.swift index 5bd7688..cc7962d 100644 --- a/passKit/Helpers/Globals.swift +++ b/passKit/Helpers/Globals.swift @@ -47,12 +47,13 @@ public class Globals { public static let passwordDots = "••••••••••••" public static let oneTimePasswordDots = "••••••" - public static let passwordFonts = "Courier" + public static let passwordFont = UIFont(name: "Courier-Bold", size: UIFont.labelFontSize - 1) // UI related public static let red = UIColor(red:1.00, green:0.23, blue:0.19, alpha:1.0) public static let blue = UIColor(red:0.00, green:0.48, blue:1.00, alpha:1.0) - public static let letterColor = UIColor(red:200/255.0, green:40/255.0, blue:41/255.0, alpha:1.0) + public static let letterColor = UIColor(red:40/255.0, green:42/255.0, blue:54/255.0, alpha:1.0) + public static let symbolColor = UIColor(red:200/255.0, green:40/255.0, blue:41/255.0, alpha:1.0) public static let digitColor = UIColor(red:66/255.0, green:113/255.0, blue:174/255.0, alpha:1.0) public static let tableCellButtonSize = CGFloat(20.0) diff --git a/passKit/Helpers/Utils.swift b/passKit/Helpers/Utils.swift index 3ddd167..c97308e 100644 --- a/passKit/Helpers/Utils.swift +++ b/passKit/Helpers/Utils.swift @@ -109,6 +109,8 @@ public class Utils { if NSCharacterSet.decimalDigits.contains(element) { charColor = Globals.digitColor } else if !NSCharacterSet.letters.contains(element) { + charColor = Globals.symbolColor + } else { charColor = Globals.letterColor } attributedPassword.addAttribute(NSAttributedStringKey.foregroundColor, value: charColor, range: NSRange(location: index, length: 1))