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
2 changes: 0 additions & 2 deletions Modules/Sources/Experiments/DefaultFeatureFlagService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
return true
case .showInboxCTA:
return true
case .sideBySideViewForOrderForm:
return true
case .updateOrderOptimistically:
return buildConfig == .localDeveloper || buildConfig == .alpha
case .shippingLabelsOnboardingM1:
Expand Down
4 changes: 0 additions & 4 deletions Modules/Sources/Experiments/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public enum FeatureFlag: Int {
///
case showInboxCTA

/// Displays the OrderForm side by side with the Product Selector
///
case sideBySideViewForOrderForm

/// Enable optimistic updates for orders
///
case updateOrderOptimistically
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,6 @@ final class EditableOrderViewModel: ObservableObject {
}
}

var sideBySideViewFeatureFlagEnabled: Bool {
featureFlagService.isFeatureFlagEnabled(.sideBySideViewForOrderForm)
}

/// Indicates whether the cancel button is visible.
///
var shouldShowCancelButton: Bool {
// The cancel button is handled by the AdaptiveModalContainer with the side-by-side view enabled, so this one should not be shown.
guard !sideBySideViewFeatureFlagEnabled else {
return false
}
return flow == .creation
}

/// Indicates the customer details screen to be shown. If there's no address added show the customer selector, otherwise the form so it can be edited
///
var customerNavigationScreen: CustomerNavigationScreen {
Expand Down Expand Up @@ -2015,9 +2001,6 @@ private extension EditableOrderViewModel {
}

func evaluateSelectionSync() {
guard sideBySideViewFeatureFlagEnabled else {
return
}
switch selectionSyncApproach {
case .immediate:
syncOrderItems(products: selectedProducts, variations: selectedProductVariations)
Expand All @@ -2031,10 +2014,7 @@ private extension EditableOrderViewModel {
func forwardSyncApproachToSynchronizer() {
$selectionSyncApproach
.sink { [weak self] selectionSyncApproach in
guard let self,
sideBySideViewFeatureFlagEnabled else {
return
}
guard let self else { return }
orderSynchronizer.updateBlockingBehavior(selectionSyncApproach == .immediate ? .allUpdates : .majorUpdates)
}
.store(in: &cancellables)
Expand All @@ -2044,10 +2024,7 @@ private extension EditableOrderViewModel {
$selectionSyncApproach
.removeDuplicates()
.sink { [weak self] selectionSyncApproach in
guard let self,
sideBySideViewFeatureFlagEnabled else {
return
}
guard let self else { return }
if selectionSyncApproach != .onSelectorButtonTap || syncRequired {
/// When we change from `onSelectorButtonTap`, we would lose unsynced changes if we do nothing.
/// `syncRequired` indicates that we have unsynced side-by-side changes, which would be lost when
Expand Down
153 changes: 46 additions & 107 deletions WooCommerce/Classes/ViewRelated/Orders/Order Creation/OrderForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,60 +124,56 @@ struct OrderFormPresentationWrapper: View {
@Environment(\.horizontalSizeClass) var horizontalSizeClass

var body: some View {
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.sideBySideViewForOrderForm) {
AdaptiveModalContainer(
primaryView: { presentProductSelector in
OrderForm(dismissHandler: dismissHandler,
flow: flow,
viewModel: viewModel,
presentProductSelector: presentProductSelector)
AdaptiveModalContainer(
primaryView: { presentProductSelector in
OrderForm(dismissHandler: dismissHandler,
flow: flow,
viewModel: viewModel,
presentProductSelector: presentProductSelector)
// When we're modal-on-modal, show the notices on both screens so they're definitely visible
.if(horizontalSizeClass == .compact, transform: {
$0
.notice($viewModel.autodismissableNotice)
.notice($viewModel.fixedNotice, autoDismiss: false)
})
},
secondaryView: { isShowingProductSelector in
if let productSelectorViewModel = viewModel.productSelectorViewModel {
ProductSelectorView(configuration: .loadConfiguration(for: horizontalSizeClass),
isPresented: isShowingProductSelector,
viewModel: productSelectorViewModel)
.sheet(item: $viewModel.productToConfigureViewModel) { viewModel in
ConfigurableBundleProductView(viewModel: viewModel)
}
// When we're modal-on-modal, show the notices on both screens so they're definitely visible
.if(horizontalSizeClass == .compact, transform: {
$0
.notice($viewModel.autodismissableNotice)
.notice($viewModel.fixedNotice, autoDismiss: false)
})
},
secondaryView: { isShowingProductSelector in
if let productSelectorViewModel = viewModel.productSelectorViewModel {
ProductSelectorView(configuration: .loadConfiguration(for: horizontalSizeClass),
isPresented: isShowingProductSelector,
viewModel: productSelectorViewModel)
.sheet(item: $viewModel.productToConfigureViewModel) { viewModel in
ConfigurableBundleProductView(viewModel: viewModel)
}
// When we're modal-on-modal, show the notices on both screens so they're definitely visible
.if(horizontalSizeClass == .compact, transform: {
$0
.notice($viewModel.autodismissableNotice)
.notice($viewModel.fixedNotice, autoDismiss: false)
})
}
},
dismissBarButton: {
Button {
dismissHandler()
} label: {
switch dismissLabel {
case .cancelButton:
Text(OrderForm.Localization.cancelButton)
case .backButton:
Image(systemName: "chevron.backward")
.headlineLinkStyle()
}
}
},
dismissBarButton: {
Button {
dismissHandler()
} label: {
switch dismissLabel {
case .cancelButton:
Text(OrderForm.Localization.cancelButton)
case .backButton:
Image(systemName: "chevron.backward")
.headlineLinkStyle()
}
.accessibilityIdentifier(OrderForm.Accessibility.cancelButtonIdentifier)
},
isShowingSecondaryView: $viewModel.isProductSelectorPresented)
// When we're side-by-side, show the notices over the combined screen
.if(horizontalSizeClass == .regular, transform: {
$0
.notice($viewModel.autodismissableNotice)
.notice($viewModel.fixedNotice, autoDismiss: false)
})
} else {
OrderForm(dismissHandler: dismissHandler, flow: flow, viewModel: viewModel, presentProductSelector: nil)
}
}
.accessibilityIdentifier(OrderForm.Accessibility.cancelButtonIdentifier)
},
isShowingSecondaryView: $viewModel.isProductSelectorPresented)
// When we're side-by-side, show the notices over the combined screen
.if(horizontalSizeClass == .regular, transform: {
$0
.notice($viewModel.autodismissableNotice)
.notice($viewModel.fixedNotice, autoDismiss: false)
})
}
}

Expand Down Expand Up @@ -268,16 +264,11 @@ struct OrderForm: View {
}
.renderedIf(viewModel.shouldShowNonEditableIndicators)

if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.sideBySideViewForOrderForm) {
Group {
OrderStatusSection(viewModel: viewModel, topDivider: !viewModel.shouldShowNonEditableIndicators)
Spacer(minLength: Layout.sectionSpacing)
}
.renderedIf(flow == .editing)
} else {
Group {
OrderStatusSection(viewModel: viewModel, topDivider: !viewModel.shouldShowNonEditableIndicators)
Spacer(minLength: Layout.sectionSpacing)
}
.renderedIf(flow == .editing)

ProductsSection(scroll: scroll,
flow: flow,
Expand Down Expand Up @@ -429,13 +420,6 @@ struct OrderForm: View {
.navigationTitle(viewModel.title)
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button(Localization.cancelButton) {
dismissHandler()
}
.accessibilityIdentifier(Accessibility.cancelButtonIdentifier)
.renderedIf(viewModel.shouldShowCancelButton)
}
ToolbarItem(placement: .confirmationAction) {
switch viewModel.navigationTrailingItem {
case .create:
Expand All @@ -462,13 +446,6 @@ struct OrderForm: View {
.onTapGesture {
shouldShowInformationalCouponTooltip = false
}
// Avoids Notice duplication when the feature flag is enabled. These can be removed when the flag is removed.
.if(!ServiceLocator.featureFlagService.isFeatureFlagEnabled(.sideBySideViewForOrderForm), transform: {
$0.notice($viewModel.autodismissableNotice)
})
.if(!ServiceLocator.featureFlagService.isFeatureFlagEnabled(.sideBySideViewForOrderForm), transform: {
$0.notice($viewModel.fixedNotice, autoDismiss: false)
})
}

@ViewBuilder private var storedTaxRateBottomSheetContent: some View {
Expand Down Expand Up @@ -640,8 +617,7 @@ private struct ProductsSection: View {
Divider()

VStack(alignment: .leading, spacing: layoutVerticalSpacing) {
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.sideBySideViewForOrderForm)
&& presentationStyle == .sideBySide
if presentationStyle == .sideBySide
&& !viewModel.shouldShowProductsSectionHeader {
HStack() {
scanProductRow
Expand Down Expand Up @@ -670,15 +646,6 @@ private struct ProductsSection: View {
.accessibilityLabel(OrderForm.Localization.addProductButtonAccessibilityLabel)
.id(addProductButton)
.accessibilityIdentifier(OrderForm.Accessibility.addProductButtonIdentifier)
} else if !ServiceLocator.featureFlagService.isFeatureFlagEnabled(.sideBySideViewForOrderForm) {
Button(action: {
viewModel.toggleProductSelectorVisibility()
}) {
Image(uiImage: .plusImage)
}
.accessibilityLabel(OrderForm.Localization.addProductButtonAccessibilityLabel)
.id(addProductButton)
.accessibilityIdentifier(OrderForm.Accessibility.addProductButtonIdentifier)
}
}
.scaledToFit()
Expand Down Expand Up @@ -710,13 +677,6 @@ private struct ProductsSection: View {
.id(addProductButton)
.accessibilityIdentifier(OrderForm.Accessibility.addProductButtonIdentifier)
.buttonStyle(PlusButtonStyle())
} else if !ServiceLocator.featureFlagService.isFeatureFlagEnabled(.sideBySideViewForOrderForm) {
Button(OrderForm.Localization.addProducts) {
viewModel.toggleProductSelectorVisibility()
}
.id(addProductButton)
.accessibilityIdentifier(OrderForm.Accessibility.addProductButtonIdentifier)
.buttonStyle(PlusButtonStyle())
}
scanProductButton
.renderedIf(presentationStyle != .sideBySide)
Expand All @@ -730,27 +690,6 @@ private struct ProductsSection: View {
.sheet(item: $viewModel.configurableScannedProductViewModel) { configurableScannedProductViewModel in
ConfigurableBundleProductView(viewModel: configurableScannedProductViewModel)
}
.sheet(isPresented: Binding<Bool>(
get: { viewModel.isProductSelectorPresented && !viewModel.sideBySideViewFeatureFlagEnabled },
set: { newValue in
viewModel.isProductSelectorPresented = newValue
}
), onDismiss: {
scroll.scrollTo(addProductButton)
}, content: {
if let productSelectorViewModel = viewModel.productSelectorViewModel {
ProductSelectorNavigationView(
configuration: ProductSelectorView.Configuration.addProductToOrder(),
isPresented: $viewModel.isProductSelectorPresented,
viewModel: productSelectorViewModel)
.onDisappear {
navigationButtonID = UUID()
}
.sheet(item: $viewModel.productToConfigureViewModel) { viewModel in
ConfigurableBundleProductView(viewModel: viewModel)
}
}
})
.actionSheet(isPresented: $showPermissionsSheet, content: {
ActionSheet(
title: Text(OrderForm.Localization.permissionsTitle),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,8 @@ private extension OrderDetailsViewController {
private func editOrder() {
let viewModel = EditableOrderViewModel(siteID: viewModel.order.siteID, flow: .editing(initialOrder: viewModel.order))
let viewController = OrderFormHostingController(viewModel: viewModel)
if ServiceLocator.featureFlagService.isFeatureFlagEnabled(.sideBySideViewForOrderForm) {
viewController.modalPresentationStyle = .fullScreen
present(viewController, animated: true)
} else {
let navController = UINavigationController(rootViewController: viewController)
present(navController, animated: true)
}
viewController.modalPresentationStyle = .fullScreen
present(viewController, animated: true)

let hasMultipleShippingLines = self.viewModel.order.shippingLines.count > 1
let hasMultipleFeeLines = self.viewModel.order.fees.count > 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ final class OrdersRootViewController: UIViewController {
command: OrderSearchUICommand(siteID: siteID,
onSelectSearchResult: { [weak self] order, viewController in
guard let self else { return }
guard featureFlagService.isFeatureFlagEnabled(.sideBySideViewForOrderForm) else {
return presentOrder(order, from: viewController)
}
navigateToOrderDetail(order)
viewController.dismiss(animated: true)
}),
Expand Down Expand Up @@ -230,13 +227,8 @@ final class OrdersRootViewController: UIViewController {
}
}

if featureFlagService.isFeatureFlagEnabled(.sideBySideViewForOrderForm) {
viewController.modalPresentationStyle = .overFullScreen
navigationController.present(viewController, animated: true)
} else {
let newOrderNavigationController = WooNavigationController(rootViewController: viewController)
navigationController.present(newOrderNavigationController, animated: true)
}
viewController.modalPresentationStyle = .overFullScreen
navigationController.present(viewController, animated: true)

analytics.track(event: .Orders.orderAddNew())
orderDurationRecorder.startRecording()
Expand Down
Loading
Loading