Skip to content

Commit d0592bd

Browse files
committed
Switch to display packages form if multi-package feature flag is on
1 parent 00d8074 commit d0592bd

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/Create Shipping Label Form/ShippingLabelFormViewController.swift

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,24 @@ private extension ShippingLabelFormViewController {
417417
}
418418

419419
func displayPackageDetailsVC(inputPackages: [ShippingLabelPackageAttributes]) {
420-
let vm = ShippingLabelPackageDetailsViewModel(order: viewModel.order,
421-
packagesResponse: viewModel.packagesResponse,
422-
selectedPackages: inputPackages)
423-
let packageDetails = ShippingLabelPackageDetails(viewModel: vm) { [weak self] selectedPackages in
424-
self?.viewModel.handlePackageDetailsValueChanges(details: selectedPackages)
425-
}
420+
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.shippingLabelsMultiPackage) {
421+
let vm = ShippingLabelPackagesFormViewModel(order: viewModel.order,
422+
packagesResponse: viewModel.packagesResponse,
423+
selectedPackages: inputPackages)
424+
let packagesForm = ShippingLabelPackagesForm(viewModel: vm)
425+
let hostingVC = UIHostingController(rootView: packagesForm)
426+
navigationController?.show(hostingVC, sender: nil)
427+
} else {
428+
let vm = ShippingLabelPackageDetailsViewModel(order: viewModel.order,
429+
packagesResponse: viewModel.packagesResponse,
430+
selectedPackages: inputPackages)
431+
let packageDetails = ShippingLabelPackageDetails(viewModel: vm) { [weak self] selectedPackages in
432+
self?.viewModel.handlePackageDetailsValueChanges(details: selectedPackages)
433+
}
426434

427-
let hostingVC = UIHostingController(rootView: packageDetails)
428-
navigationController?.show(hostingVC, sender: nil)
435+
let hostingVC = UIHostingController(rootView: packageDetails)
436+
navigationController?.show(hostingVC, sender: nil)
437+
}
429438
}
430439

431440
func displayCustomsFormListVC(customsForms: [ShippingLabelCustomsForm]) {

0 commit comments

Comments
 (0)