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

Commit c879d53

Browse files
Show social login options in site credentials login mode (#849)
2 parents e8dba00 + faa401b commit c879d53

File tree

5 files changed

+45
-25
lines changed

5 files changed

+45
-25
lines changed

.buildkite/pipeline.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Nodes with values to reuse in the pipeline.
22
common_params:
33
plugins: &common_plugins
4-
- automattic/a8c-ci-toolkit#3.1.0
4+
- automattic/a8c-ci-toolkit#3.2.2
55
env: &common_env
66
IMAGE_ID: xcode-15.0.1
77

@@ -28,7 +28,9 @@ steps:
2828
- label: "🔬 Validate Podspec"
2929
key: "validate"
3030
command: |
31-
validate_podspec --patch-cocoapods
31+
# This library use deprecated Gravatar API in WordPressUI.
32+
# Allow warning for now, until we are ready to migrate to Gravatar SDK.
33+
validate_podspec --patch-cocoapods --allow-warnings
3234
env: *common_env
3335
plugins: *common_plugins
3436

.buildkite/publish-pod.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ echo "--- :rubygems: Setting up Gems"
88
install_gems
99

1010
echo "--- :cocoapods: Publishing Pod to CocoaPods CDN"
11-
publish_pod --patch-cocoapods $PODSPEC_PATH
11+
publish_pod --patch-cocoapods $PODSPEC_PATH --allow-warnings
1212

1313
echo "--- :cocoapods: Publishing Pod to WP Specs Repo"
1414
publish_private_pod --patch-cocoapods $PODSPEC_PATH $SPECS_REPO "$SPEC_REPO_PUBLIC_DEPLOY_KEY"

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ _None._
3434

3535
### Breaking Changes
3636

37-
_None._
37+
- Show social login options in site credentials login mode [#849]
3838

3939
### New Features
4040

WordPressAuthenticator/NUX/Button/NUXButtonViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ open class NUXButtonViewController: UIViewController {
178178
bottomButtonConfig = buttonConfigFor(socialService: socialService, onTap: callback)
179179
}
180180

181+
func setupTertiaryButton(attributedTitle: NSAttributedString, isPrimary: Bool = false, accessibilityIdentifier: String? = nil, onTap callback: @escaping CallBackType) {
182+
tertiaryButton?.isHidden = false
183+
tertiaryButtonConfig = NUXButtonConfig(attributedTitle: attributedTitle, isPrimary: isPrimary, accessibilityIdentifier: accessibilityIdentifier, callback: callback)
184+
}
185+
181186
func setupTertiaryButton(title: String, isPrimary: Bool = false, accessibilityIdentifier: String? = nil, onTap callback: @escaping CallBackType) {
182187
tertiaryButton?.isHidden = false
183188
tertiaryButtonConfig = NUXButtonConfig(title: title, isPrimary: isPrimary, accessibilityIdentifier: accessibilityIdentifier, callback: callback)

WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ class GetStartedViewController: LoginViewController, NUXKeyboardResponder {
124124
}()
125125

126126
private var showsContinueButtonAtTheBottom: Bool {
127-
screenMode == .signInUsingSiteCredentials ||
128-
configuration.enableSocialLogin == false
127+
configuration.enableSocialLogin == false
129128
}
130129

131130
override open var sourceTag: WordPressSupportSourceTag {
@@ -811,20 +810,32 @@ private extension GetStartedViewController {
811810

812811
buttonViewController.hideShadowView()
813812

814-
// Add a "Continue" button here as the `continueButton` at the top
815-
// will not be displayed for `signInUsingSiteCredentials` screen mode.
816-
//
817-
buttonViewController.setupTopButton(title: ButtonConfiguration.Continue.title,
818-
isPrimary: true,
819-
accessibilityIdentifier: ButtonConfiguration.Continue.accessibilityIdentifier) { [weak self] in
820-
self?.handleSubmitButtonTapped()
821-
}
813+
if configuration.enableSocialLogin {
814+
configureSocialButtons()
815+
816+
// Setup Sign in with site credentials button
817+
buttonViewController.setupTertiaryButton(attributedTitle: WPStyleGuide.formattedSignInWithSiteCredentialsString(),
818+
isPrimary: false,
819+
accessibilityIdentifier: ButtonConfiguration.SignInWithSiteCredentials.accessibilityIdentifier) { [weak self] in
820+
self?.handleSiteCredentialsButtonTapped()
821+
}
822+
} else {
823+
// Add a "Continue" button here as the `continueButton` at the top will be hidden
824+
//
825+
if showsContinueButtonAtTheBottom {
826+
buttonViewController.setupTopButton(title: ButtonConfiguration.Continue.title,
827+
isPrimary: true,
828+
accessibilityIdentifier: ButtonConfiguration.Continue.accessibilityIdentifier) { [weak self] in
829+
self?.handleSubmitButtonTapped()
830+
}
831+
}
822832

823-
// Setup Sign in with site credentials button
824-
buttonViewController.setupBottomButton(attributedTitle: WPStyleGuide.formattedSignInWithSiteCredentialsString(),
825-
isPrimary: false,
826-
accessibilityIdentifier: ButtonConfiguration.SignInWithSiteCredentials.accessibilityIdentifier) { [weak self] in
827-
self?.handleSiteCredentialsButtonTapped()
833+
// Setup Sign in with site credentials button
834+
buttonViewController.setupBottomButton(attributedTitle: WPStyleGuide.formattedSignInWithSiteCredentialsString(),
835+
isPrimary: false,
836+
accessibilityIdentifier: ButtonConfiguration.SignInWithSiteCredentials.accessibilityIdentifier) { [weak self] in
837+
self?.handleSiteCredentialsButtonTapped()
838+
}
828839
}
829840
}
830841

@@ -835,12 +846,14 @@ private extension GetStartedViewController {
835846

836847
buttonViewController.hideShadowView()
837848

838-
// Add a "Continue" button here as the `continueButton` at the top will be hidden
839-
//
840-
buttonViewController.setupTopButton(title: ButtonConfiguration.Continue.title,
841-
isPrimary: true,
842-
accessibilityIdentifier: ButtonConfiguration.Continue.accessibilityIdentifier) { [weak self] in
843-
self?.handleSubmitButtonTapped()
849+
if showsContinueButtonAtTheBottom {
850+
// Add a "Continue" button here as the `continueButton` at the top will be hidden
851+
//
852+
buttonViewController.setupTopButton(title: ButtonConfiguration.Continue.title,
853+
isPrimary: true,
854+
accessibilityIdentifier: ButtonConfiguration.Continue.accessibilityIdentifier) { [weak self] in
855+
self?.handleSubmitButtonTapped()
856+
}
844857
}
845858
}
846859

0 commit comments

Comments
 (0)