Skip to content

Commit f13d68d

Browse files
committed
Merge branch 'develop' into issue/4333-integrate-srf-modal
2 parents 9b26134 + dadb564 commit f13d68d

23 files changed

+1120
-72
lines changed

Gemfile.lock

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ GEM
1414
json (>= 1.5.1)
1515
artifactory (3.0.15)
1616
atomos (0.1.3)
17-
aws-eventstream (1.1.1)
18-
aws-partitions (1.484.0)
19-
aws-sdk-core (3.119.0)
17+
aws-eventstream (1.2.0)
18+
aws-partitions (1.496.0)
19+
aws-sdk-core (3.121.0)
2020
aws-eventstream (~> 1, >= 1.0.2)
2121
aws-partitions (~> 1, >= 1.239.0)
2222
aws-sigv4 (~> 1.1)
2323
jmespath (~> 1.0)
24-
aws-sdk-kms (1.46.0)
25-
aws-sdk-core (~> 3, >= 3.119.0)
24+
aws-sdk-kms (1.48.0)
25+
aws-sdk-core (~> 3, >= 3.120.0)
2626
aws-sigv4 (~> 1.1)
27-
aws-sdk-s3 (1.98.0)
28-
aws-sdk-core (~> 3, >= 3.119.0)
27+
aws-sdk-s3 (1.102.0)
28+
aws-sdk-core (~> 3, >= 3.120.0)
2929
aws-sdk-kms (~> 1)
30-
aws-sigv4 (~> 1.1)
31-
aws-sigv4 (1.2.4)
30+
aws-sigv4 (~> 1.4)
31+
aws-sigv4 (1.4.0)
3232
aws-eventstream (~> 1, >= 1.0.2)
3333
babosa (1.0.4)
3434
bigdecimal (1.4.4)
@@ -89,7 +89,7 @@ GEM
8989
ethon (0.14.0)
9090
ffi (>= 1.15.0)
9191
excon (0.85.0)
92-
faraday (1.7.0)
92+
faraday (1.7.1)
9393
faraday-em_http (~> 1.0)
9494
faraday-em_synchrony (~> 1.0)
9595
faraday-excon (~> 1.1)
@@ -113,8 +113,8 @@ GEM
113113
faraday-rack (1.0.0)
114114
faraday_middleware (1.1.0)
115115
faraday (~> 1.0)
116-
fastimage (2.2.4)
117-
fastlane (2.191.0)
116+
fastimage (2.2.5)
117+
fastlane (2.193.1)
118118
CFPropertyList (>= 2.3, < 4.0.0)
119119
addressable (>= 2.8, < 3.0.0)
120120
artifactory (~> 3.0)
@@ -140,6 +140,7 @@ GEM
140140
mini_magick (>= 4.9.4, < 5.0.0)
141141
multipart-post (~> 2.0.0)
142142
naturally (~> 2.2)
143+
optparse (~> 0.1.1)
143144
plist (>= 3.1.0, < 4.0.0)
144145
rubyzip (>= 2.0.0, < 3.0.0)
145146
security (= 0.1.3)
@@ -182,7 +183,7 @@ GEM
182183
gh_inspector (1.1.3)
183184
git (1.9.1)
184185
rchardet (~> 1.8)
185-
google-apis-androidpublisher_v3 (0.10.0)
186+
google-apis-androidpublisher_v3 (0.11.0)
186187
google-apis-core (>= 0.4, < 2.a)
187188
google-apis-core (0.4.1)
188189
addressable (~> 2.5, >= 2.5.1)
@@ -193,7 +194,7 @@ GEM
193194
retriable (>= 2.0, < 4.a)
194195
rexml
195196
webrick
196-
google-apis-iamcredentials_v1 (0.6.0)
197+
google-apis-iamcredentials_v1 (0.7.0)
197198
google-apis-core (>= 0.4, < 2.a)
198199
google-apis-playcustomapp_v1 (0.5.0)
199200
google-apis-core (>= 0.4, < 2.a)
@@ -213,13 +214,13 @@ GEM
213214
google-cloud-core (~> 1.6)
214215
googleauth (>= 0.16.2, < 2.a)
215216
mini_mime (~> 1.0)
216-
googleauth (0.17.0)
217+
googleauth (0.17.1)
217218
faraday (>= 0.17.3, < 2.0)
218219
jwt (>= 1.4, < 3.0)
219220
memoist (~> 0.16)
220221
multi_json (~> 1.11)
221222
os (>= 0.9, < 2.0)
222-
signet (~> 0.14)
223+
signet (~> 0.15)
223224
highline (2.0.3)
224225
http-cookie (1.0.4)
225226
domain_name (~> 0.5)
@@ -234,7 +235,7 @@ GEM
234235
jwt (2.2.3)
235236
memoist (0.16.2)
236237
mini_magick (4.11.0)
237-
mini_mime (1.1.0)
238+
mini_mime (1.1.1)
238239
minitest (5.14.4)
239240
molinillo (0.6.6)
240241
multi_json (1.15.0)
@@ -251,6 +252,7 @@ GEM
251252
oj (3.13.0)
252253
optimist (3.0.1)
253254
options (2.3.2)
255+
optparse (0.1.1)
254256
os (1.1.1)
255257
parallel (1.20.1)
256258
plist (3.6.0)
@@ -278,8 +280,8 @@ GEM
278280
addressable (>= 2.3.5)
279281
faraday (> 0.8, < 2.0)
280282
security (0.1.3)
281-
signet (0.15.0)
282-
addressable (~> 2.3)
283+
signet (0.16.0)
284+
addressable (~> 2.8)
283285
faraday (>= 0.17.3, < 2.0)
284286
jwt (>= 1.5, < 3.0)
285287
multi_json (~> 1.10)
@@ -344,4 +346,4 @@ DEPENDENCIES
344346
xcpretty-travis-formatter
345347

346348
BUNDLED WITH
347-
2.2.23
349+
2.2.25

RELEASE-NOTES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]
22

3+
7.6
4+
-----
5+
6+
37
7.5
48
-----
59
- [***] Merchants can now purchase shipping labels and declare customs forms for international orders. [https://github.com/woocommerce/woocommerce-ios/pull/4896]

WooCommerce/Classes/ViewRelated/CardPresentPayments/CardPresentPaymentsModalViewController.swift

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ final class CardPresentPaymentsModalViewController: UIViewController {
1111

1212
@IBOutlet weak var containerView: UIView!
1313
@IBOutlet weak var mainStackView: UIStackView!
14+
@IBOutlet weak var bottomPaddingRegular: NSLayoutConstraint!
1415
@IBOutlet weak var primaryActionButtonsStackView: UIStackView!
1516
@IBOutlet weak var buttonsSpacer: UIView!
1617
@IBOutlet private weak var topTitleLabel: UILabel!
@@ -82,6 +83,7 @@ final class CardPresentPaymentsModalViewController: UIViewController {
8283

8384
heightConstraint.priority = .required
8485
widthConstraint.priority = .required
86+
configureSpacer()
8587
}
8688
}
8789

@@ -117,8 +119,8 @@ private extension CardPresentPaymentsModalViewController {
117119

118120
func styleBottomLabels() {
119121
actionButtonsView.isHidden = true
120-
buttonsSpacer.isHidden = false
121122
bottomLabels.isHidden = false
123+
configureSpacer()
122124

123125
styleBottomTitle()
124126
styleBottomSubtitle()
@@ -134,8 +136,8 @@ private extension CardPresentPaymentsModalViewController {
134136

135137
func styleActionButtons() {
136138
actionButtonsView.isHidden = false
137-
buttonsSpacer.isHidden = true
138139
bottomLabels.isHidden = true
140+
configureSpacer()
139141

140142
stylePrimaryButton()
141143
styleSecondaryButton()
@@ -239,7 +241,7 @@ private extension CardPresentPaymentsModalViewController {
239241

240242
func hideActionButtonsView() {
241243
actionButtonsView.isHidden = true
242-
buttonsSpacer.isHidden = false
244+
configureSpacer()
243245
}
244246

245247
func configurePrimaryButton() {
@@ -271,6 +273,30 @@ private extension CardPresentPaymentsModalViewController {
271273
auxiliaryButton.isHidden = false
272274
auxiliaryButton.setTitle(viewModel.auxiliaryButtonTitle, for: .normal)
273275
}
276+
277+
func configureSpacer() {
278+
let enabled = !shouldShowActionButtons()
279+
280+
if isRegularClassSize {
281+
buttonsSpacer.isHidden = true
282+
// For iPads, instead of a flexible spacer we expand the bottom margin with an extra 127px.
283+
// This would be the space equivalents to the primary and secondary buttons being visible
284+
// - 32px of spacing between buttons container and the rest of the content
285+
// - 40px for the primary button
286+
// - 15px of spacing between buttons
287+
// - 40px for the secondary button
288+
bottomPaddingRegular.constant = 42 + (enabled ? 127 : 0)
289+
} else {
290+
// For compact screens (iPhones, or iPad in split mode), we us a flexible spacer with a low
291+
// content hugging priority to ensure it takes all the available space, leaving the rest of
292+
// the visible items aligned to the top of the stack view
293+
buttonsSpacer.isHidden = !enabled
294+
}
295+
}
296+
297+
var isRegularClassSize: Bool {
298+
traitCollection.verticalSizeClass == .regular && traitCollection.horizontalSizeClass == .regular
299+
}
274300
}
275301

276302
// MARK: - View layout configuration

WooCommerce/Classes/ViewRelated/CardPresentPayments/CardPresentPaymentsModalViewController.xib

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<outlet property="actionButtonsView" destination="10Z-y1-ZQ6" id="L1z-Zs-L2J"/>
1414
<outlet property="auxiliaryButton" destination="maO-19-PuQ" id="cQA-7p-jmo"/>
1515
<outlet property="bottomLabels" destination="k73-qi-GuD" id="LvQ-UE-SBc"/>
16+
<outlet property="bottomPaddingRegular" destination="lVZ-pu-Fmb" id="CJM-oy-oSx"/>
1617
<outlet property="bottomSubtitleLabel" destination="2Sx-5s-f7J" id="Mco-Vu-Li6"/>
1718
<outlet property="bottomTitleLabel" destination="oAj-lv-0k9" id="Clc-oi-Ywf"/>
1819
<outlet property="buttonsSpacer" destination="OFI-6w-cag" id="Uva-gQ-T7X"/>
@@ -136,20 +137,57 @@
136137
<constraints>
137138
<constraint firstItem="10Z-y1-ZQ6" firstAttribute="leading" secondItem="jIt-xb-rrN" secondAttribute="leading" id="0sg-Uf-xbd"/>
138139
<constraint firstAttribute="trailing" secondItem="10Z-y1-ZQ6" secondAttribute="trailing" id="Nrr-ur-lj3"/>
140+
<constraint firstAttribute="width" constant="248" id="wyC-vo-Y5l"/>
139141
</constraints>
142+
<variation key="default">
143+
<mask key="constraints">
144+
<exclude reference="wyC-vo-Y5l"/>
145+
</mask>
146+
</variation>
147+
<variation key="heightClass=regular-widthClass=regular">
148+
<mask key="constraints">
149+
<include reference="wyC-vo-Y5l"/>
150+
</mask>
151+
</variation>
140152
</stackView>
141153
</subviews>
142154
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
143155
<constraints>
144156
<constraint firstItem="jIt-xb-rrN" firstAttribute="leading" secondItem="8Tg-Q2-wkH" secondAttribute="leading" constant="16" id="80k-pZ-tsR"/>
157+
<constraint firstAttribute="width" constant="454" id="Apy-47-NLE"/>
158+
<constraint firstItem="jIt-xb-rrN" firstAttribute="top" secondItem="8Tg-Q2-wkH" secondAttribute="top" constant="42" id="FxC-xu-ACf"/>
145159
<constraint firstAttribute="height" priority="250" constant="382" id="J6m-sz-CD5"/>
146160
<constraint firstItem="jIt-xb-rrN" firstAttribute="top" secondItem="8Tg-Q2-wkH" secondAttribute="top" constant="32" id="JLA-XJ-MiD"/>
147-
<constraint firstAttribute="bottom" secondItem="jIt-xb-rrN" secondAttribute="bottom" constant="16" id="lVZ-pu-Fmb"/>
161+
<constraint firstAttribute="bottom" secondItem="jIt-xb-rrN" secondAttribute="bottom" constant="16" id="bkK-x1-zVB"/>
162+
<constraint firstAttribute="bottom" secondItem="jIt-xb-rrN" secondAttribute="bottom" constant="42" id="lVZ-pu-Fmb"/>
148163
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="382" id="n7H-7U-izh"/>
149164
<constraint firstItem="jIt-xb-rrN" firstAttribute="centerX" secondItem="8Tg-Q2-wkH" secondAttribute="centerX" id="p6Y-jJ-KuU"/>
150165
<constraint firstAttribute="width" constant="280" id="uaz-2N-7M4"/>
151166
<constraint firstAttribute="trailing" secondItem="jIt-xb-rrN" secondAttribute="trailing" constant="16" id="ufT-Yf-gsb"/>
167+
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="490" id="w7w-an-P9s"/>
152168
</constraints>
169+
<variation key="default">
170+
<mask key="constraints">
171+
<exclude reference="Apy-47-NLE"/>
172+
<exclude reference="w7w-an-P9s"/>
173+
<exclude reference="FxC-xu-ACf"/>
174+
<exclude reference="lVZ-pu-Fmb"/>
175+
</mask>
176+
</variation>
177+
<variation key="heightClass=regular-widthClass=regular">
178+
<mask key="constraints">
179+
<include reference="Apy-47-NLE"/>
180+
<exclude reference="n7H-7U-izh"/>
181+
<exclude reference="uaz-2N-7M4"/>
182+
<include reference="w7w-an-P9s"/>
183+
<exclude reference="80k-pZ-tsR"/>
184+
<include reference="FxC-xu-ACf"/>
185+
<exclude reference="JLA-XJ-MiD"/>
186+
<exclude reference="bkK-x1-zVB"/>
187+
<include reference="lVZ-pu-Fmb"/>
188+
<exclude reference="ufT-Yf-gsb"/>
189+
</mask>
190+
</variation>
153191
</view>
154192
</subviews>
155193
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import SwiftUI
2+
3+
struct ShippingLabelPackageItem: View {
4+
5+
@ObservedObject private var viewModel: ShippingLabelPackageItemViewModel
6+
@State private var isCollapsed: Bool = false
7+
@State private var isShowingPackageSelection = false
8+
9+
private let isCollapsible: Bool
10+
private let packageNumber: Int
11+
private let safeAreaInsets: EdgeInsets
12+
13+
init(packageNumber: Int,
14+
isCollapsible: Bool,
15+
safeAreaInsets: EdgeInsets,
16+
viewModel: ShippingLabelPackageItemViewModel) {
17+
self.packageNumber = packageNumber
18+
self.isCollapsible = isCollapsible
19+
self.safeAreaInsets = safeAreaInsets
20+
self.viewModel = viewModel
21+
self.isCollapsed = packageNumber > 1
22+
}
23+
24+
var body: some View {
25+
CollapsibleView(isCollapsible: isCollapsible, isCollapsed: $isCollapsed, safeAreaInsets: safeAreaInsets) {
26+
ShippingLabelPackageNumberRow(packageNumber: packageNumber, numberOfItems: viewModel.itemsRows.count)
27+
} content: {
28+
ListHeaderView(text: Localization.itemsToFulfillHeader, alignment: .left)
29+
.padding(.horizontal, insets: safeAreaInsets)
30+
31+
Divider()
32+
33+
ForEach(viewModel.itemsRows) { productItemRow in
34+
productItemRow
35+
.padding(.horizontal, insets: safeAreaInsets)
36+
.background(Color(.systemBackground))
37+
Divider()
38+
.padding(.horizontal, insets: safeAreaInsets)
39+
.padding(.leading, Constants.dividerPadding)
40+
}
41+
42+
ListHeaderView(text: Localization.packageDetailsHeader, alignment: .left)
43+
.padding(.horizontal, insets: safeAreaInsets)
44+
45+
VStack(spacing: 0) {
46+
Divider()
47+
48+
TitleAndValueRow(title: Localization.packageSelected, value: viewModel.selectedPackageName, selectable: true) {
49+
isShowingPackageSelection.toggle()
50+
}
51+
.padding(.horizontal, insets: safeAreaInsets)
52+
.sheet(isPresented: $isShowingPackageSelection, content: {
53+
// TODO-4599: Update package selection with new view model
54+
// ShippingLabelPackageSelection(viewModel: viewModel)
55+
})
56+
57+
Divider()
58+
59+
TitleAndTextFieldRow(title: Localization.totalPackageWeight,
60+
placeholder: "0",
61+
text: $viewModel.totalWeight,
62+
symbol: viewModel.weightUnit,
63+
keyboardType: .decimalPad)
64+
.padding(.horizontal, insets: safeAreaInsets)
65+
66+
Divider()
67+
}
68+
.background(Color(.systemBackground))
69+
70+
ListHeaderView(text: Localization.footer, alignment: .left)
71+
.padding(.horizontal, insets: safeAreaInsets)
72+
}
73+
}
74+
}
75+
76+
private extension ShippingLabelPackageItem {
77+
enum Localization {
78+
static let itemsToFulfillHeader = NSLocalizedString("ITEMS TO FULFILL", comment: "Header section items to fulfill in Shipping Label Package Detail")
79+
static let packageDetailsHeader = NSLocalizedString("PACKAGE DETAILS", comment: "Header section package details in Shipping Label Package Detail")
80+
static let packageSelected = NSLocalizedString("Package Selected",
81+
comment: "Title of the row for selecting a package in Shipping Label Package Detail screen")
82+
static let totalPackageWeight = NSLocalizedString("Total package weight",
83+
comment: "Title of the row for adding the package weight in Shipping Label Package Detail screen")
84+
static let footer = NSLocalizedString("Sum of products and package weight",
85+
comment: "Title of the footer in Shipping Label Package Detail screen")
86+
}
87+
88+
enum Constants {
89+
static let dividerPadding: CGFloat = 16
90+
}
91+
}
92+
93+
struct ShippingLabelPackageItem_Previews: PreviewProvider {
94+
static var previews: some View {
95+
let order = ShippingLabelPackageDetailsViewModel.sampleOrder()
96+
let packageResponse = ShippingLabelPackageDetailsViewModel.samplePackageDetails()
97+
let viewModel = ShippingLabelPackageItemViewModel(order: order,
98+
orderItems: order.items,
99+
packagesResponse: packageResponse,
100+
selectedPackageID: "Box 1",
101+
totalWeight: "",
102+
products: [],
103+
productVariations: [])
104+
ShippingLabelPackageItem(packageNumber: 1, isCollapsible: true, safeAreaInsets: .zero, viewModel: viewModel)
105+
}
106+
}

0 commit comments

Comments
 (0)