Skip to content

Commit e067f4a

Browse files
Add helper to get selected shipment IDs.
1 parent fba7d7d commit e067f4a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShipping Split Shipments/CollapsibleShipmentCardViewModel.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ final class CollapsibleShipmentCardViewModel: ObservableObject, Identifiable {
1414

1515
var onSelectionChange: (() -> Void)?
1616

17-
var hasSelectedAnItem: Bool {
17+
var selectedShipmentIds: [String] {
1818
if mainShipmentRow.selected {
19-
return true
19+
if childShipmentRows.isNotEmpty {
20+
return childShipmentRows.map { $0.shipmentId }
21+
} else {
22+
return [mainShipmentRow.shipmentId]
23+
}
2024
}
2125

2226
return childShipmentRows
2327
.filter { $0.selected }
24-
.isNotEmpty
28+
.map(\.shipmentId)
2529
}
2630

2731
init(parentShipmentId: String,

0 commit comments

Comments
 (0)