Commit 49f3926f authored by Jose Blaya's avatar Jose Blaya
Browse files

wip

parent 336210de
......@@ -356,14 +356,16 @@ public class Theme {
/// :nodoc:
public func applyTitle(_ label: UILabel, appearance: Appearance) {
label.font = typeface.regularFont(size: 16.0)
label.textColor = palette.textColor(forRelevance: 1, appearance: appearance)
if palette.appearance == Appearance.light {
label.style(style: TextStyle.textStyle2)
} else {
label.style(style: TextStyle.textStyle1)
}
}
/// :nodoc:
public func applySubtitle(_ label: UILabel, appearance: Appearance) {
label.font = typeface.regularFont(size: 13.0)
label.textColor = palette.textColor(forRelevance: 2, appearance: appearance)
public func applySubtitle(_ label: UILabel) {
label.style(style: TextStyle.textStyle8)
}
/// :nodoc:
......@@ -533,9 +535,10 @@ public class Theme {
let attributed = NSMutableAttributedString(string: plain as String)
let paragraph = NSMutableParagraphStyle()
paragraph.alignment = .center
paragraph.minimumLineHeight = 16
let fullRange = NSMakeRange(0, plain.length)
attributed.addAttribute(.font, value: typeface.regularFont(size: 13.0), range: fullRange)
attributed.addAttribute(.foregroundColor, value: palette.textColor(forRelevance: 3, appearance: .dark), range: fullRange)
attributed.addAttribute(.font, value: UIFont.regularFontWith(size: 12), range: fullRange)
attributed.addAttribute(.foregroundColor, value: UIColor.piaGrey4, range: fullRange)
attributed.addAttribute(.paragraphStyle, value: paragraph, range: fullRange)
let range1 = plain.range(of: tos)
let range2 = plain.range(of: privacy)
......@@ -624,7 +627,7 @@ public class Theme {
/// :nodoc:
public func applyLinkAttributes(_ textView: UITextView) {
textView.tintColor = palette.emphasis
textView.tintColor = palette.lineColor
}
// MARK: Strategy
......
......@@ -18,7 +18,7 @@ public extension UILabel {
if let text = text {
let attributeString = NSMutableAttributedString(string: text)
let style = NSMutableParagraphStyle()
style.lineSpacing = lineHeight
style.minimumLineHeight = lineHeight
attributeString.addAttribute(NSAttributedStringKey.paragraphStyle,
value: style,
range: NSRange(location: 0,
......
......@@ -13,12 +13,7 @@ import UIKit
*/
public class PIAWelcomeViewController: AutolayoutViewController, WelcomeCompletionDelegate, ConfigurationAccess, InAppAccess, BrandableNavigationBar {
@IBOutlet private weak var viewHeader: UIView!
@IBOutlet private weak var buttonCancel: UIButton!
@IBOutlet private weak var constraintHeaderHeight: NSLayoutConstraint!
@IBOutlet private weak var buttonCancel: UIButton!
@IBOutlet private weak var buttonEnvironment: UIButton!
var preset = Preset()
......@@ -62,7 +57,6 @@ public class PIAWelcomeViewController: AutolayoutViewController, WelcomeCompleti
fatalError("You are already logged in, you might want to Client.database.truncate() to start clean")
}
constraintHeaderHeight.constant = (Macros.isDeviceBig ? 250.0 : 150.0)
buttonCancel.isHidden = !preset.allowsCancel
buttonCancel.accessibilityLabel = L10n.Ui.Global.cancel
buttonEnvironment.isHidden = !accessedConfiguration.isDevelopment
......
......@@ -36,7 +36,7 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
@IBOutlet private weak var textAgreement: UITextView!
@IBOutlet private weak var buttonRedeem: ActivityButton!
@IBOutlet private weak var buttonRedeem: PIAButton!
@IBOutlet private weak var viewFooter: UIView!
......@@ -67,7 +67,6 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
}
override func viewDidLoad() {
super.viewDidLoad()
guard let preset = self.preset else {
fatalError("Preset not propagated")
......@@ -86,16 +85,22 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
privacy: L10n.Welcome.Agreement.Message.privacy,
privacyUrl: Client.configuration.privacyUrl
)
buttonRedeem.title = L10n.Welcome.Redeem.submit
buttonRedeem.setTitle(L10n.Welcome.Redeem.title,
for: [])
labelLogin1.text = L10n.Welcome.Purchase.Login.footer
labelLogin2.text = L10n.Welcome.Purchase.Login.button
buttonRedeem.accessibilityIdentifier = "uitests.redeem.submit"
styleRedeemButton()
viewLogin.accessibilityLabel = "\(labelLogin1.text!) \(labelLogin2.text!)"
textEmail.text = preset.redeemEmail
if let code = preset.redeemCode {
redeemCode = GiftCardUtil.strippedRedeemCode(code) // will set textCode automatically
}
super.viewDidLoad()
labelSubtitle.textAlignment = .center
}
override func viewWillAppear(_ animated: Bool) {
......@@ -111,9 +116,9 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
// MARK: Actions
@IBAction private func redeem(_ sender: Any?) {
guard !buttonRedeem.isRunningActivity else {
return
}
//guard !buttonRedeem.isRunningActivity else {
// return
//}
guard let email = textEmail.text?.trimmed(), Validator.validate(email: email) else {
presentAlertWith(title: L10n.Welcome.Redeem.Error.title,
......@@ -193,6 +198,13 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
}
private func styleRedeemButton() {
buttonRedeem.setRounded()
buttonRedeem.style(style: TextStyle.Buttons.piaGreenButton)
buttonRedeem.setTitle(L10n.Welcome.Redeem.title,
for: [])
}
private func presentUnauthorizeCameraError() {
DispatchQueue.main.async {
self.presentAlertWith(title: L10n.Welcome.Camera.Access.Error.title,
......@@ -217,9 +229,9 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
private func enableInteractions(_ enable: Bool) {
parent?.view.isUserInteractionEnabled = enable
if enable {
buttonRedeem.stopActivity()
//buttonRedeem.stopActivity()
} else {
buttonRedeem.startActivity()
//buttonRedeem.startActivity()
}
}
......@@ -229,11 +241,10 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
super.viewShouldRestyle()
Theme.current.applyTitle(labelTitle, appearance: .dark)
Theme.current.applySubtitle(labelSubtitle, appearance: .dark)
Theme.current.applySubtitle(labelSubtitle)
Theme.current.applyInput(textEmail)
Theme.current.applyInput(textCode)
Theme.current.applyLinkAttributes(textAgreement)
Theme.current.applyActionButton(buttonRedeem)
Theme.current.applyBody1(labelLogin1, appearance: .dark)
Theme.current.applyTextButton(labelLogin2)
}
......
......@@ -146,7 +146,7 @@ class RestoreSignupViewController: AutolayoutViewController {
Theme.current.applyCorner(viewModal)
Theme.current.applyTitle(labelTitle, appearance: .dark)
Theme.current.applySubtitle(labelDescription, appearance: .dark)
Theme.current.applySubtitle(labelDescription)
Theme.current.applyInput(textEmail)
Theme.current.applyActionButton(buttonRestorePurchase)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment