From 892860867046249855c2434fb3c0b72d6e9661cf Mon Sep 17 00:00:00 2001 From: borisprimer <137198782+borisprimer@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:39:08 +0100 Subject: [PATCH] fix: Disable the close button for Klarna during payment processing (#1058) Disable the close button for Klarna during payment processing Co-authored-by: Boris Nikolic --- Debug App/Podfile.lock | 10 +++---- Package.resolved | 16 ++++++++++ .../KlarnaTokenizationViewModel.swift | 29 +++++++++++++++++++ 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 Package.resolved diff --git a/Debug App/Podfile.lock b/Debug App/Podfile.lock index c3f006f4dd..b2de1949fb 100644 --- a/Debug App/Podfile.lock +++ b/Debug App/Podfile.lock @@ -4,9 +4,9 @@ PODS: - PrimerIPay88MYSDK (0.1.7) - PrimerKlarnaSDK (1.1.1) - PrimerNolPaySDK (1.0.1) - - PrimerSDK (2.32.0): - - PrimerSDK/Core (= 2.32.0) - - PrimerSDK/Core (2.32.0) + - PrimerSDK (2.32.1): + - PrimerSDK/Core (= 2.32.1) + - PrimerSDK/Core (2.32.1) - PrimerStripeSDK (1.0.0) DEPENDENCIES: @@ -37,9 +37,9 @@ SPEC CHECKSUMS: PrimerIPay88MYSDK: 436ee0be7e2c97e4e81456ccddee20175e9e3c4d PrimerKlarnaSDK: 564105170cc7b467bf95c31851813ea41c468f8b PrimerNolPaySDK: 08b140ed39b378a0b33b4f8746544a402175c0cc - PrimerSDK: db06e6553747bdadf8a8ca276d556745af38bba3 + PrimerSDK: 41eb9f627fa189f3edafdb18ea2a671d4403b3e2 PrimerStripeSDK: c37d4e7c1b5256d67d4890c4cc4b38ddc9427489 PODFILE CHECKSUM: fa17ead44d40b0b09abc2f30a5cc3d8aefe389e1 -COCOAPODS: 1.15.2 +COCOAPODS: 1.16.2 diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 0000000000..35b492a740 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "Primer3DS", + "repositoryURL": "https://github.com/primer-io/primer-sdk-3ds-ios", + "state": { + "branch": null, + "revision": "7d2c9ac8825a4459034a1416012cae61761543fd", + "version": "2.4.1" + } + } + ] + }, + "version": 1 +} diff --git a/Sources/PrimerSDK/Classes/User Interface/TokenizationViewModels/KlarnaTokenizationViewModel.swift b/Sources/PrimerSDK/Classes/User Interface/TokenizationViewModels/KlarnaTokenizationViewModel.swift index fc7df4d669..9aeb91ab2f 100644 --- a/Sources/PrimerSDK/Classes/User Interface/TokenizationViewModels/KlarnaTokenizationViewModel.swift +++ b/Sources/PrimerSDK/Classes/User Interface/TokenizationViewModels/KlarnaTokenizationViewModel.swift @@ -39,6 +39,35 @@ class KlarnaTokenizationViewModel: PaymentMethodTokenizationViewModel { try tokenizationComponent.validate() } + override func start() { + + checkoutEventsNotifierModule.didStartTokenization = { + DispatchQueue.main.async { + self.uiManager.primerRootViewController?.enableUserInteraction(false) + } + } + + checkoutEventsNotifierModule.didFinishTokenization = { + DispatchQueue.main.async { + self.uiManager.primerRootViewController?.enableUserInteraction(true) + } + } + + didStartPayment = { + DispatchQueue.main.async { + self.uiManager.primerRootViewController?.enableUserInteraction(false) + } + } + + didFinishPayment = { _ in + DispatchQueue.main.async { + self.uiManager.primerRootViewController?.enableUserInteraction(true) + } + } + + super.start() + } + override func performPreTokenizationSteps() -> Promise { let event = Analytics.Event.ui( action: .click,