File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
WooCommerce/Classes/ViewRelated/Orders/Order Creation Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -150,7 +150,10 @@ struct NewOrder: View {
150150 . id ( navigationButtonID)
151151 . accessibilityIdentifier ( Accessibility . createButtonIdentifier)
152152 . disabled ( viewModel. disabled)
153-
153+ case . done:
154+ Button ( Localization . doneButton) {
155+ dismissHandler ( )
156+ }
154157 case . loading:
155158 ProgressView ( )
156159 }
@@ -244,6 +247,7 @@ private extension NewOrder {
244247 enum Localization {
245248 static let title = NSLocalizedString ( " New Order " , comment: " Title for the order creation screen " )
246249 static let createButton = NSLocalizedString ( " Create " , comment: " Button to create an order on the New Order screen " )
250+ static let doneButton = NSLocalizedString ( " Done " , comment: " Button to dismiss the Order Editing screen " )
247251 static let cancelButton = NSLocalizedString ( " Cancel " , comment: " Button to cancel the creation of an order on the New Order screen " )
248252 static let products = NSLocalizedString ( " Products " , comment: " Title text of the section that shows the Products when creating a new order " )
249253 static let addProduct = NSLocalizedString ( " Add Product " , comment: " Title text of the button that adds a product when creating a new order " )
Original file line number Diff line number Diff line change @@ -368,6 +368,7 @@ extension NewOrderViewModel {
368368 ///
369369 enum NavigationItem : Equatable {
370370 case create
371+ case done
371372 case loading
372373 }
373374
@@ -520,12 +521,17 @@ private extension NewOrderViewModel {
520521 ///
521522 func configureNavigationTrailingItem( ) {
522523 Publishers . CombineLatest ( orderSynchronizer. orderPublisher, $performingNetworkRequest)
523- . map { order, performingNetworkRequest -> NavigationItem in
524- guard !performingNetworkRequest else {
524+ . map { [ weak self ] order, performingNetworkRequest -> NavigationItem in
525+ guard let self = self , !performingNetworkRequest else {
525526 return . loading
526527 }
527528
528- return . create
529+ switch self . flow {
530+ case . creation:
531+ return . create
532+ case . editing:
533+ return . done
534+ }
529535 }
530536 . assign ( to: & $navigationTrailingItem)
531537 }
You can’t perform that action at this time.
0 commit comments