Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WordPressAuthenticator.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "WordPressAuthenticator"
s.version = "1.6.0-beta.1"
s.version = "1.6.0-beta.2"
s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps."

s.description = <<-DESC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import WordPressUI
/// Initializes the WordPressAuthenticator with the specified Configuration.
///
public static func initialize(configuration: WordPressAuthenticatorConfiguration,
style: WordPressAuthenticatorStyle = .defaultStyle,
style: WordPressAuthenticatorStyle,
displayStrings: WordPressAuthenticatorDisplayStrings = .defaultStrings) {
guard privateInstance == nil else {
fatalError("WordPressAuthenticator is already initialized")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,20 @@ public struct WordPressAuthenticatorStyle {

public let disabledTitleColor: UIColor

/// Style: Subheadline
/// Style: Text Buttons
///
public let textButtonColor: UIColor

public let textButtonHighlightColor: UIColor

/// Style: Labels
///
public let instructionColor: UIColor

public let subheadlineColor: UIColor

public let placeholderColor: UIColor

/// Style: Login screen background colors
///
public let viewControllerBackgroundColor: UIColor
Expand All @@ -61,7 +71,7 @@ public struct WordPressAuthenticatorStyle {

/// Designated initializer
///
public init(primaryNormalBackgroundColor: UIColor, primaryNormalBorderColor: UIColor, primaryHighlightBackgroundColor: UIColor, primaryHighlightBorderColor: UIColor, secondaryNormalBackgroundColor: UIColor, secondaryNormalBorderColor: UIColor, secondaryHighlightBackgroundColor: UIColor, secondaryHighlightBorderColor: UIColor, disabledBackgroundColor: UIColor, disabledBorderColor: UIColor, primaryTitleColor: UIColor, secondaryTitleColor: UIColor, disabledTitleColor: UIColor, subheadlineColor: UIColor, viewControllerBackgroundColor: UIColor, navBarImage: UIImage, prologueBackgroundColor: UIColor = WPStyleGuide.wordPressBlue(), prologueTitleColor: UIColor = .white) {
public init(primaryNormalBackgroundColor: UIColor, primaryNormalBorderColor: UIColor, primaryHighlightBackgroundColor: UIColor, primaryHighlightBorderColor: UIColor, secondaryNormalBackgroundColor: UIColor, secondaryNormalBorderColor: UIColor, secondaryHighlightBackgroundColor: UIColor, secondaryHighlightBorderColor: UIColor, disabledBackgroundColor: UIColor, disabledBorderColor: UIColor, primaryTitleColor: UIColor, secondaryTitleColor: UIColor, disabledTitleColor: UIColor, textButtonColor: UIColor, textButtonHighlightColor: UIColor, instructionColor: UIColor, subheadlineColor: UIColor, placeholderColor: UIColor, viewControllerBackgroundColor: UIColor, navBarImage: UIImage, prologueBackgroundColor: UIColor = WPStyleGuide.wordPressBlue(), prologueTitleColor: UIColor = .white) {
self.primaryNormalBackgroundColor = primaryNormalBackgroundColor
self.primaryNormalBorderColor = primaryNormalBorderColor
self.primaryHighlightBackgroundColor = primaryHighlightBackgroundColor
Expand All @@ -75,32 +85,14 @@ public struct WordPressAuthenticatorStyle {
self.primaryTitleColor = primaryTitleColor
self.secondaryTitleColor = secondaryTitleColor
self.disabledTitleColor = disabledTitleColor
self.textButtonColor = textButtonColor
self.textButtonHighlightColor = textButtonHighlightColor
self.instructionColor = instructionColor
self.subheadlineColor = subheadlineColor
self.placeholderColor = placeholderColor
self.viewControllerBackgroundColor = viewControllerBackgroundColor
self.navBarImage = navBarImage
self.prologueBackgroundColor = prologueBackgroundColor
self.prologueTitleColor = prologueTitleColor
}
}

public extension WordPressAuthenticatorStyle {
static var defaultStyle: WordPressAuthenticatorStyle {
return WordPressAuthenticatorStyle(primaryNormalBackgroundColor: WPStyleGuide.mediumBlue(),
primaryNormalBorderColor: WPStyleGuide.wordPressBlue(),
primaryHighlightBackgroundColor: WPStyleGuide.wordPressBlue(),
primaryHighlightBorderColor: WPStyleGuide.wordPressBlue(),
secondaryNormalBackgroundColor: UIColor.white,
secondaryNormalBorderColor: WPStyleGuide.greyLighten20(),
secondaryHighlightBackgroundColor: WPStyleGuide.greyLighten20(),
secondaryHighlightBorderColor: WPStyleGuide.greyLighten20(),
disabledBackgroundColor: UIColor.white,
disabledBorderColor: WPStyleGuide.greyLighten30(),
primaryTitleColor: UIColor.white,
secondaryTitleColor: WPStyleGuide.darkGrey(),
disabledTitleColor: WPStyleGuide.greyLighten30(),
subheadlineColor: WPStyleGuide.wordPressBlue(),
viewControllerBackgroundColor: WPStyleGuide.lightGrey(),
navBarImage: Gridicon.iconOfType(.mySites)
)
}
}
13 changes: 7 additions & 6 deletions WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ final class SubheadlineButton: UIButton {
super.traitCollectionDidChange(previousTraitCollection)
if previousTraitCollection?.preferredContentSizeCategory != traitCollection.preferredContentSizeCategory {
titleLabel?.font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline)
setTitleColor(WordPressAuthenticator.shared.style.subheadlineColor, for: .normal)
setTitleColor(WordPressAuthenticator.shared.style.textButtonColor, for: .normal)
setTitleColor(WordPressAuthenticator.shared.style.textButtonHighlightColor, for: .highlighted)
}
}
}
Expand Down Expand Up @@ -103,8 +104,8 @@ extension WPStyleGuide {
class func googleLoginButton() -> UIButton {
let baseString = NSLocalizedString("{G} Log in with Google.", comment: "Label for button to log in using Google. The {G} will be replaced with the Google logo.")

let attrStrNormal = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryNormalBorderColor)
let attrStrHighlight = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryHighlightBorderColor)
let attrStrNormal = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonColor)
let attrStrHighlight = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonHighlightColor)

let font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline)

Expand All @@ -118,8 +119,8 @@ extension WPStyleGuide {
class func selfHostedLoginButton() -> UIButton {
let baseString = NSLocalizedString("Log in by entering your site address.", comment: "Label for button to log in using your site address.")

let attrStrNormal = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryNormalBorderColor)
let attrStrHighlight = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryHighlightBorderColor)
let attrStrNormal = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonColor)
let attrStrHighlight = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonHighlightColor)

let font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline)

Expand Down Expand Up @@ -210,7 +211,7 @@ extension WPStyleGuide {

let labelString = NSMutableAttributedString(string: "")

if let originalDomainsIcon = Gridicon.iconOfType(.domains).imageWithTintColor(WPStyleGuide.greyLighten10()) {
if let originalDomainsIcon = Gridicon.iconOfType(.domains).imageWithTintColor(WordPressAuthenticator.shared.style.placeholderColor) {
var domainsIcon = originalDomainsIcon.cropping(to: CGRect(x: Constants.domainsIconPaddingToRemove,
y: Constants.domainsIconPaddingToRemove,
width: originalDomainsIcon.size.width - Constants.domainsIconPaddingToRemove * 2,
Expand Down
1 change: 1 addition & 0 deletions WordPressAuthenticator/NUX/NUXLinkMailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class NUXLinkMailViewController: LoginViewController {
return NSLocalizedString("We sent you a magic signup link! Check your email on this device, and tap the link in the email to finish signing up.", comment: "Instructional text on how to open the email containing a magic link.")
}
}()
label?.textColor = WordPressAuthenticator.shared.style.instructionColor
}

// MARK: - Dynamic type
Expand Down
3 changes: 2 additions & 1 deletion WordPressAuthenticator/NUX/WPWalkthroughTextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ - (void)commonInit

// Apply styles to the placeholder if one was set in IB.
if (self.placeholder) {
// colors here are overridden in LoginTextField
NSDictionary *attributes = @{
NSForegroundColorAttributeName : WPStyleGuide.greyLighten10,
NSFontAttributeName : self.font,
Expand All @@ -110,6 +111,7 @@ - (void)configureSecureTextEntryToggle {

self.secureTextEntryToggle = [UIButton buttonWithType:UIButtonTypeCustom];
self.secureTextEntryToggle.clipsToBounds = true;
// colors here are overridden in LoginTextField
self.secureTextEntryToggle.tintColor = [WPStyleGuide greyLighten10];
[self.secureTextEntryToggle addTarget:self action:@selector(secureTextEntryToggleAction:) forControlEvents:UIControlEventTouchUpInside];

Expand Down Expand Up @@ -146,7 +148,6 @@ - (void)drawRect:(CGRect)rect
CGContextAddPath(context, path.CGPath);
CGContextSetStrokeColorWithColor(context, [UIColor colorWithWhite:0.87 alpha:1.0].CGColor);
CGContextStrokePath(context);

}


Expand Down
Loading