From e9f8a41e2fff739589c495ce07dc1911e025d975 Mon Sep 17 00:00:00 2001 From: Kondrat Kielar Date: Mon, 8 Aug 2022 10:59:00 +0200 Subject: [PATCH 1/2] Present/Dismiss Apple Pay sheet on from main queue --- ios/Plugin/ApplePayService.swift | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ios/Plugin/ApplePayService.swift b/ios/Plugin/ApplePayService.swift index 71622d0..d70b51b 100644 --- a/ios/Plugin/ApplePayService.swift +++ b/ios/Plugin/ApplePayService.swift @@ -41,9 +41,11 @@ class ApplePayService: NSObject { let request = callPayload.toPKPaymentRequest() let paymentController = PKPaymentAuthorizationController(paymentRequest: request) paymentController.delegate = self - paymentController.present { [weak self] (presented) in - if !presented { - self?.paymentInitHandler?(.failure(.couldNotPresentSheet)) + DispatchQueue.main.async { + paymentController.present { [weak self] (presented) in + if !presented { + self?.paymentInitHandler?(.failure(.couldNotPresentSheet)) + } } } } @@ -59,9 +61,10 @@ class ApplePayService: NSObject { resultHandler(.failure(.couldNotParsePaymentCompletionStatus)) return } - - paymentCompletionHandler(result) resultHandler(.success(())) + DispatchQueue.main.async { + paymentCompletionHandler(result) + } self.paymentCompletionHandler = nil } } From d4d47cb1c465a4947d4f68ae89705faf28a17b3b Mon Sep 17 00:00:00 2001 From: Kondrat Kielar Date: Mon, 8 Aug 2022 11:01:27 +0200 Subject: [PATCH 2/2] Release v1.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c2b2c14..2418479 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fresha/capacitor-plugin-applepay", - "version": "1.0.1", + "version": "1.0.2", "description": "Apple Pay plugin for Capacitor", "main": "dist/plugin.cjs.js", "module": "dist/esm/index.js",