diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index a17173fb2..34b42f073 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.36.0-beta.3" + s.version = "1.36.0-beta.4" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC diff --git a/WordPressAuthenticator/NUX/NUXButtonView.storyboard b/WordPressAuthenticator/NUX/NUXButtonView.storyboard index efab307ca..c36107515 100644 --- a/WordPressAuthenticator/NUX/NUXButtonView.storyboard +++ b/WordPressAuthenticator/NUX/NUXButtonView.storyboard @@ -1,9 +1,9 @@ - + - + @@ -47,7 +47,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -76,6 +76,7 @@ + @@ -86,7 +87,6 @@ - @@ -96,6 +96,8 @@ + + @@ -105,5 +107,8 @@ + + + diff --git a/WordPressAuthenticator/NUX/NUXButtonViewController.swift b/WordPressAuthenticator/NUX/NUXButtonViewController.swift index 262b246f0..86e8b090c 100644 --- a/WordPressAuthenticator/NUX/NUXButtonViewController.swift +++ b/WordPressAuthenticator/NUX/NUXButtonViewController.swift @@ -34,13 +34,23 @@ open class NUXButtonViewController: UIViewController { // MARK: - Properties - @IBOutlet private var shadowView: UIImageView? @IBOutlet var stackView: UIStackView? @IBOutlet var bottomButton: NUXButton? @IBOutlet var topButton: NUXButton? @IBOutlet var tertiaryButton: NUXButton? @IBOutlet var buttonHolder: UIView? + @IBOutlet private var shadowView: UIImageView? + @IBOutlet private var shadowViewEdgeConstraints: [NSLayoutConstraint]! + + /// Used to constrain the shadow view outside of the + /// bounds of this view controller. + weak var shadowLayoutGuide: UILayoutGuide? { + didSet { + updateShadowViewEdgeConstraints() + } + } + open weak var delegate: NUXButtonViewControllerDelegate? open var backgroundColor: UIColor? @@ -91,6 +101,23 @@ open class NUXButtonViewController: UIViewController { } } + private func updateShadowViewEdgeConstraints() { + guard let layoutGuide = shadowLayoutGuide, + let shadowView = shadowView else { + return + } + + NSLayoutConstraint.deactivate(shadowViewEdgeConstraints) + shadowView.translatesAutoresizingMaskIntoConstraints = false + + shadowViewEdgeConstraints = [ + layoutGuide.leadingAnchor.constraint(equalTo: shadowView.leadingAnchor), + layoutGuide.trailingAnchor.constraint(equalTo: shadowView.trailingAnchor), + ] + + NSLayoutConstraint.activate(shadowViewEdgeConstraints) + } + // MARK: public API /// Public method to set the button titles. diff --git a/WordPressAuthenticator/Signin/LoginPrologueViewController.swift b/WordPressAuthenticator/Signin/LoginPrologueViewController.swift index 58dd366b4..729c6f9fb 100644 --- a/WordPressAuthenticator/Signin/LoginPrologueViewController.swift +++ b/WordPressAuthenticator/Signin/LoginPrologueViewController.swift @@ -163,6 +163,8 @@ class LoginPrologueViewController: LoginViewController { } buildUnifiedPrologueButtons(buttonViewController) + + buttonViewController.shadowLayoutGuide = view.safeAreaLayoutGuide } /// Displays the old UI prologue buttons.