diff --git a/dialog/ios/Plugin/DialogPlugin.swift b/dialog/ios/Plugin/DialogPlugin.swift index 44b2f370d..b226ef639 100644 --- a/dialog/ios/Plugin/DialogPlugin.swift +++ b/dialog/ios/Plugin/DialogPlugin.swift @@ -35,14 +35,14 @@ public class DialogPlugin: CAPPlugin { DispatchQueue.main.async { [weak self] in let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert) - alert.addAction(UIAlertAction(title: okButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in + alert.addAction(UIAlertAction(title: cancelButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in call.resolve([ - "value": true + "value": false ]) })) - alert.addAction(UIAlertAction(title: cancelButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in + alert.addAction(UIAlertAction(title: okButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in call.resolve([ - "value": false + "value": true ]) })) self?.bridge?.viewController?.present(alert, animated: true, completion: nil) @@ -68,6 +68,12 @@ public class DialogPlugin: CAPPlugin { textField.text = inputText } + alert.addAction(UIAlertAction(title: cancelButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in + call.resolve([ + "value": "", + "cancelled": true + ]) + })) alert.addAction(UIAlertAction(title: okButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in let textField = alert.textFields?[0] call.resolve([ @@ -75,12 +81,6 @@ public class DialogPlugin: CAPPlugin { "cancelled": false ]) })) - alert.addAction(UIAlertAction(title: cancelButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in - call.resolve([ - "value": "", - "cancelled": true - ]) - })) self?.bridge?.viewController?.present(alert, animated: true, completion: nil) }