@@ -12,11 +12,6 @@ class LoginPrologueViewController: LoginViewController {
1212 var showCancel = false
1313
1414 @IBOutlet private weak var buttonContainerView : UIView !
15- /// Blur effect on button container view
16- ///
17- private var blurEffect : UIBlurEffect . Style {
18- return . systemChromeMaterial
19- }
2015
2116 /// Constraints on the button view container.
2217 /// Used to adjust the button width in unified views.
@@ -65,12 +60,10 @@ class LoginPrologueViewController: LoginViewController {
6560 topContainerView. pinSubviewToAllEdges ( topContainerChildViewController. view)
6661 }
6762
63+ setupViewBackground ( )
6864 createButtonViewController ( )
6965
7066 defaultButtonViewMargin = buttonViewLeadingConstraint? . constant ?? 0
71- if let backgroundImage = WordPressAuthenticator . shared. unifiedStyle? . prologueBackgroundImage {
72- view. layer. contents = backgroundImage. cgImage
73- }
7467 }
7568
7669 override func styleBackground( ) {
@@ -265,6 +258,7 @@ class LoginPrologueViewController: LoginViewController {
265258
266259 let primaryButtonStyle = WordPressAuthenticator . shared. style. prologuePrimaryButtonStyle
267260 let secondaryButtonStyle = WordPressAuthenticator . shared. style. prologueSecondaryButtonStyle
261+ let tertiaryButtonStyle = WordPressAuthenticator . shared. style. prologueTertiaryButtonStyle ?? NUXButtonStyle . linkButtonStyle
268262
269263 setButtonViewMargins ( forWidth: view. frame. width)
270264 let displayStrings = WordPressAuthenticator . shared. displayStrings
@@ -323,7 +317,7 @@ class LoginPrologueViewController: LoginViewController {
323317 isPrimary: false ,
324318 configureBodyFontForTitle: true ,
325319 accessibilityIdentifier: " Prologue Site Creation Guide button " ,
326- style: NUXButtonStyle . linkButtonStyle ,
320+ style: tertiaryButtonStyle ,
327321 onTap: siteCreationGuideCallback ( ) )
328322 } ( )
329323
@@ -385,26 +379,27 @@ class LoginPrologueViewController: LoginViewController {
385379 }
386380 }
387381
382+ private func setupViewBackground( ) {
383+ if let prologueViewBackgroundColor = WordPressAuthenticator . shared. unifiedStyle? . prologueViewBackgroundColor {
384+ view. backgroundColor = prologueViewBackgroundColor
385+ }
386+
387+ if let backgroundImage = WordPressAuthenticator . shared. unifiedStyle? . prologueBackgroundImage {
388+ let backgroundImageView = UIImageView ( image: backgroundImage)
389+ backgroundImageView. contentMode = WordPressAuthenticator . shared. unifiedStyle? . prologueBackgroundScaleMode ?? . scaleAspectFill
390+ backgroundImageView. translatesAutoresizingMaskIntoConstraints = false
391+ view. insertSubview ( backgroundImageView, at: 0 )
392+ view. pinSubviewToAllEdges ( backgroundImageView)
393+ }
394+ }
395+
388396 private func setButtonViewControllerBackground( ) {
389397 // Fallback to setting the button background color to clear so the blur effect blurs the Prologue background color.
390398 let buttonsBackgroundColor = WordPressAuthenticator . shared. unifiedStyle? . prologueButtonsBackgroundColor ?? . clear
391399 buttonViewController? . backgroundColor = buttonsBackgroundColor
392400 buttonBackgroundView? . backgroundColor = buttonsBackgroundColor
393401 stackedButtonsViewController? . backgroundColor = buttonsBackgroundColor
394402
395- /// If host apps provide a background color for the prologue buttons:
396- /// 1. Hide the blur effect
397- /// 2. Set the background color of the view controller to prologueViewBackgroundColor
398- let prologueViewBackgroundColor = WordPressAuthenticator . shared. unifiedStyle? . prologueViewBackgroundColor ?? . clear
399-
400- guard prologueViewBackgroundColor. cgColor == buttonsBackgroundColor. cgColor else {
401- buttonBlurEffectView. effect = UIBlurEffect ( style: blurEffect)
402- return
403- }
404- // do not set background color if we've set a background image earlier
405- if WordPressAuthenticator . shared. unifiedStyle? . prologueBackgroundImage == nil {
406- view. backgroundColor = prologueViewBackgroundColor
407- }
408403 // if a blur effect for the buttons was passed, use it; otherwise hide the view.
409404 guard let blurEffect = WordPressAuthenticator . shared. unifiedStyle? . prologueButtonsBlurEffect else {
410405 buttonBlurEffectView. isHidden = true
0 commit comments