Skip to content

Commit 4a75ed8

Browse files
committed
Embed footer in scroll view instead of capping font
1 parent de16552 commit 4a75ed8

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

WooCommerce/Classes/ViewRelated/Blaze/ConfirmPayment/BlazeConfirmPaymentView.swift

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ struct BlazeConfirmPaymentView: View {
77
@ScaledMetric private var scale: CGFloat = 1.0
88
@ObservedObject private var viewModel: BlazeConfirmPaymentViewModel
99
@Environment(\.dismiss) private var dismiss
10+
@Environment(\.sizeCategory) private var sizeCategory
1011

1112
@State private var externalURL: URL?
1213
@State private var showingAddPaymentWebView: Bool = false
@@ -19,19 +20,9 @@ struct BlazeConfirmPaymentView: View {
1920
let paragraph = NSMutableParagraphStyle()
2021
paragraph.alignment = .center
2122

22-
// Cap the font size to prevent the footer from becoming too large
23-
let baseFont = UIFont.preferredFont(forTextStyle: .caption1)
24-
let cappedFont = baseFont.pointSize > Layout.maxAgreementTextFontSize ?
25-
UIFont.preferredFont(
26-
forTextStyle: .caption1,
27-
compatibleWith: UITraitCollection(
28-
preferredContentSizeCategory: .accessibilityMedium
29-
)
30-
) : baseFont
31-
3223
let mutableAttributedText = NSMutableAttributedString(
3324
string: content,
34-
attributes: [.font: cappedFont,
25+
attributes: [.font: UIFont.caption1,
3526
.foregroundColor: UIColor.secondaryLabel,
3627
.paragraphStyle: paragraph]
3728
)
@@ -72,7 +63,11 @@ struct BlazeConfirmPaymentView: View {
7263
.padding(.horizontal, Layout.contentPadding)
7364
}
7465

75-
Divider()
66+
if sizeCategory.isAccessibilityCategory {
67+
footerView
68+
} else {
69+
Divider()
70+
}
7671
}
7772
.padding(.vertical, Layout.contentPadding)
7873
}
@@ -86,7 +81,9 @@ struct BlazeConfirmPaymentView: View {
8681
}
8782
}
8883
.safeAreaInset(edge: .bottom) {
89-
footerView
84+
if !sizeCategory.isAccessibilityCategory {
85+
footerView
86+
}
9087
}
9188
.task {
9289
await viewModel.updatePaymentInfo()
@@ -262,7 +259,6 @@ private extension BlazeConfirmPaymentView {
262259
enum Layout {
263260
static let contentPadding: CGFloat = 16
264261
static let cardIconWidth: CGFloat = 35
265-
static let maxAgreementTextFontSize: CGFloat = 20
266262
}
267263

268264
enum Constants {

0 commit comments

Comments
 (0)