Skip to content

Commit 4861614

Browse files
committed
Added isMovingFromParent, useful for when ProductVisibilityVC it's called from presenting some modal
1 parent 6a1b11f commit 4861614

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

WooCommerce/Classes/ViewRelated/Products/Edit Product/Product Settings/Visibility/ProductVisibilityViewController.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ final class ProductVisibilityViewController: UIViewController {
4747

4848
override func viewWillDisappear(_ animated: Bool) {
4949
super.viewWillDisappear(animated)
50-
51-
/// if the visibility selected is different from protected by password, the password becomes always an empty string (no password)
52-
if visibility != .passwordProtected {
53-
productSettings.password = ""
50+
if isMovingFromParent {
51+
/// if the visibility selected is different from protected by password, the password becomes always an empty string (no password)
52+
if visibility != .passwordProtected {
53+
productSettings.password = ""
54+
}
55+
56+
onCompletion(productSettings)
5457
}
55-
56-
onCompletion(productSettings)
5758
}
5859

5960
private func reloadSections() {

0 commit comments

Comments
 (0)