@@ -97,16 +97,7 @@ final class ProductFormViewController<ViewModel: ProductFormViewModelProtocol>:
9797 override func viewDidLoad( ) {
9898 super. viewDidLoad ( )
9999 configurePresentationStyle ( )
100-
101- // If the page opens from product variation,
102- // product variation ID will show on navigation bar title along with text `Variation`
103- // See more: https://github.com/woocommerce/woocommerce-ios/issues/4846
104- if let variationID = self . viewModel. productionVariationID {
105- configureNavigationBar ( title: Localization . variationViewTitle ( variationID: " \( variationID) " ) )
106- }
107- else {
108- configureNavigationBar ( )
109- }
100+ configureNavigationBar ( )
110101
111102 configureMainView ( )
112103 configureTableView ( )
@@ -421,7 +412,7 @@ private extension ProductFormViewController {
421412 func configureNavigationBar( title: String = String ( ) ) {
422413 updateNavigationBar ( )
423414 updateBackButtonTitle ( )
424- updateNavigationBarTitle ( title : title )
415+ updateNavigationBarTitle ( )
425416 }
426417
427418 func configureMainView( ) {
@@ -617,16 +608,16 @@ private extension ProductFormViewController {
617608//
618609private extension ProductFormViewController {
619610 func saveProduct( status: ProductStatus ? = nil ) {
620- var productStatus = status ?? product. status
611+ let productStatus = status ?? product. status
612+ var messageType = viewModel. saveMessageType ( for: productStatus)
621613
622- // Set productStatus to custom type for saving a variation
614+ // Set messageType to `saveVariation`
623615 // This will change Progress view title and message for variation save action.
624616 // Fix for the issue: https://github.com/woocommerce/woocommerce-ios/issues/4847
625- if let _ = self . viewModel . productionVariationID {
626- productStatus = . custom ( " variation " )
617+ if viewModel is ProductVariationFormViewModel {
618+ messageType = . saveVariation
627619 }
628620
629- let messageType = viewModel. saveMessageType ( for: productStatus)
630621 showSavingProgress ( messageType)
631622 saveImagesAndProductRemotely ( status: status)
632623 }
@@ -821,9 +812,12 @@ private extension ProductFormViewController {
821812 navigationItem. backButtonTitle = viewModel. productModel. name. isNotEmpty ? viewModel. productModel. name : Localization . unnamedProduct
822813 }
823814
824- func updateNavigationBarTitle( title: String ) {
825- // Update navigation bar title with variation ID
826- self . title = title
815+ func updateNavigationBarTitle( ) {
816+ // Update navigation bar title with variation ID for variation page
817+ guard let variationID = viewModel. productionVariationID else {
818+ return
819+ }
820+ title = Localization . variationViewTitle ( variationID: " \( variationID) " )
827821 }
828822
829823 func updateNavigationBar( ) {
0 commit comments