Skip to content

Commit f595ad1

Browse files
authored
[Jetpack Content Migration] Notification and Success screens UI Tweaks (#19632)
1 parent 217c54d commit f595ad1

File tree

5 files changed

+49
-5
lines changed

5 files changed

+49
-5
lines changed

WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/All done/MigrationDoneViewController.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,14 @@ class MigrationDoneViewController: UIViewController {
2222
actionsView: MigrationActionsView(configuration: viewModel.configuration.actionsConfiguration),
2323
centerView: centerView)
2424
}
25+
26+
override func viewWillAppear(_ animated: Bool) {
27+
super.viewWillAppear(animated)
28+
self.navigationController?.setNavigationBarHidden(true, animated: animated)
29+
}
30+
31+
override func viewWillDisappear(_ animated: Bool) {
32+
super.viewWillDisappear(animated)
33+
self.navigationController?.setNavigationBarHidden(false, animated: animated)
34+
}
2535
}

WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Views/MigrationActionsView.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ final class MigrationActionsView: UIView {
102102

103103
private static func secondaryButton() -> UIButton {
104104
let button = UIButton()
105-
let font = WPStyleGuide.fontForTextStyle(.headline)
106-
button.setTitleColor(.text, for: .normal)
105+
let font = Constants.secondaryButtonFont
106+
let color = Constants.secondaryButtonColor
107+
button.setTitleColor(color, for: .normal)
107108
button.titleLabel?.font = font
108109
button.titleLabel?.adjustsFontForContentSizeCategory = true
109110
return button
@@ -121,5 +122,7 @@ final class MigrationActionsView: UIView {
121122
static let separatorHeight = CGFloat(0.5)
122123
static let insets = NSDirectionalEdgeInsets(top: 20, leading: 30, bottom: 20, trailing: 30)
123124
static let spacing = CGFloat(10)
125+
static let secondaryButtonFont = WPStyleGuide.fontForTextStyle(.headline, fontWeight: .regular)
126+
static let secondaryButtonColor = UIColor.muriel(color: .jetpackGreen, .shade50)
124127
}
125128
}

WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Views/MigrationCenterView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ class MigrationCenterView: UIView {
1313
if let configuration {
1414
label.attributedText = configuration.attributedText
1515
}
16+
label.textAlignment = .center
1617
label.textColor = Appearance.descriptionTextColor
1718
label.numberOfLines = 0
19+
label.adjustsFontForContentSizeCategory = true
1820
return label
1921
}()
2022

WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Views/MigrationStepView.swift

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ class MigrationStepView: UIView {
5454
private func activateConstraints() {
5555
centerContentView.pinSubviewToAllEdges(centerView, insets: Constants.centerContentMargins)
5656
contentView.pinSubviewToAllEdges(mainStackView)
57-
pinSubviewToAllEdges(mainScrollView)
57+
58+
NSLayoutConstraint.activate([
59+
mainScrollView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor),
60+
mainScrollView.leadingAnchor.constraint(equalTo: leadingAnchor),
61+
mainScrollView.trailingAnchor.constraint(equalTo: trailingAnchor),
62+
mainScrollView.bottomAnchor.constraint(equalTo: bottomAnchor),
63+
])
64+
5865
mainScrollView.pinSubviewToAllEdges(contentView)
5966

6067
NSLayoutConstraint.activate([
@@ -71,13 +78,24 @@ class MigrationStepView: UIView {
7178

7279
override func layoutSubviews() {
7380
super.layoutSubviews()
74-
mainScrollView.contentInset.bottom = actionsView.frame.size.height + Constants.bottomMargin
81+
let bottomInset = actionsView.frame.size.height - safeAreaInsets.bottom
82+
mainScrollView.contentInset.bottom = bottomInset + Constants.additionalBottomContentInset
83+
mainScrollView.verticalScrollIndicatorInsets.bottom = bottomInset
84+
mainScrollView.contentInset.top = Constants.topContentInset
7585
}
7686

7787
private enum Constants {
88+
/// Adds space between the content bottom edge and actions sheet top edge.
89+
///
90+
/// Bottom inset is added to the `scrollView` so the content is not covered by the Actions Sheet view.
91+
/// The value of the bottom inset is computed in `layoutSubviews`.
92+
static let additionalBottomContentInset: CGFloat = 10
93+
94+
/// Adds top padding to the `scrollView`.
95+
static let topContentInset: CGFloat = UINavigationBar().intrinsicContentSize.height
96+
7897
static let centerContentMargins = UIEdgeInsets(top: 0, left: 30, bottom: 0, right: 30)
7998
static let stackViewSpacing: CGFloat = 20
80-
static let bottomMargin: CGFloat = 20
8199
static let headerViewMargins = NSDirectionalEdgeInsets(top: 0, leading: 30, bottom: 0, trailing: 30)
82100
}
83101
}

WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Notifications Permission/MigrationNotificationsViewController.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,16 @@ class MigrationNotificationsViewController: UIViewController {
2121
view = MigrationStepView(headerView: MigrationHeaderView(configuration: viewModel.configuration.headerConfiguration),
2222
actionsView: MigrationActionsView(configuration: viewModel.configuration.actionsConfiguration),
2323
centerView: centerView)
24+
25+
}
26+
27+
override func viewWillAppear(_ animated: Bool) {
28+
super.viewWillAppear(animated)
29+
self.navigationController?.setNavigationBarHidden(true, animated: animated)
30+
}
31+
32+
override func viewWillDisappear(_ animated: Bool) {
33+
super.viewWillDisappear(animated)
34+
self.navigationController?.setNavigationBarHidden(false, animated: animated)
2435
}
2536
}

0 commit comments

Comments
 (0)