Skip to content

Commit

Permalink
Show social login options in site credentials login mode (#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
selanthiraiyan committed Apr 9, 2024
2 parents e8dba00 + faa401b commit c879d53
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 25 deletions.
6 changes: 4 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Nodes with values to reuse in the pipeline.
common_params:
plugins: &common_plugins
- automattic/a8c-ci-toolkit#3.1.0
- automattic/a8c-ci-toolkit#3.2.2
env: &common_env
IMAGE_ID: xcode-15.0.1

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

Expand Down
2 changes: 1 addition & 1 deletion .buildkite/publish-pod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ echo "--- :rubygems: Setting up Gems"
install_gems

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

echo "--- :cocoapods: Publishing Pod to WP Specs Repo"
publish_private_pod --patch-cocoapods $PODSPEC_PATH $SPECS_REPO "$SPEC_REPO_PUBLIC_DEPLOY_KEY"
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ _None._

### Breaking Changes

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

### New Features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ open class NUXButtonViewController: UIViewController {
bottomButtonConfig = buttonConfigFor(socialService: socialService, onTap: callback)
}

func setupTertiaryButton(attributedTitle: NSAttributedString, isPrimary: Bool = false, accessibilityIdentifier: String? = nil, onTap callback: @escaping CallBackType) {
tertiaryButton?.isHidden = false
tertiaryButtonConfig = NUXButtonConfig(attributedTitle: attributedTitle, isPrimary: isPrimary, accessibilityIdentifier: accessibilityIdentifier, callback: callback)
}

func setupTertiaryButton(title: String, isPrimary: Bool = false, accessibilityIdentifier: String? = nil, onTap callback: @escaping CallBackType) {
tertiaryButton?.isHidden = false
tertiaryButtonConfig = NUXButtonConfig(title: title, isPrimary: isPrimary, accessibilityIdentifier: accessibilityIdentifier, callback: callback)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ class GetStartedViewController: LoginViewController, NUXKeyboardResponder {
}()

private var showsContinueButtonAtTheBottom: Bool {
screenMode == .signInUsingSiteCredentials ||
configuration.enableSocialLogin == false
configuration.enableSocialLogin == false
}

override open var sourceTag: WordPressSupportSourceTag {
Expand Down Expand Up @@ -811,20 +810,32 @@ private extension GetStartedViewController {

buttonViewController.hideShadowView()

// Add a "Continue" button here as the `continueButton` at the top
// will not be displayed for `signInUsingSiteCredentials` screen mode.
//
buttonViewController.setupTopButton(title: ButtonConfiguration.Continue.title,
isPrimary: true,
accessibilityIdentifier: ButtonConfiguration.Continue.accessibilityIdentifier) { [weak self] in
self?.handleSubmitButtonTapped()
}
if configuration.enableSocialLogin {
configureSocialButtons()

// Setup Sign in with site credentials button
buttonViewController.setupTertiaryButton(attributedTitle: WPStyleGuide.formattedSignInWithSiteCredentialsString(),
isPrimary: false,
accessibilityIdentifier: ButtonConfiguration.SignInWithSiteCredentials.accessibilityIdentifier) { [weak self] in
self?.handleSiteCredentialsButtonTapped()
}
} else {
// Add a "Continue" button here as the `continueButton` at the top will be hidden
//
if showsContinueButtonAtTheBottom {
buttonViewController.setupTopButton(title: ButtonConfiguration.Continue.title,
isPrimary: true,
accessibilityIdentifier: ButtonConfiguration.Continue.accessibilityIdentifier) { [weak self] in
self?.handleSubmitButtonTapped()
}
}

// Setup Sign in with site credentials button
buttonViewController.setupBottomButton(attributedTitle: WPStyleGuide.formattedSignInWithSiteCredentialsString(),
isPrimary: false,
accessibilityIdentifier: ButtonConfiguration.SignInWithSiteCredentials.accessibilityIdentifier) { [weak self] in
self?.handleSiteCredentialsButtonTapped()
// Setup Sign in with site credentials button
buttonViewController.setupBottomButton(attributedTitle: WPStyleGuide.formattedSignInWithSiteCredentialsString(),
isPrimary: false,
accessibilityIdentifier: ButtonConfiguration.SignInWithSiteCredentials.accessibilityIdentifier) { [weak self] in
self?.handleSiteCredentialsButtonTapped()
}
}
}

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

buttonViewController.hideShadowView()

// Add a "Continue" button here as the `continueButton` at the top will be hidden
//
buttonViewController.setupTopButton(title: ButtonConfiguration.Continue.title,
isPrimary: true,
accessibilityIdentifier: ButtonConfiguration.Continue.accessibilityIdentifier) { [weak self] in
self?.handleSubmitButtonTapped()
if showsContinueButtonAtTheBottom {
// Add a "Continue" button here as the `continueButton` at the top will be hidden
//
buttonViewController.setupTopButton(title: ButtonConfiguration.Continue.title,
isPrimary: true,
accessibilityIdentifier: ButtonConfiguration.Continue.accessibilityIdentifier) { [weak self] in
self?.handleSubmitButtonTapped()
}
}
}

Expand Down

0 comments on commit c879d53

Please sign in to comment.