Skip to content

Commit e4a3275

Browse files
authored
[Woo POS] Improve Checkout view adaptability to large font sizes (#15153)
2 parents 1b54847 + 800dfb6 commit e4a3275

13 files changed

+69
-36
lines changed

WooCommerce/Classes/POS/Presentation/CardReaderConnection/CardReaderConnectionStatusView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ struct CardReaderConnectionStatusView: View {
5858
}
5959
}
6060
}
61-
.font(Constants.font, maximumContentSizeCategory: .accessibilityLarge)
61+
.font(Constants.font)
62+
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
6263
.opacity(isEnabled ? 1 : 0.5)
6364
}
6465
}

WooCommerce/Classes/POS/Presentation/CardReaderConnection/UI States/Reader Messages/PointOfSaleCardPresentPaymentActivityIndicatingMessageView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ struct PointOfSaleCardPresentPaymentActivityIndicatingMessageView: View {
44
let title: String
55
let message: String
66
let animation: POSCardPresentPaymentInLineMessageAnimation
7+
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
78

89
var body: some View {
910
VStack(alignment: .center, spacing: PointOfSaleCardPresentPaymentLayout.headerSpacing) {
@@ -12,6 +13,7 @@ struct PointOfSaleCardPresentPaymentActivityIndicatingMessageView: View {
1213
.frame(width: PointOfSaleCardPresentPaymentLayout.headerSize.width,
1314
height: PointOfSaleCardPresentPaymentLayout.headerSize.height)
1415
.matchedGeometryEffect(id: animation.iconTransitionId, in: animation.namespace, properties: .position)
16+
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
1517
VStack(alignment: .center, spacing: PointOfSaleCardPresentPaymentLayout.smallTextSpacing) {
1618
Text(title)
1719
.foregroundStyle(Color(.neutral(.shade40)))

WooCommerce/Classes/POS/Presentation/CardReaderConnection/UI States/Reader Messages/PointOfSaleCardPresentPaymentDisplayReaderMessageMessageView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import SwiftUI
33
struct PointOfSaleCardPresentPaymentDisplayReaderMessageMessageView: View {
44
let viewModel: PointOfSaleCardPresentPaymentDisplayReaderMessageMessageViewModel
55
let animation: POSCardPresentPaymentInLineMessageAnimation
6+
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
67

78
var body: some View {
89
VStack(alignment: .center, spacing: Layout.headerSpacing) {
910
ProgressView()
1011
.progressViewStyle(CardWaveProgressViewStyle())
1112
.matchedGeometryEffect(id: animation.iconTransitionId, in: animation.namespace, properties: .position)
1213
.accessibilityHidden(true)
14+
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
1315

1416
VStack(alignment: .center, spacing: Layout.textSpacing) {
1517
Text(viewModel.title)

WooCommerce/Classes/POS/Presentation/CardReaderConnection/UI States/Reader Messages/PointOfSaleCardPresentPaymentProcessingMessageView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ import SwiftUI
33
struct PointOfSaleCardPresentPaymentProcessingMessageView: View {
44
let viewModel: PointOfSaleCardPresentPaymentProcessingMessageViewModel
55
let animation: POSCardPresentPaymentInLineMessageAnimation
6+
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
67

78
var body: some View {
89
VStack(alignment: .center, spacing: Layout.headerSpacing) {
910
ProgressView()
1011
.progressViewStyle(CardWaveProgressViewStyle())
1112
.matchedGeometryEffect(id: animation.iconTransitionId, in: animation.namespace, properties: .position)
13+
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
1214

1315
VStack(alignment: .center, spacing: Layout.textSpacing) {
1416
Text(viewModel.title)

WooCommerce/Classes/POS/Presentation/CardReaderConnection/UI States/Reader Messages/PointOfSaleCardPresentPaymentTapSwipeInsertCardMessageView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import SwiftUI
33
struct PointOfSaleCardPresentPaymentTapSwipeInsertCardMessageView: View {
44
let viewModel: PointOfSaleCardPresentPaymentTapSwipeInsertCardMessageViewModel
55
let animation: POSCardPresentPaymentInLineMessageAnimation
6+
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
67

78
var body: some View {
89
VStack(alignment: .center, spacing: PointOfSaleCardPresentPaymentLayout.headerSpacing) {
@@ -12,6 +13,7 @@ struct PointOfSaleCardPresentPaymentTapSwipeInsertCardMessageView: View {
1213
.frame(width: PointOfSaleCardPresentPaymentLayout.headerSize.width,
1314
height: PointOfSaleCardPresentPaymentLayout.headerSize.height)
1415
.matchedGeometryEffect(id: animation.iconTransitionId, in: animation.namespace, properties: .position)
16+
.renderedIf(!dynamicTypeSize.isAccessibilitySize)
1517
VStack(alignment: .center, spacing: PointOfSaleCardPresentPaymentLayout.smallTextSpacing) {
1618
Text(viewModel.title)
1719
.foregroundStyle(Color.posOnSurface)

WooCommerce/Classes/POS/Presentation/CartView.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ struct CartView: View {
2727
HStack {
2828
Text(Localization.cartTitle)
2929
.font(Constants.primaryFont)
30+
.lineLimit(1)
31+
.minimumScaleFactor(0.5)
32+
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
3033
.foregroundColor(.posOnSurface)
3134
.accessibilityAddTraits(.isHeader)
3235

@@ -35,6 +38,9 @@ struct CartView: View {
3538
if let itemsInCartLabel = viewHelper.itemsInCartLabel(for: posModel.cart.count) {
3639
Text(itemsInCartLabel)
3740
.font(Constants.itemsFont)
41+
.lineLimit(1)
42+
.minimumScaleFactor(0.5)
43+
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
3844
.foregroundColor(Color.posOnSurfaceVariantLowest)
3945
}
4046
}
@@ -258,7 +264,8 @@ private extension CartView {
258264
posModel.addMoreToCart()
259265
} label: {
260266
Image(systemName: Constants.backButtonSymbol)
261-
.font(.posBodyLargeBold, maximumContentSizeCategory: .accessibilityLarge)
267+
.font(.posBodyLargeBold)
268+
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
262269
.foregroundColor(.posOnSurface)
263270
}
264271
}

WooCommerce/Classes/POS/Presentation/Item Selector/ChildItemList.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ private extension ChildItemList {
5050
dismiss()
5151
} label: {
5252
Image(systemName: "chevron.backward")
53-
.font(.posBodyLargeBold, maximumContentSizeCategory: .accessibilityLarge)
53+
.font(.posBodyLargeBold)
54+
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
5455
.foregroundColor(.posOnSurface)
5556
}
5657
POSHeaderTitleView(title: title)

WooCommerce/Classes/POS/Presentation/ItemListView.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,9 @@ private extension ItemListView {
122122
.padding(.bottom, Constants.bannerCardPadding)
123123
}
124124

125-
private var bannerHintAndLearnMoreText: Text {
126-
Text(headerBannerHint + " ") +
127-
Text(Localization.headerBannerLearnMoreHint)
128-
.font(POSFontStyle.posBodySmallBold.font())
125+
private var bannerHintAndLearnMoreText: some View {
126+
Text("\(headerBannerHint) \(Localization.headerBannerLearnMoreHint)")
127+
.font(.posBodySmallBold)
129128
.foregroundColor(Color(.posPrimary))
130129
}
131130

WooCommerce/Classes/POS/Presentation/POSFloatingControlView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ struct POSFloatingControlView: View {
5050
VStack {
5151
Spacer()
5252
Image(systemName: "ellipsis")
53-
.font(.posBodyLargeBold, maximumContentSizeCategory: .accessibilityLarge)
53+
.font(.posBodyLargeBold)
54+
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
5455
.foregroundStyle(fontColor)
5556
Spacer()
5657
}

WooCommerce/Classes/POS/Presentation/PointOfSaleCollectCashView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ private extension PointOfSaleCollectCashView {
104104
var navigationHeader: some View {
105105
HStack(alignment: .top) {
106106
Image(systemName: "chevron.backward")
107-
.font(.posBodyLargeBold, maximumContentSizeCategory: .accessibilityLarge)
107+
.font(.posBodyLargeBold)
108+
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
108109
DynamicVStack(horizontalAlignment: .leading, spacing: Constants.navigationButtonSpacing) {
109110
Text(Localization.backNavigationTitle)
110111
.font(.posHeading)

0 commit comments

Comments
 (0)