Skip to content

Commit 4bcf4f2

Browse files
committed
Added workaround to dismiss the notices
1 parent 40066d1 commit 4bcf4f2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

WooCommerce/Classes/ViewRelated/Products/Variations/ProductVariationsViewController.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ final class ProductVariationsViewController: UIViewController, GhostableViewCont
6464
///
6565
private let syncingCoordinator = SyncingCoordinator()
6666

67+
6768
private lazy var stateCoordinator: PaginatedListViewControllerStateCoordinator = {
6869
let stateCoordinator = PaginatedListViewControllerStateCoordinator(onLeavingState: { [weak self] state in
6970
self?.didLeave(state: state)
@@ -668,10 +669,18 @@ private extension ProductVariationsViewController {
668669
}
669670

670671
/// Dismiss any `InProgressViewController` being presented.
672+
/// By default retires the dismissal one time to overcome UIKit presentation delays.
671673
///
672-
private func dismissBlockingIndicator() {
674+
private func dismissBlockingIndicator(retry: Bool = true) {
673675
if let inProgressViewController = self.presentedViewController as? InProgressViewController {
674676
inProgressViewController.dismiss(animated: true)
677+
} else {
678+
// When this method is invoked right after `InProgressViewController` is presented, chances are that it won't exists in the view controller
679+
// hierarchy yet.
680+
// Here we are retrying it with a small delay to give UIKit APIs time to finish its presentation.
681+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
682+
self.dismissBlockingIndicator(retry: false)
683+
}
675684
}
676685
}
677686

0 commit comments

Comments
 (0)