File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
WooCommerce/Classes/ViewRelated/Products/Edit Product Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,7 @@ final class ProductFormViewController: UIViewController {
2020 private var product : Product {
2121 didSet {
2222 defer {
23- let isUpdateEnabled = product != originalProduct ||
24- productImageActionHandler. productImageStatuses. hasImagesPendingUpload
23+ let isUpdateEnabled = hasUnsavedChanges ( product: product)
2524 updateNavigationBar ( isUpdateEnabled: isUpdateEnabled)
2625 }
2726
@@ -409,7 +408,7 @@ private extension ProductFormViewController {
409408//
410409extension ProductFormViewController {
411410 override func shouldPopOnBackButton( ) -> Bool {
412- if product != originalProduct {
411+ if hasUnsavedChanges ( product: product ) {
413412 presentBackNavigationActionSheet ( )
414413 return false
415414 }
@@ -421,6 +420,10 @@ extension ProductFormViewController {
421420 self ? . navigationController? . popViewController ( animated: true )
422421 } )
423422 }
423+
424+ private func hasUnsavedChanges( product: Product ) -> Bool {
425+ return product != originalProduct || productImageActionHandler. productImageStatuses. hasImagesPendingUpload
426+ }
424427}
425428
426429
You can’t perform that action at this time.
0 commit comments