Skip to content

Commit 005c26c

Browse files
Hide split shipments label when there is an in-progress purchase
1 parent b3ee1f4 commit 005c26c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/wooshippinglabels/WooShippingLabelCreationViewModel.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,9 +1250,10 @@ class WooShippingLabelCreationViewModel @Inject constructor(
12501250
) : WooShippingViewState() {
12511251
val shouldShowSplitShipmentButton: Boolean
12521252
get() {
1253-
val unpurchasedShipments = shipmentUIList.filterNot { it.isReadOnly }
1254-
return unpurchasedShipments.size > 1 ||
1255-
(unpurchasedShipments.firstOrNull()?.totalItemQuantity ?: 0) > 1
1253+
val unpurchasedShipments = shipmentUIList.filterNot { it.isPurchased }
1254+
return shipmentUIList.none { it.isPurchaseInProgress } &&
1255+
(unpurchasedShipments.size > 1 ||
1256+
(unpurchasedShipments.firstOrNull()?.totalItemQuantity ?: 0) > 1)
12561257
}
12571258
}
12581259
}
@@ -1417,6 +1418,9 @@ data class ShipmentUI(
14171418
val isPurchased
14181419
get() = labelPurchaseStatus is LabelPurchaseStatus.Purchased
14191420

1421+
val isPurchaseInProgress
1422+
get() = labelPurchaseStatus is LabelPurchaseStatus.PurchaseInProgress
1423+
14201424
val isReadOnly
14211425
get() = labelPurchaseStatus is LabelPurchaseStatus.PurchaseInProgress ||
14221426
labelPurchaseStatus is LabelPurchaseStatus.Purchased

0 commit comments

Comments
 (0)