diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift index 070ca00bb..3deb540aa 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift @@ -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 @@ -216,6 +219,7 @@ public struct WordPressAuthenticatorUnifiedStyle { textButtonHighlightColor: UIColor, viewControllerBackgroundColor: UIColor, prologueButtonsBackgroundColor: UIColor = .clear, + prologueViewBackgroundColor: UIColor? = nil, statusBarStyle: UIStatusBarStyle = .default, navBarBackgroundColor: UIColor, navButtonTextColor: UIColor, @@ -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 diff --git a/WordPressAuthenticator/Signin/LoginPrologueViewController.swift b/WordPressAuthenticator/Signin/LoginPrologueViewController.swift index 3ed942e0b..81e9fa245 100644 --- a/WordPressAuthenticator/Signin/LoginPrologueViewController.swift +++ b/WordPressAuthenticator/Signin/LoginPrologueViewController.swift @@ -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