Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [**] We added support for collecting in-person payments (including Tap To Pay) using Stripe Payment Gateway extension in the UK. [https://github.com/woocommerce/woocommerce-ios/pull/16287]
- [*] Improve card payments onboarding error handling to show network errors correctly [https://github.com/woocommerce/woocommerce-ios/pull/16304]
- [*] Authenticate the admin page automatically for sites with SSO enabled in custom fields, in-person payment setup, and editing tax rates flows. [https://github.com/woocommerce/woocommerce-ios/pull/16318]
- [*] Fix order details presentation when opened from booking details [https://github.com/woocommerce/woocommerce-ios/pull/16331]

23.6
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ final class OrderDetailsViewController: UIViewController {
override var shouldShowOfflineBanner: Bool {
true
}

func isPresentingViewModelOrder(_ viewModel: OrderDetailsViewModel) -> Bool {
return self.viewModel.order.orderID == viewModel.order.orderID
}

func isQuickOrderNavigationSupported() -> Bool {
viewModels.count > 1
}
}

// MARK: - TableView Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,14 @@ extension OrderListViewController {
/// Adds ability to select any order
/// Used when opening an order with deep link
/// - Parameter orderID: ID of the order to select in the list.
/// - Parameter isTriggeredByUserAction: Reflects if the order selection was triggered by a manual user action and not a view lifecycle update
/// Practically if the `isTriggeredByUserAction` is true, then the order details will be force presented
/// even if `selectedOrderID` is the same as the new `orderID`
/// - Returns: Whether the order to select is in the list already (i.e. the order has been fetched and exists locally).
func selectOrderFromListIfPossible(for orderID: Int64) -> Bool {
func selectOrderFromListIfPossible(
for orderID: Int64,
isTriggeredByUserAction: Bool = false,
) -> Bool {
guard let dataSource else {
return false
}
Expand All @@ -637,7 +643,7 @@ extension OrderListViewController {
let orderNotAlreadySelected = selectedOrderID != orderID
let indexPath = dataSource.indexPath(for: identifier)
let indexPathNotAlreadySelected = selectedIndexPath != indexPath
let shouldSwitchDetails = orderNotAlreadySelected || indexPathNotAlreadySelected
let shouldSwitchDetails = orderNotAlreadySelected || indexPathNotAlreadySelected || isTriggeredByUserAction
if shouldSwitchDetails {
showOrderDetails(detailsViewModel.order)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ final class OrdersRootViewController: UIViewController {
/// - Returns: Whether the order to select is in the list already (i.e. the order has been fetched and exists locally).
@discardableResult
func selectOrderFromListIfPossible(for orderID: Int64) -> Bool {
ordersViewController.selectOrderFromListIfPossible(for: orderID)
ordersViewController.selectOrderFromListIfPossible(
for: orderID,
isTriggeredByUserAction: true
)
}

/// Called when an order is shown externally (outside of `OrderListViewController`) and the order should be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,26 +129,30 @@ private extension OrdersSplitViewWrapperController {
// shown should replace the topViewController, to avoid having to tap back through several Order Details
// screens in the navigation stack. The back button should always go to the Order List.
// The up and down arrows are enabled when there is more than one item in `viewModels`.
guard isQuickOrderNavigationSupported(viewModels: viewModels),
let viewModel = viewModels[safe: currentIndex],
let secondaryNavigationController = ordersSplitViewController.viewController(for: .secondary) as? UINavigationController,
secondaryNavigationController.topViewController is OrderDetailsViewController else {
guard
let viewModel = viewModels[safe: currentIndex],
let secondaryNavigationController = ordersSplitViewController.viewController(for: .secondary) as? UINavigationController,
let existingOrderDetailsViewController = secondaryNavigationController.topViewController as? OrderDetailsViewController,
existingOrderDetailsViewController.isQuickOrderNavigationSupported() == orderDetailsViewController.isQuickOrderNavigationSupported()
else {
// When showing an order without quick navigation, it simply sets the order details to the secondary view.
let orderDetailsNavigationController = WooNavigationController(rootViewController: orderDetailsViewController)
showSecondaryView(orderDetailsNavigationController)
onCompletion?(true)
return
}

secondaryNavigationController.replaceTopViewController(with: orderDetailsViewController, animated: false)
ordersViewController.onOrderSelected(id: viewModel.order.orderID)
if !existingOrderDetailsViewController.isPresentingViewModelOrder(viewModel) {
secondaryNavigationController.replaceTopViewController(
with: orderDetailsViewController,
animated: false
)
ordersViewController.onOrderSelected(id: viewModel.order.orderID)
}

ordersSplitViewController.show(.secondary)
onCompletion?(true)
}

func isQuickOrderNavigationSupported(viewModels: [OrderDetailsViewModel]) -> Bool {
viewModels.count > 1
}
}

private extension OrdersSplitViewWrapperController {
Expand Down