Skip to content

Commit f006b2f

Browse files
authored
Merge release/22.6 into trunk (#15827)
2 parents 7d2cadf + 1578495 commit f006b2f

File tree

31 files changed

+948
-37
lines changed

31 files changed

+948
-37
lines changed

Modules/Sources/Networking/Model/ShippingLabel/Packages/CarriersAndRates/ShippingLabelPackageSelected.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ extension ShippingLabelPackageSelected: Encodable {
4646
try container.encode(boxID.isEmpty ? "0" : boxID, forKey: .boxID)
4747
try container.encode(length, forKey: .length)
4848
try container.encode(width, forKey: .width)
49-
try container.encode(height, forKey: .height)
49+
50+
// workaround because 0 would cause an error for the API request
51+
try container.encode(height > 0 ? height : 0.25, forKey: .height)
52+
5053
try container.encode(weight, forKey: .weight)
5154
try container.encode(isLetter, forKey: .isLetter)
5255
try container.encodeIfPresent(hazmatCategory, forKey: .hazmatCategory)

Modules/Sources/Networking/Model/ShippingLabel/Packages/PredefinedPackage/WooShippingPredefinedPackage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public struct WooShippingPredefinedPackage: Equatable, GeneratedFakeable, Identi
3838
}
3939

4040
public func getLength() -> Double {
41-
let firstComponent = dimensions.components(separatedBy: " x ").first ?? ""
41+
let firstComponent = dimensions.components(separatedBy: " x ")[safe: 0] ?? ""
4242
return Double(firstComponent) ?? 0
4343
}
4444

@@ -48,7 +48,7 @@ public struct WooShippingPredefinedPackage: Equatable, GeneratedFakeable, Identi
4848
}
4949

5050
public func getHeight() -> Double {
51-
let lastComponent = dimensions.components(separatedBy: " x ").last ?? ""
51+
let lastComponent = dimensions.components(separatedBy: " x ")[safe: 2] ?? ""
5252
return Double(lastComponent) ?? 0
5353
}
5454
}

Modules/Tests/NetworkingTests/Remote/WooShippingRemoteTests.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,15 @@ final class WooShippingRemoteTests: XCTestCase {
172172
let remote = WooShippingRemote(network: network)
173173
network.simulateResponse(requestUrlSuffix: "label/rate", filename: "wooshipping-get-label-rates-success")
174174
let expectedDefaultRate = sampleLabelRate()
175+
let expectedPackage = ShippingLabelPackageSelected.fake().copy(length: 12, width: 20, height: 0)
175176

176177
// When
177178
let result: Result<[ShippingLabelCarriersAndRates], Error> = waitFor { promise in
178179
remote.loadLabelRates(siteID: self.sampleSiteID,
179180
orderID: self.sampleOrderID,
180181
originAddress: WooShippingAddress.fake(),
181182
destinationAddress: WooShippingAddress.fake(),
182-
packages: [ShippingLabelPackageSelected.fake()]) { (result) in
183+
packages: [expectedPackage]) { (result) in
183184
promise(result)
184185
}
185186
}
@@ -188,6 +189,9 @@ final class WooShippingRemoteTests: XCTestCase {
188189
let request = try XCTUnwrap(network.requestsForResponseData.last as? JetpackRequest)
189190
let featuresParam = try XCTUnwrap(request.parameters["features_supported_by_client"] as? [String])
190191
XCTAssertEqual(featuresParam, ["upsdap"])
192+
let packagesParam = try XCTUnwrap(request.parameters["packages"] as? [[String: Any]])
193+
let package = try XCTUnwrap(packagesParam.first)
194+
XCTAssertEqual(package["height"] as? Double, 0.25)
191195

192196
let successResponse = try XCTUnwrap(result.get())
193197
XCTAssertEqual(successResponse.first?.defaultRates.first, expectedDefaultRate)

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- [internal] Reduced fields fetched for variations in Point of Sale [https://github.com/woocommerce/woocommerce-ios/pull/15712]
2424
- [*] Order List: Prevent last updated time being truncated at larger font sizes [https://github.com/woocommerce/woocommerce-ios/pull/15717]
2525
- [***] Creating shipping labels is now supported for stores with the WooCommerce Shipping extension [https://github.com/woocommerce/woocommerce-ios/pull/15738]
26+
- [internal] Optimized image handling with a fallback thumbnail size for image views that have empty bounds, preventing high memory usage. [https://github.com/woocommerce/woocommerce-ios/pull/15815]
2627

2728
22.5
2829
-----

WooCommerce/Classes/Tools/ImageService/DefaultImageService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct DefaultImageService: ImageService {
5959
let targetSize: CGSize
6060
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(
6161
.productImageOptimizedHandling
62-
) {
62+
) && !imageView.bounds.isEmpty {
6363
let scale = UIScreen.main.scale
6464
targetSize = CGSize(
6565
width: imageView.bounds.width * scale,

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShipping Package and Rate Selection/WooSavedPackagesSelectionView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ struct WooShippingPackageData: WooShippingPackageDataRepresentable {
9292

9393
extension WooShippingPackageDataRepresentable {
9494
func dimensionsDescription(unit: String) -> String {
95+
guard height.isNotEmpty, let numericHeight = Int(height), numericHeight > 0 else {
96+
return "\(length) x \(width) \( unit)"
97+
}
9598
return "\(length) x \(width) x \(height) \( unit)"
9699
}
97100

WooCommerce/Classes/ViewRelated/Products/Cells/ProductsTabProductTableViewCell.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ extension ProductsTabProductTableViewCell {
101101
productImageView.layer.borderWidth = 0
102102
} else {
103103
configureProductImageViewForBigImages()
104+
/// Make sure `productImageView` is laid out and gained bounds
105+
productImageView.layoutIfNeeded()
106+
104107
productImageView.image = .productsTabProductCellPlaceholderImage
105108
if let productURLString = viewModel.imageUrl {
106109
imageService.downloadAndCacheImageForImageView(productImageView,

WooCommerce/Resources/de.lproj/Localizable.strings

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Translation-Revision-Date: 2025-06-17 09:54:05+0000 */
1+
/* Translation-Revision-Date: 2025-06-17 14:54:06+0000 */
22
/* Plural-Forms: nplurals=2; plural=n != 1; */
33
/* Generator: GlotPress/2.4.0-alpha */
44
/* Language: de */
@@ -8908,7 +8908,7 @@ If your translation of that term also happens to contains a hyphen, please be su
89088908
"blazeBudgetSettingView.dailySpend" = "Ausgaben für einen Tag";
89098909

89108910
/* Value format for the daily spend amount on the Blaze ads campaign budget settings screen. */
8911-
"blazeBudgetSettingView.dailySpendValue" = "USD%d";
8911+
"blazeBudgetSettingView.dailySpendValue" = "%d USD";
89128912

89138913
/* Subtitle of the Blaze budget setting screen */
89148914
"blazeBudgetSettingView.description" = "Wie viel Geld willst du für deine Kampagne ausgeben und wie lange soll sie laufen?";
@@ -9161,13 +9161,13 @@ If your translation of that term also happens to contains a hyphen, please be su
91619161
"blazeCampaignCreationFormViewModel.everywhere" = "Überall";
91629162

91639163
/* First part of checkbox text for accepting terms of service for finite Blaze campaigns with the duration of more than 7 days. %1$.0f is the weekly budget amount, %2$@ is the formatted start date. The content inside two double asterisks **...** denote bolded text. */
9164-
"blazeCampaignCreationFormViewModel.tosCheckboxFirstLinePart.MoreThanSevenDays" = "Ich stimme einer wiederkehrenden Abbuchung in Höhe von **$%1$.0f\/Woche** ab dem **%2$@** zu. Die Abbuchungen können zu verschiedenen Zeiten während der Kampagne erfolgen.";
9164+
"blazeCampaignCreationFormViewModel.tosCheckboxFirstLinePart.MoreThanSevenDays" = "Ich stimme einer wiederkehrenden Abbuchung in Höhe von bis zu **$%1$.0f\/Woche** ab dem **%2$@** zu. Die Abbuchungen können zu verschiedenen Zeiten während der Kampagne erfolgen.";
91659165

91669166
/* First part of checkbox text for accepting terms of service for finite Blaze campaigns with the duration up to 7 days. %1$.0f is the weekly budget amount, %2$@ is the formatted start date. The content inside two double asterisks **...** denote bolded text. */
9167-
"blazeCampaignCreationFormViewModel.tosCheckboxFirstLinePart.upToSevenDays" = "Ich stimme zu, dass mir die entstehenden Kosten in Höhe von **$%1$.0f** ab dem **%2$@** in Rechnung gestellt werden. Solange die Kampagne aktiv ist, können eine oder mehrere Zahlungen fällig werden.";
9167+
"blazeCampaignCreationFormViewModel.tosCheckboxFirstLinePart.upToSevenDays" = "Ich stimme zu, dass mir die entstehenden Kosten in Höhe von bis zu **$%1$.0f** ab dem **%2$@** in Rechnung gestellt werden. Solange die Kampagne aktiv ist, können eine oder mehrere Zahlungen fällig werden.";
91689168

91699169
/* First part of checkbox text for accepting terms of service for the endless Blaze campaign subscription. %1$.0f is the weekly budget amount, %2$@ is the formatted start date. The content inside two double asterisks **...** denote bolded text. */
9170-
"blazeCampaignCreationFormViewModel.tosCheckboxFirstLinePartEvergreen" = "Ich stimme einer wiederkehrenden **wöchentlichen Abbuchung in Höhe von $%1$.0f** ab dem **%2$@** zu. Die Abbuchungen können zu verschiedenen Zeiten während der Kampagne erfolgen.";
9170+
"blazeCampaignCreationFormViewModel.tosCheckboxFirstLinePartEvergreen" = "Ich stimme einer wiederkehrenden **wöchentlichen Abbuchung in Höhe von bis zu $%1$.0f** ab dem **%2$@** zu. Die Abbuchungen können zu verschiedenen Zeiten während der Kampagne erfolgen.";
91719171

91729172
/* Second part of checkbox text for accepting terms of service for finite Blaze campaigns. %@ is \"I can cancel anytime\" substring for a hyperlink. */
91739173
"blazeCampaignCreationFormViewModel.tosCheckboxSecondLinePart" = "%@; ich bezahle nur für Werbung, die bis zur Kündigung geschaltet wurde.";

0 commit comments

Comments
 (0)