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

Commit e300101

Browse files
authored
Merge pull request #676 from wordpress-mobile/task/jetpack-landing-screen-blur-effect
Add properties for prologue background image and prologue buttons blur effect
2 parents c3262a9 + 87d223e commit e300101

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

WordPressAuthenticator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Pod::Spec.new do |s|
44
s.name = 'WordPressAuthenticator'
5-
s.version = '3.2.0-beta.1'
5+
s.version = '3.2.0-beta.2'
66

77
s.summary = 'WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps.'
88
s.description = <<-DESC

WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,17 @@ public struct WordPressAuthenticatorStyle {
8484
///
8585
public let prologueBackgroundColor: UIColor
8686

87+
/// Style: optional prologue background image
88+
///
89+
public let prologueBackgroundImage: UIImage?
90+
8791
/// Style: prologue background colors
8892
///
8993
public let prologueTitleColor: UIColor
9094

95+
/// Style: optional prologue buttons blur effect
96+
public let prologueButtonsBlurEffect: UIBlurEffect?
97+
9198
/// Style: primary button on the prologue view (continue)
9299
/// When `nil` it will use the primary styles defined here
93100
/// Defaults to `nil`
@@ -139,7 +146,9 @@ public struct WordPressAuthenticatorStyle {
139146
navBarBackgroundColor: UIColor,
140147
navButtonTextColor: UIColor = .white,
141148
prologueBackgroundColor: UIColor = WPStyleGuide.wordPressBlue(),
149+
prologueBackgroundImage: UIImage? = nil,
142150
prologueTitleColor: UIColor = .white,
151+
prologueButtonsBlurEffect: UIBlurEffect? = nil,
143152
prologuePrimaryButtonStyle: NUXButtonStyle? = nil,
144153
prologueSecondaryButtonStyle: NUXButtonStyle? = nil,
145154
prologueTopContainerChildViewController: @autoclosure @escaping () -> UIViewController? = nil,
@@ -172,7 +181,9 @@ public struct WordPressAuthenticatorStyle {
172181
self.navBarBackgroundColor = navBarBackgroundColor
173182
self.navButtonTextColor = navButtonTextColor
174183
self.prologueBackgroundColor = prologueBackgroundColor
184+
self.prologueBackgroundImage = prologueBackgroundImage
175185
self.prologueTitleColor = prologueTitleColor
186+
self.prologueButtonsBlurEffect = prologueButtonsBlurEffect
176187
self.prologuePrimaryButtonStyle = prologuePrimaryButtonStyle
177188
self.prologueSecondaryButtonStyle = prologueSecondaryButtonStyle
178189
self.prologueTopContainerChildViewController = prologueTopContainerChildViewController
@@ -220,6 +231,12 @@ public struct WordPressAuthenticatorUnifiedStyle {
220231
/// Style: Auth Prologue view background color
221232
public let prologueViewBackgroundColor: UIColor
222233

234+
/// Style: optional auth Prologue view background image
235+
public let prologueBackgroundImage: UIImage?
236+
237+
/// Style: optional blur effect for the buttons view
238+
public let prologueButtonsBlurEffect: UIBlurEffect?
239+
223240
/// Style: Status bar style. Defaults to `default`.
224241
///
225242
public let statusBarStyle: UIStatusBarStyle
@@ -245,6 +262,8 @@ public struct WordPressAuthenticatorUnifiedStyle {
245262
viewControllerBackgroundColor: UIColor,
246263
prologueButtonsBackgroundColor: UIColor = .clear,
247264
prologueViewBackgroundColor: UIColor? = nil,
265+
prologueBackgroundImage: UIImage? = nil,
266+
prologueButtonsBlurEffect: UIBlurEffect? = nil,
248267
statusBarStyle: UIStatusBarStyle = .default,
249268
navBarBackgroundColor: UIColor,
250269
navButtonTextColor: UIColor,
@@ -259,6 +278,8 @@ public struct WordPressAuthenticatorUnifiedStyle {
259278
self.viewControllerBackgroundColor = viewControllerBackgroundColor
260279
self.prologueButtonsBackgroundColor = prologueButtonsBackgroundColor
261280
self.prologueViewBackgroundColor = prologueViewBackgroundColor ?? viewControllerBackgroundColor
281+
self.prologueBackgroundImage = prologueBackgroundImage
282+
self.prologueButtonsBlurEffect = prologueButtonsBlurEffect
262283
self.statusBarStyle = statusBarStyle
263284
self.navBarBackgroundColor = navBarBackgroundColor
264285
self.navButtonTextColor = navButtonTextColor

WordPressAuthenticator/Signin/LoginPrologueViewController.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class LoginPrologueViewController: LoginViewController {
5555
}
5656

5757
defaultButtonViewMargin = buttonViewLeadingConstraint?.constant ?? 0
58+
if let backgroundImage = WordPressAuthenticator.shared.unifiedStyle?.prologueBackgroundImage {
59+
view.layer.contents = backgroundImage.cgImage
60+
}
5861
}
5962

6063
override func styleBackground() {
@@ -276,9 +279,16 @@ class LoginPrologueViewController: LoginViewController {
276279
buttonBlurEffectView.effect = UIBlurEffect(style: blurEffect)
277280
return
278281
}
279-
280-
buttonBlurEffectView.isHidden = true
281-
view.backgroundColor = prologueViewBackgroundColor
282+
// do not set background color if we've set a background image earlier
283+
if WordPressAuthenticator.shared.unifiedStyle?.prologueBackgroundImage == nil {
284+
view.backgroundColor = prologueViewBackgroundColor
285+
}
286+
// if a blur effect for the buttons was passed, use it; otherwise hide the view.
287+
guard let blurEffect = WordPressAuthenticator.shared.unifiedStyle?.prologueButtonsBlurEffect else {
288+
buttonBlurEffectView.isHidden = true
289+
return
290+
}
291+
buttonBlurEffectView.effect = blurEffect
282292
}
283293

284294
// MARK: - Actions

0 commit comments

Comments
 (0)