@@ -20,6 +20,7 @@ struct WooShippingEditAddressView: View {
2020 @State private var previousFocusedField : WooShippingAddressFieldType ?
2121
2222 @Environment ( \. dismiss) private var dismiss
23+ @Environment ( \. sizeCategory) private var sizeCategory
2324
2425 @State private var isPresentingCountrySelector : Bool = false
2526 @State private var isPresentingStateSelector : Bool = false
@@ -77,6 +78,10 @@ struct WooShippingEditAddressView: View {
7778 . font ( . subheadline)
7879 . tint ( Color ( . accent) )
7980 }
81+
82+ if sizeCategory. isAccessibilityCategory {
83+ ctaFooter ( isScrollViewEmbedded: true )
84+ }
8085 }
8186 . padding ( )
8287 . onChange ( of: focusedField) { newField in
@@ -147,33 +152,9 @@ struct WooShippingEditAddressView: View {
147152 }
148153 }
149154 . safeAreaInset ( edge: . bottom) {
150- VStack ( spacing: . zero) {
151- Divider ( ) . ignoresSafeArea ( edges: [ . horizontal] )
152- VStack ( spacing: Constants . verticalSpacing) {
153- HStack {
154- Image ( systemName: viewModel. status == . verified ? " checkmark.circle " : " exclamationmark.circle " )
155- Text ( viewModel. statusLabel)
156- }
157- . font ( . subheadline)
158- . foregroundStyle ( viewModel. status == . verified ? Constants . green : Constants . red)
159- Button ( Localization . Button. label ( for: viewModel. status) ) {
160- switch viewModel. status {
161- case . verified:
162- dismiss ( )
163- case . unverified:
164- Task { @MainActor in
165- await viewModel. remotelyValidateAddress ( )
166- }
167- case . missingInformation:
168- break
169- }
170- }
171- . buttonStyle ( PrimaryLoadingButtonStyle ( isLoading: viewModel. isLoading) )
172- . disabled ( viewModel. status == . missingInformation)
173- }
174- . padding ( )
155+ if !sizeCategory. isAccessibilityCategory {
156+ ctaFooter ( isScrollViewEmbedded: false )
175157 }
176- . background ( Color ( uiColor: . systemBackground) )
177158 }
178159 . sheet ( item: $viewModel. normalizeAddressVM) { viewModel in
179160 NavigationStack {
@@ -206,6 +187,44 @@ struct WooShippingEditAddressView: View {
206187 )
207188 }
208189
190+ private func ctaFooter( isScrollViewEmbedded: Bool ) -> some View {
191+ VStack ( spacing: . zero) {
192+ Divider ( )
193+ . ignoresSafeArea ( edges: [ . horizontal] )
194+ . padding (
195+ /// When embedded in scroll view
196+ /// we use a negative value to neglect the parent padding for the divider
197+ isScrollViewEmbedded ? . horizontal : [ ] ,
198+ - Constants. defaultPadding
199+ )
200+
201+ VStack ( spacing: Constants . verticalSpacing) {
202+ HStack {
203+ Image ( systemName: viewModel. status == . verified ? " checkmark.circle " : " exclamationmark.circle " )
204+ Text ( viewModel. statusLabel)
205+ }
206+ . font ( . subheadline)
207+ . foregroundStyle ( viewModel. status == . verified ? Constants . green : Constants . red)
208+ Button ( Localization . Button. label ( for: viewModel. status) ) {
209+ switch viewModel. status {
210+ case . verified:
211+ dismiss ( )
212+ case . unverified:
213+ Task { @MainActor in
214+ await viewModel. remotelyValidateAddress ( )
215+ }
216+ case . missingInformation:
217+ break
218+ }
219+ }
220+ . buttonStyle ( PrimaryLoadingButtonStyle ( isLoading: viewModel. isLoading) )
221+ . disabled ( viewModel. status == . missingInformation)
222+ }
223+ . padding ( isScrollViewEmbedded ? . vertical : . all)
224+ }
225+ . background ( Color ( uiColor: . systemBackground) )
226+ }
227+
209228 private struct AddressTextField : View {
210229 @ObservedObject var field : WooShippingAddressField
211230
@@ -345,6 +364,7 @@ extension WooShippingEditAddressView {
345364private extension WooShippingEditAddressView {
346365 enum Constants {
347366 static let verticalSpacing : CGFloat = 16
367+ static let defaultPadding : CGFloat = 16
348368 static let innerSpacing : CGFloat = 8
349369 static let extraPadding : CGFloat = 24
350370 static let cornerRadius : CGFloat = 8
0 commit comments