Tweak password font

This commit is contained in:
Bob Sun 2017-10-07 23:05:26 -07:00
parent 6ea47766bc
commit 3605e59c30
4 changed files with 8 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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))