From 082ee1f19219a7dcc39f60920d3e0752a8ab51a8 Mon Sep 17 00:00:00 2001 From: Josh Heald Date: Mon, 23 Sep 2024 12:11:59 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20repeatedly=20try=20to=20hide=20?= =?UTF-8?q?onboarding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When onboarding has been completed, we hide onboarding and call a completion handler to indicate to the payment systems that we’re ready to collect a payment. This is done in a Combine subscription handler, but that was not cleared after we called completion. This adds risk that we might try to hide onboarding twice (which would be fine) and then start the payment twice (which wouldn’t be great!) This commit clears the subscription when we’ve completed onboarding. --- .../CardPresentPaymentsOnboardingPresenter.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WooCommerce/Classes/ViewRelated/Orders/Collect Payments/CardPresentPaymentsOnboardingPresenter.swift b/WooCommerce/Classes/ViewRelated/Orders/Collect Payments/CardPresentPaymentsOnboardingPresenter.swift index 72d08697377..cb424d7ed29 100644 --- a/WooCommerce/Classes/ViewRelated/Orders/Collect Payments/CardPresentPaymentsOnboardingPresenter.swift +++ b/WooCommerce/Classes/ViewRelated/Orders/Collect Payments/CardPresentPaymentsOnboardingPresenter.swift @@ -59,6 +59,8 @@ final class CardPresentPaymentsOnboardingPresenter: CardPresentPaymentsOnboardin self?.hideOnboarding(onboardingViewController) completion() + + self?.readinessSubscription = nil }) }