From 865a28e8b8ca110cf095539218ec1bf287e95c8b Mon Sep 17 00:00:00 2001 From: Justin Unterreiner Date: Tue, 22 Oct 2019 11:13:20 -0700 Subject: [PATCH] Modal iOS: Don't call success callback immediately --- ios/Capacitor/Capacitor/Plugins/Modals.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ios/Capacitor/Capacitor/Plugins/Modals.swift b/ios/Capacitor/Capacitor/Plugins/Modals.swift index 3f9b083b1..571258735 100644 --- a/ios/Capacitor/Capacitor/Plugins/Modals.swift +++ b/ios/Capacitor/Capacitor/Plugins/Modals.swift @@ -14,14 +14,13 @@ public class CAPModalsPlugin : CAPPlugin { let buttonTitle = call.options["buttonTitle"] as? String ?? "OK" let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert) - alert.addAction(UIAlertAction(title: buttonTitle, style: UIAlertAction.Style.default, handler: nil)) + alert.addAction(UIAlertAction(title: buttonTitle, style: UIAlertAction.Style.default, handler: { (action) -> Void in + call.success() + })) DispatchQueue.main.async { self.bridge.viewController.present(alert, animated: true, completion: nil) } - - // Call success immediately - call.success() } @objc public func confirm(_ call: CAPPluginCall) {