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
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ public struct WordPressAuthenticatorUnifiedStyle {
/// Style: Auth Prologue buttons background color
public let prologueButtonsBackgroundColor: UIColor

/// Style: Auth Prologue view background color
public let prologueViewBackgroundColor: UIColor

/// Style: Status bar style. Defaults to `default`.
///
public let statusBarStyle: UIStatusBarStyle
Expand All @@ -216,6 +219,7 @@ public struct WordPressAuthenticatorUnifiedStyle {
textButtonHighlightColor: UIColor,
viewControllerBackgroundColor: UIColor,
prologueButtonsBackgroundColor: UIColor = .clear,
prologueViewBackgroundColor: UIColor? = nil,
statusBarStyle: UIStatusBarStyle = .default,
navBarBackgroundColor: UIColor,
navButtonTextColor: UIColor,
Expand All @@ -228,6 +232,7 @@ public struct WordPressAuthenticatorUnifiedStyle {
self.textButtonHighlightColor = textButtonHighlightColor
self.viewControllerBackgroundColor = viewControllerBackgroundColor
self.prologueButtonsBackgroundColor = prologueButtonsBackgroundColor
self.prologueViewBackgroundColor = prologueViewBackgroundColor ?? viewControllerBackgroundColor
self.statusBarStyle = statusBarStyle
self.navBarBackgroundColor = navBarBackgroundColor
self.navButtonTextColor = navButtonTextColor
Expand Down
18 changes: 15 additions & 3 deletions WordPressAuthenticator/Signin/LoginPrologueViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,21 @@ class LoginPrologueViewController: LoginViewController {

private func setButtonViewControllerBackground(_ buttonViewController: NUXButtonViewController) {
// Fallback to setting the button background color to clear so the blur effect blurs the Prologue background color.
let backgroundColor = WordPressAuthenticator.shared.unifiedStyle?.prologueButtonsBackgroundColor ?? .clear
buttonViewController.backgroundColor = backgroundColor
buttonBlurEffectView.effect = UIBlurEffect(style: blurEffect)
let buttonsBackgroundColor = WordPressAuthenticator.shared.unifiedStyle?.prologueButtonsBackgroundColor ?? .clear
buttonViewController.backgroundColor = buttonsBackgroundColor

/// If host apps provide a background color for the prologue buttons:
/// 1. Hide the blur effect
/// 2. Set the background color of the view controller to prologueViewBackgroundColor
let prologueViewBackgroundColor = WordPressAuthenticator.shared.unifiedStyle?.prologueViewBackgroundColor ?? .clear

guard prologueViewBackgroundColor == buttonsBackgroundColor else {
buttonBlurEffectView.effect = UIBlurEffect(style: blurEffect)
return
}

buttonBlurEffectView.isHidden = true
view.backgroundColor = prologueViewBackgroundColor
}

// MARK: - Actions
Expand Down