From 1ac23db5162fa94742f18f00daf87a62a63f8dca Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Thu, 15 Apr 2021 09:33:00 +0200 Subject: [PATCH] fix(dialogs): put cancel button of confirm/prompt on the left (#346) --- dialog/ios/Plugin/DialogPlugin.swift | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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) }