Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ extension ShippingLabelPackageSelected: Encodable {
try container.encode(boxID.isEmpty ? "0" : boxID, forKey: .boxID)
try container.encode(length, forKey: .length)
try container.encode(width, forKey: .width)
try container.encode(height, forKey: .height)

// workaround because 0 would cause an error for the API request
try container.encode(height > 0 ? height : 0.25, forKey: .height)

try container.encode(weight, forKey: .weight)
try container.encode(isLetter, forKey: .isLetter)
try container.encodeIfPresent(hazmatCategory, forKey: .hazmatCategory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public struct WooShippingPredefinedPackage: Equatable, GeneratedFakeable, Identi
}

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

Expand All @@ -48,7 +48,7 @@ public struct WooShippingPredefinedPackage: Equatable, GeneratedFakeable, Identi
}

public func getHeight() -> Double {
let lastComponent = dimensions.components(separatedBy: " x ").last ?? ""
let lastComponent = dimensions.components(separatedBy: " x ")[safe: 2] ?? ""
return Double(lastComponent) ?? 0
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,15 @@ final class WooShippingRemoteTests: XCTestCase {
let remote = WooShippingRemote(network: network)
network.simulateResponse(requestUrlSuffix: "label/rate", filename: "wooshipping-get-label-rates-success")
let expectedDefaultRate = sampleLabelRate()
let expectedPackage = ShippingLabelPackageSelected.fake().copy(length: 12, width: 20, height: 0)

// When
let result: Result<[ShippingLabelCarriersAndRates], Error> = waitFor { promise in
remote.loadLabelRates(siteID: self.sampleSiteID,
orderID: self.sampleOrderID,
originAddress: WooShippingAddress.fake(),
destinationAddress: WooShippingAddress.fake(),
packages: [ShippingLabelPackageSelected.fake()]) { (result) in
packages: [expectedPackage]) { (result) in
promise(result)
}
}
Expand All @@ -188,6 +189,9 @@ final class WooShippingRemoteTests: XCTestCase {
let request = try XCTUnwrap(network.requestsForResponseData.last as? JetpackRequest)
let featuresParam = try XCTUnwrap(request.parameters["features_supported_by_client"] as? [String])
XCTAssertEqual(featuresParam, ["upsdap"])
let packagesParam = try XCTUnwrap(request.parameters["packages"] as? [[String: Any]])
let package = try XCTUnwrap(packagesParam.first)
XCTAssertEqual(package["height"] as? Double, 0.25)

let successResponse = try XCTUnwrap(result.get())
XCTAssertEqual(successResponse.first?.defaultRates.first, expectedDefaultRate)
Expand Down
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [internal] Reduced fields fetched for variations in Point of Sale [https://github.com/woocommerce/woocommerce-ios/pull/15712]
- [*] Order List: Prevent last updated time being truncated at larger font sizes [https://github.com/woocommerce/woocommerce-ios/pull/15717]
- [***] Creating shipping labels is now supported for stores with the WooCommerce Shipping extension [https://github.com/woocommerce/woocommerce-ios/pull/15738]
- [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]

22.5
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct DefaultImageService: ImageService {
let targetSize: CGSize
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(
.productImageOptimizedHandling
) {
) && !imageView.bounds.isEmpty {
let scale = UIScreen.main.scale
targetSize = CGSize(
width: imageView.bounds.width * scale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ struct WooShippingPackageData: WooShippingPackageDataRepresentable {

extension WooShippingPackageDataRepresentable {
func dimensionsDescription(unit: String) -> String {
guard height.isNotEmpty, let numericHeight = Int(height), numericHeight > 0 else {
return "\(length) x \(width) \( unit)"
}
return "\(length) x \(width) x \(height) \( unit)"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ extension ProductsTabProductTableViewCell {
productImageView.layer.borderWidth = 0
} else {
configureProductImageViewForBigImages()
/// Make sure `productImageView` is laid out and gained bounds
productImageView.layoutIfNeeded()

productImageView.image = .productsTabProductCellPlaceholderImage
if let productURLString = viewModel.imageUrl {
imageService.downloadAndCacheImageForImageView(productImageView,
Expand Down
10 changes: 5 additions & 5 deletions WooCommerce/Resources/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Translation-Revision-Date: 2025-06-17 09:54:05+0000 */
/* Translation-Revision-Date: 2025-06-17 14:54:06+0000 */
/* Plural-Forms: nplurals=2; plural=n != 1; */
/* Generator: GlotPress/2.4.0-alpha */
/* Language: de */
Expand Down Expand Up @@ -8908,7 +8908,7 @@ If your translation of that term also happens to contains a hyphen, please be su
"blazeBudgetSettingView.dailySpend" = "Ausgaben für einen Tag";

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

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

/* 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. */
"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.";
"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.";

/* 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. */
"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.";
"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.";

/* 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. */
"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.";
"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.";

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