Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 79eaec1

Browse files
committed
Merge branch 'develop'
2 parents 06ac3c3 + 1e35cf6 commit 79eaec1

File tree

10 files changed

+207
-26
lines changed

10 files changed

+207
-26
lines changed

WordPressAuthenticator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "WordPressAuthenticator"
3-
s.version = "1.7.0"
3+
s.version = "1.8.0-beta.1"
44
s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps."
55

66
s.description = <<-DESC

WordPressAuthenticator.xcodeproj/project.pbxproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
1A21EE9822832BC300C940C6 /* WordPressComOAuthClientFacade+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A21EE9722832BC200C940C6 /* WordPressComOAuthClientFacade+Swift.swift */; };
1111
1A4095182271AEFC009AA86D /* WPAuthenticator-Swift.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4095152271AEFC009AA86D /* WPAuthenticator-Swift.h */; settings = {ATTRIBUTES = (Private, ); }; };
1212
7A7A9B9CD2D81959F9AB9AF6 /* Pods_WordPressAuthenticator.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C736FF243DE333FCAB1C2614 /* Pods_WordPressAuthenticator.framework */; };
13+
982C8E7923021C20003F1BA0 /* LoginPrologueLoginMethodViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 982C8E7823021C20003F1BA0 /* LoginPrologueLoginMethodViewController.swift */; };
1314
98AA5A5720AA1A7000A5958A /* WPHelpIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98AA5A5620AA1A7000A5958A /* WPHelpIndicatorView.swift */; };
1415
B501C045208FC68700D1E58F /* LoginFieldsValidationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501C03C208FC52400D1E58F /* LoginFieldsValidationTests.swift */; };
1516
B501C046208FC6A700D1E58F /* WordPressAuthenticatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B501C03E208FC52500D1E58F /* WordPressAuthenticatorTests.swift */; };
@@ -147,6 +148,8 @@
147148
37AFD4EF492B00CA7AEC11A3 /* Pods-WordPressAuthenticatorTests.release-alpha.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticatorTests.release-alpha.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticatorTests/Pods-WordPressAuthenticatorTests.release-alpha.xcconfig"; sourceTree = "<group>"; };
148149
5A441EC80D2B8D2209C2E228 /* Pods_WordPressAuthenticatorTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WordPressAuthenticatorTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
149150
8F7217C3F7A6285D9C6CF786 /* Pods-WordPressAuthenticator.release-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticator.release-internal.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticator/Pods-WordPressAuthenticator.release-internal.xcconfig"; sourceTree = "<group>"; };
151+
982C8E7823021C20003F1BA0 /* LoginPrologueLoginMethodViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginPrologueLoginMethodViewController.swift; sourceTree = "<group>"; };
152+
982C8E7E2302355B003F1BA0 /* LoginPrologueLoginMethodViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LoginPrologueLoginMethodViewController.swift; path = WordPressAuthenticator/Signin/LoginPrologueLoginMethodViewController.swift; sourceTree = "<group>"; };
150153
98AA5A5620AA1A7000A5958A /* WPHelpIndicatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WPHelpIndicatorView.swift; sourceTree = "<group>"; };
151154
AE612958059F9E80B54138B3 /* Pods-WordPressAuthenticatorTests.release-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticatorTests.release-internal.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticatorTests/Pods-WordPressAuthenticatorTests.release-internal.xcconfig"; sourceTree = "<group>"; };
152155
B0D7D40BC1DE2D367761AD86 /* Pods-WordPressAuthenticatorTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticatorTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticatorTests/Pods-WordPressAuthenticatorTests.debug.xcconfig"; sourceTree = "<group>"; };
@@ -256,7 +259,7 @@
256259
CE30A2AC2257CECC00DF3CDA /* AuthenticatorCredentials.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticatorCredentials.swift; sourceTree = "<group>"; };
257260
E9414A95E29F3297555AC92B /* Pods-WordPressAuthenticator.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticator.debug.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticator/Pods-WordPressAuthenticator.debug.xcconfig"; sourceTree = "<group>"; };
258261
FF475C5056EB60A277696BA9 /* Pods-WordPressAuthenticatorTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticatorTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticatorTests/Pods-WordPressAuthenticatorTests.release.xcconfig"; sourceTree = "<group>"; };
259-
FF629D9522393500004C4106 /* WordPressAuthenticator.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WordPressAuthenticator.podspec; sourceTree = "<group>"; };
262+
FF629D9522393500004C4106 /* WordPressAuthenticator.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WordPressAuthenticator.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
260263
/* End PBXFileReference section */
261264

262265
/* Begin PBXFrameworksBuildPhase section */
@@ -349,6 +352,7 @@
349352
B5609128208A563600399AE4 /* LoginEmailViewController.swift */,
350353
B5609129208A563600399AE4 /* LoginLinkRequestViewController.swift */,
351354
B5609131208A563700399AE4 /* LoginNavigationController.swift */,
355+
982C8E7823021C20003F1BA0 /* LoginPrologueLoginMethodViewController.swift */,
352356
B560912C208A563700399AE4 /* LoginProloguePageViewController.swift */,
353357
B560912B208A563600399AE4 /* LoginProloguePromoViewController.swift */,
354358
B5609133208A563700399AE4 /* LoginPrologueSignupMethodViewController.swift */,
@@ -487,6 +491,7 @@
487491
B5ED78EA207E976500A8FD8C = {
488492
isa = PBXGroup;
489493
children = (
494+
982C8E7E2302355B003F1BA0 /* LoginPrologueLoginMethodViewController.swift */,
490495
FF629D9522393500004C4106 /* WordPressAuthenticator.podspec */,
491496
B5ED78F6207E976500A8FD8C /* WordPressAuthenticator */,
492497
B5ED7901207E976500A8FD8C /* WordPressAuthenticatorTests */,
@@ -843,6 +848,7 @@
843848
isa = PBXSourcesBuildPhase;
844849
buildActionMask = 2147483647;
845850
files = (
851+
982C8E7923021C20003F1BA0 /* LoginPrologueLoginMethodViewController.swift in Sources */,
846852
B5609144208A563800399AE4 /* LoginPrologueSignupMethodViewController.swift in Sources */,
847853
B56090CD208A4F5400399AE4 /* NUXSegueHandler.swift in Sources */,
848854
B56090D1208A4F5400399AE4 /* NUXViewController.swift in Sources */,

WordPressAuthenticator/Authenticator/WordPressAuthenticatorConfiguration.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ public struct WordPressAuthenticatorConfiguration {
4545
///
4646
let userAgent: String
4747

48+
/// Flag indicating which Log In flow to display.
49+
/// In the new flow, when Log In is selected, a button view is displayed with options.
50+
/// In the old flow, when Log In is selected, the email login view is displayed with alternative options.
51+
///
52+
let showNewLoginFlow: Bool
53+
54+
4855
/// Designated Initializer
4956
///
5057
public init (wpcomClientId: String,
@@ -56,7 +63,8 @@ public struct WordPressAuthenticatorConfiguration {
5663
googleLoginClientId: String,
5764
googleLoginServerClientId: String,
5865
googleLoginScheme: String,
59-
userAgent: String) {
66+
userAgent: String,
67+
showNewLoginFlow: Bool = false) {
6068

6169
self.wpcomClientId = wpcomClientId
6270
self.wpcomSecret = wpcomSecret
@@ -68,5 +76,6 @@ public struct WordPressAuthenticatorConfiguration {
6876
self.googleLoginServerClientId = googleLoginServerClientId
6977
self.googleLoginScheme = googleLoginScheme
7078
self.userAgent = userAgent
79+
self.showNewLoginFlow = showNewLoginFlow
7180
}
7281
}

WordPressAuthenticator/Authenticator/WordPressAuthenticatorDisplayStrings.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public struct WordPressAuthenticatorDisplayStrings {
2323

2424
public extension WordPressAuthenticatorDisplayStrings {
2525
static var defaultStrings: WordPressAuthenticatorDisplayStrings {
26-
return WordPressAuthenticatorDisplayStrings(emailLoginInstructions: NSLocalizedString("Log in to WordPress.com using an email address to manage all your WordPress sites.", comment: "Instruction text on the login's email address screen."),
27-
jetpackLoginInstructions: NSLocalizedString("Log in to the WordPress.com account you used to connect Jetpack.", comment: "Instruction text on the login's email address screen."),
28-
siteLoginInstructions: NSLocalizedString("Enter the address of your WordPress site you'd like to connect.", comment: "Instruction text on the login's site addresss screen."))
26+
return WordPressAuthenticatorDisplayStrings(emailLoginInstructions: NSLocalizedString("Log in to your WordPress.com account with your email address.", comment: "Instruction text on the login's email address screen."),
27+
jetpackLoginInstructions: NSLocalizedString("Log in to the WordPress.com account you used to connect Jetpack.", comment: "Instruction text on the login's email address screen."),
28+
siteLoginInstructions: NSLocalizedString("Enter the address of your WordPress site you'd like to connect.", comment: "Instruction text on the login's site addresss screen."))
2929
}
3030
}

WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,33 @@ extension WPStyleGuide {
116116
///
117117
/// - Returns: A properly styled UIButton
118118
///
119-
class func selfHostedLoginButton() -> UIButton {
120-
let baseString = NSLocalizedString("Log in by entering your site address.", comment: "Label for button to log in using your site address.")
121-
122-
let attrStrNormal = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonColor)
123-
let attrStrHighlight = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonHighlightColor)
124-
125-
let font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline)
126-
127-
return textButton(normal: attrStrNormal, highlighted: attrStrHighlight, font: font)
119+
class func selfHostedLoginButton(alignment: UIControl.NaturalContentHorizontalAlignment = .leading) -> UIButton {
120+
121+
let style = WordPressAuthenticator.shared.style
122+
123+
let button: UIButton
124+
125+
if WordPressAuthenticator.shared.configuration.showNewLoginFlow {
126+
let baseString = NSLocalizedString("Or log in by _entering your site address_.", comment: "Label for button to log in using site address. Underscores _..._ denote underline.")
127+
128+
let attrStrNormal = baseString.underlined(color: style.subheadlineColor, underlineColor: style.textButtonColor)
129+
let attrStrHighlight = baseString.underlined(color: style.subheadlineColor, underlineColor: style.textButtonHighlightColor)
130+
let font = WPStyleGuide.mediumWeightFont(forStyle: .caption2)
131+
132+
button = textButton(normal: attrStrNormal, highlighted: attrStrHighlight, font: font, alignment: alignment)
133+
} else {
134+
let baseString = NSLocalizedString("Log in by entering your site address.", comment: "Label for button to log in using your site address.")
135+
136+
let attrStrNormal = selfHostedButtonString(baseString, linkColor: style.textButtonColor)
137+
let attrStrHighlight = selfHostedButtonString(baseString, linkColor: style.textButtonHighlightColor)
138+
let font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline)
139+
140+
button = textButton(normal: attrStrNormal, highlighted: attrStrHighlight, font: font)
141+
}
142+
143+
button.accessibilityIdentifier = "Self Hosted Login Button"
144+
145+
return button
128146
}
129147

130148
/// Creates a button for wpcom signup on the email screen

WordPressAuthenticator/NUX/NUXViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ open class NUXViewController: UIViewController, NUXViewControllerBase, UIViewCon
4141
case showCreateSite
4242
case showSignupEmail
4343
case showUsernames
44+
case showLoginMethod
4445
}
4546

4647
override open func viewDidLoad() {
@@ -72,7 +73,9 @@ extension NUXViewController {
7273
// Required so that any FancyAlertViewControllers presented within the NUX
7374
// use the correct dimmed backing view.
7475
open func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
75-
if presented is FancyAlertViewController || presented is LoginPrologueSignupMethodViewController {
76+
if presented is FancyAlertViewController ||
77+
presented is LoginPrologueSignupMethodViewController ||
78+
presented is LoginPrologueLoginMethodViewController {
7679
return FancyAlertPresentationController(presentedViewController: presented, presenting: presenting)
7780
}
7881

0 commit comments

Comments
 (0)